Giter Club home page Giter Club logo

Comments (7)

mity avatar mity commented on June 14, 2024

Would a pull request to move just the rendering code to a separate source file be accepted?

It would be welcome.

If so, is it likely to conflict with any changes you are working on for issue #5?

Working on #5 will likely take a day or two before I even start touching the rendering side. And even then, changes on the renderer side should be fairly simple and well localized so even if there is a conflict, it should be easy to resolve it. So feel free to go ahead.

from md4c.

mity avatar mity commented on June 14, 2024

@craigbarnes I just want to sync with you. I am about to start the work on the renderer side for #5. So if you haven't yet started, then perhaps rather wait a day or two, and if you are close to makeing the pull request, then let me know, and I'll wait until your changes are done and upstreamed.

from md4c.

craigbarnes avatar craigbarnes commented on June 14, 2024

I started working on it and I think I have a good idea what needs to be done now, but I got to the point where I wanted to rewrite the whole patch and maybe split it into a few separate commits to make it easier to review. So, since I will probably start from scratch anyway, I will wait until after you land the changes for issue #5.

from md4c.

mity avatar mity commented on June 14, 2024

@craigbarnes Fix of #5 is committed so feel free to start. I will yet do some testing of it, but even if I encounter some bugs, it should be on the parser side. The changes in the renderer side are quite simple and some refactoring.

from md4c.

craigbarnes avatar craigbarnes commented on June 14, 2024

I've been thinking about this some more. It seems like the globals in md2html.c need to be replaced with a state struct (that can be passed around as a parameter) before the renderer can be split out into a reusable part. The HTML utility functions are also somewhat difficult to reuse, since they implicitly depend on the membuf type. This is totally reasonable for a command line utility like md2html but I'm starting to think it'd be easier to write a new, reusable renderer from scratch.

I think what I will do for now is work on implementing a custom renderer for my app and when I have something that works maybe try to incorporate it back into the upstream md2html.c.

from md4c.

mity avatar mity commented on June 14, 2024

Ok.

Maybe I will take a look and if I find an easy way, I'll try to do something with it.

from md4c.

mity avatar mity commented on June 14, 2024

I think I have found quite a straightforward way so it is done. Take a look whether it is usable for you.

There is still some space for improvement, in particular the output callback could return an int which would be propagated through all the functions in render_html.c into parser so the renderer callback could abort prematurely, but I was too lazy to do that in a single step.

from md4c.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.