Adding custom syntax to markdown #1456
-
Is there any tutorial or guide to adding custom syntax to markdown? I know I can use the directives plugin to effectively create arbitrary syntax, but I already have hundreds of documents using the specific syntax I'd like to implement. I previously implemented it using marked, but I'd like to move to the unified ecosystem - I'm just struggling with this. I've been looking at the source of existing plugins and will probably figure it out eventually this way, but I was hoping to find a little more guidance. |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 1 reply
-
Modifying the parser crossed a few layers, read through https://unifiedjs.com/learn/ To your specific question, see the parser guide in micromark, the lowest level abstraction in the project If you're also looking for examples https://github.com/remarkjs/remark/blob/main/doc/plugins.md has tons of existing plugins which may give further ideas on patterns to adopt. |
Beta Was this translation helpful? Give feedback.
Modifying the parser crossed a few layers, read through https://unifiedjs.com/learn/
To familiarize yourself with the layers and some common patterns.
To your specific question, see the parser guide in micromark, the lowest level abstraction in the project
https://github.com/micromark/micromark?tab=readme-ov-file#creating-a-micromark-extension
If you're also looking for examples https://github.com/remarkjs/remark/blob/main/doc/plugins.md has tons of existing plugins which may give further ideas on patterns to adopt.