John MacFarlane
2015-Apr-23 14:57 UTC
js syntax highlighting for markdown (not for codeblocks in markdown)
You might find this interesting: http://talk.commonmark.org/t/experiment-highlighting-markdown-via-source-mapping/1132 I'm not sure if the project he's describing is js, though. CommonMark.NET already has complete source mapping. When I find time, I'll complete the source location information produced by commonmark.js (which currently gives you source location for block elements, but not inline elements). I don't think this would be too hard. https://github.com/jgm/commonmark.js/issues/28
Tobias Bengfort
2015-Apr-24 09:14 UTC
js syntax highlighting for markdown (not for codeblocks in markdown)
Thanks for the quick reply, On 23/04/15 16:57, John MacFarlane wrote:> You might find this interesting: > http://talk.commonmark.org/t/experiment-highlighting-markdown-via-source-mapping/1132I am not sure if source mapping is the best approach. It sounds strange to me that the highlighter would need the AST *and* the original input. Wouldn't it be easier to include enough information in the AST to be able to reconstruct the original input (e.g. whitespace)? It should then be easy to add a second renderer for highlighting.> I'm not sure if the project he's describing is js, though.The URL mentions hoedown which is implemented in C. tobias