showdownjs / showdown

A bidirectional Markdown to HTML to Markdown converter written in Javascript
http://www.showdownjs.com/
MIT License
14.26k stars 1.56k forks source link

Don't process extension function return #830

Closed rsp4jack closed 2 years ago

rsp4jack commented 4 years ago

I'm writing a Showdown extension to add Mathjax support. But Mathjax can't process LaTeX commands, because Showdown will process some strings in LaTeX commands. I want use Showdown extension to skip processing for LaTeX commands, but need Showdown don't process extension function (like "filter" function) return.

rsp4jack commented 4 years ago

Example:

{
        type:    'lang',
        regex:   /(?:^|\n)\\\[(.*)\n([\s\S]*?)\n\\\]/g,
        replace: function (match, leadingSlash, codeblock) {
          return match;
        }
},

I hope that the text matching this regular expression will not be parsed, but directly use the return value (HTML) of this function (in any case).