You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
IF you're using cmark as a library, you can do this by walking the AST and converting CMARK_NODE_HEADING blocks to CMARK_CUSTOM blocks. A custom block has an "on enter" and "on exit" text which you can construct from the heading AST element; this will be rendered verbatim in HTML output.
If you're using the command line program, then you might try my lcmark, a small lua wrapper which adds 'filters' that can do what I've just described.
I'm using the Perl bindings (CPAN module CommonMark). I can process the parsed document using the iterator.
Until now I haven't been able to modify (replace) the NODE_LINK node by a NODE_CUSTOM_BLOCK.
It's all very new...
UPDATE: Got it working! Thanks for the crucial pointers.
GoldMark has a nice feature: you can define your own renderers for specific items, such as links and headings.
See e.g. how Hugo uses this: https://gist.github.com/killbus/f47efbd13d96b437b9d218334508bffb
It would be nice if cmark could do something similar.
The text was updated successfully, but these errors were encountered: