-
-
Notifications
You must be signed in to change notification settings - Fork 1.7k
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
Custom rules documentation #617
Comments
Advanced modifications require some sources inspect. See https://github.com/markdown-it/markdown-it/blob/master/lib/renderer.js It uses default renderer function if "named" one not exists. Seems simple. |
Indeed, but to know which rule I'd have to create I have to know what to name my key in the rule object. Again looking at #598 I see that to add a rule to access the opening tag of a link I have to set the function at the key
Yes, I did read through parts of the source code but didn't find a solution (maybe looked in the wrong place, etc etc.). I find it especially strange that the readme explicitly mentions (in the 6th line none the least)
But then there is no follow up on how to do that. |
Parser is non trivial thing. We have no resources to write a big book. If you describe exactly what you need, i could try to help with direction. |
What is the correct way to add rules to access the opening and closing tag of a 'li' Element? |
See tags in demo You probably may wish to override default renderer rules for Is this what you need? |
Yes, it is! Thank you very much. |
Hi Team, If I want to modify and want to have "$" and "$" as the begin and end to denote "bold" instead of "**", is there a straight forward way yo do it. Comparing it with other markdown editors, they are called as textPatters. So, my question is - is there a way to pass custom textPatters to this markdownIt -Regards |
Hello everyone,
my CSS dude wants me to add a wrapper element within every
li
when translating markdown to HTML.Looking at #598 I see it is possible to inject custom rules and functionality into
markdown-it
bymodifying
mdi.renderer.rules
. However, I can't find documentation in the readme as to which keysrules
has/expects for certain elements.When displaying the content of
rules
at build time it looks like only default rules are present, meaning I have to add new rules myself. But again, I am not sure how to properly extendrules
: Looking at #598 I see the function itself doesn't differentiate between elements it applies its changes to all values it receives. So I guess it depends on the key name inrules
which element the function is applied on? If so where can I find a list of which key names are available?Best regards
The text was updated successfully, but these errors were encountered: