Commonmark.js has a lovely feature that's rare in markdown renderers: it exposes an AST! https://github.com/commonmark/commonmark.js/#usage This makes it so much easier to extend/modify the syntax in a robust manner.