-
Notifications
You must be signed in to change notification settings - Fork 246
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Extensible rendering proposal #116
Comments
This seems to be the most highly requested feature, seeing as how this could solve these issues:
Unfortunately, it's not as easy as implementing As I see it, there's three ways we could go about this:
|
Quick update here: we have decided that the general approach of pulldown is to focus on parsing markdown, and only provide a simple renderer for basic, fast HTML generation. More advanced rendering features are encouraged to be built on top of markdown out-of-crate. In that spirit, we will not include more advanced rendering options in the near future and I'll close this issue for now. If you need more information out of pulldown for your rendering needs, please feel free to open another issue. |
Hi there!
@reillysiemens and I have been working on cleaning up the customized Markdown processing in the Gutenberg static site generator, which uses pulldown-cmark for the base markdown processing.
For the most part, the extensions that "Gutenberg Flavored Markdown" would require can be accomplished just by manipulating the iterator of events before passing it to the renderer. However, for a few features, notably adding ids to
h*
tags and otherwise manipulating the internal portions of how specific tags are rendered doesn't seem to be possible with the current design.We have started exploring implementing a more extensible structure in the
html
module that would allow reuse of the current commonmark html generation code, while also allowing the user to provide custom rendering behavior and even possibly their own event types. I've submitted a PR with our experimentation so far.The basic gist of our approach is to introduce a new trait
IntoHtml
for renderingEvent
s into HTML, move the current commonmark rendering to be done through the new trait, and then also expose enough of the current rendering implementation in a public API so that is available for reuse.Hopefully this idea sounds interesting to you all, and if you have any feedback about what you think the end API should look like, that would be much appreciated. Also if I'm missing a way to customize how events are rendered please let me know!
Thanks!
The text was updated successfully, but these errors were encountered: