Comments (7)
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.
@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.
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.
@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.
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.
Ok.
Maybe I will take a look and if I find an easy way, I'll try to do something with it.
from md4c.
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)
- Setext underline not recognized if a tab follows it.
- HTML declarations are not recognized without a whitespace HOT 1
- Incorrect parsing of difficult emphasis cases
- OSS-Fuzz issue 65781 HOT 2
- OSS-Fuzz issue 65875
- Striketrough incorrectly matches closer with 1st opener, not the last preceding one.
- code spans differ - cmark vs md2html
- OSS-Fuzz issue 65943 HOT 1
- permissive url ending with slash not recognized
- code spans differ - cmark vs md2html (reprise)
- md2html not outputing <meta charset="UTF-8"> HOT 5
- "shadowed" variables warning HOT 2
- Pathological input
- pathologic input: O(n^2) with link ref. defs HOT 1
- Adding an HTML to Markdown parser/converter (html2md) HOT 5
- Improve strikethrough around double quotes HOT 1
- Strikethrough with punctuation special case HOT 2
- compatibility: initial tab replaced by four spaces HOT 2
- TAB in heading HOT 1
- spurious hard break after html tag HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from md4c.