GitbookIO / markup-it

JavaScript library to parse and serialize markup content (Markdown and HTML)
270 stars 49 forks source link

How to extends custom syntax #133

Open jinyang1994 opened 5 years ago

jinyang1994 commented 5 years ago

I want to add some custom syntax in markup-it. What should I do?

Soreine commented 5 years ago

You need to write a set of rules like it is done in the markdown or html folders. Rules are functions that are called, in order, to consume the input text during deserialization, or input node during serialization, and store their result in the State stack.

I'm sorry that we don't have a more detailed documentation and simple examples. You can play with the tests and the (quite complex) markdown parser implementation.

jinyang1994 commented 5 years ago

Thanks for your answer. Does it provide an interface for me to extend the syntax? It might look like md.use in markdown-it