Markdown parser, done right. 100% CommonMark support, extensions, syntax plugins & high speed
https://markdown-it.github.io/
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
2.0 KiB
2.0 KiB
Development recommendations
Prior to continue, make sure you've readed:
General considerations for plugins.
- Try to understand, where your plugin rule sould be located
- Will it conflict with existing markup (by priority)?
- If yes - you need to write inline or block rule.
- If no - you can morth tokens in core chain.
- Remember, that tokens morphing in core is always more simple than writing block / inline rules. However, block / inline rules are usually faster
- Sometime it's enougth to modify renderer only (for example, to add header IDs or target=_blank for the links)
- Search existing plugins or rules, doing something similar. It can me more simple to modify existing code, instead of writing from scratch.
- If you did all steps above, but still has questions - ask in
tracker. But, please:
- Be specific. Generic questions like "how to do plugins" and "how to learn programming" are not accepted.
- Don't ask us to break CommonMark specification. Such things should be discussed first on CommonMark forum.
Notes for NPM packages
To simplify search:
- add to
package.json
keyswordsmarkdown-it
andmarkdown-it-plugin
for plugins - add keyword
markdown-it
for any other related packages.
FAQ
I need async rule, how to do it?
Sorry. You can't do it directly. All complex parsers are sync by nature. But you can use workarounds:
- On parse phase, replace content by random number and store it in
env
. - Do async processing over collected data.
- Render content and replace those random numbers with text (or replace first, then render)