markdown-js icon indicating copy to clipboard operation
markdown-js copied to clipboard

Support specific sections that are not processed by markdown

Open kasperpeulen opened this issue 12 years ago • 1 comments

I would like to see support for specific sections that are not processed by markdown. This would solve the mathjax issue: https://github.com/evilstreak/markdown-js/issues/129, but this may also be usefull for other extensions.

For the mathjax example, I would like to tell markdown to not process anything between $...$, \(... \), $$ ... $$, \[...\], \begin ... \end. Would this be possible ?

kasperpeulen avatar Nov 17 '13 17:11 kasperpeulen

Discourse.Dialect.registerBlock('math', function(block, next) {
    if (block.match(/\$|\\begin|\\end|\\[|\\]|\\(|\\)/) ) {
    return [ block.toString() ];
  }
});

I'm not sure what the right syntax is for markdown-js. But this work at the discourse software. This makes sure that if a paragraph contains math, then markdown is disabled. This is the direction that I would like it, but not optimal yet. It would be better if only the math itself is not parsed by markdown, now the whole paragraph is not parsed.

kasperpeulen avatar Nov 22 '13 03:11 kasperpeulen