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
How could one change the rendering of some elements?
So how, for example, could i add css classes to some elements, that they fit nicely into my website?
The text was updated successfully, but these errors were encountered:
Right now the process to create html from markdown is like this:
you start with a MarkdownConfig (a bunch of specialized Inline and block parsers)
a document is parsed with the config and tokens are produced
document is rendered which means you call $ method on the token
Say you want to add an anchor (with a slug), to all headings. You would need to:
create a new LinkableHeadingToken (e.g. inherit from current Heading) with your custom $ method
create new parsers that work in the same way current m heading generating parsers (there is two of them) but generate your new token (maybe you can inherit from them)
create a new config with your custom heading parsers and use those in markdown call
I think this process could be streamlined for cases like the above by allowing in markdown proc an additional pipeline that can process and modify the tokens.
Have not tried that yet, there might be additional details I am missing.
I have been thinking about this for a while, thanks for the opportunity to take a stab at writing it down. :)
How could one change the rendering of some elements?
So how, for example, could i add css classes to some elements, that they fit nicely into my website?
The text was updated successfully, but these errors were encountered: