Closed ckoppelman closed 6 years ago
That is non-standard syntax, not supported in any flavor showdown supports (see babelmark2).
As such, is better suited for an extension, namely a listener extension (you can check a working example in this fiddle)
// Extension of type listener
showdown.extension('ins', function() {
return [{
type: 'listener',
listeners: {
// the extension is called right AFTER the parser parses italicsAndBold
// and only during span gamut
'italicsAndBold.after': function (event, text, options, globals) {
return text.replace(/(?:\+){2}([\s\S]+?)(?:\+){2}/g, function (wm, txt) {
if (options.simplifiedAutoLink) {
txt = showdown.subParser('simplifiedAutoLinks')(txt, options, globals);
}
return '<ins>' + txt + '</ins>'
});
}
}
}];
});
As you know, ShowdownJS is a free library and it will remain free forever. However, maintaining and improving the library costs time and money. Currently, we're looking to improve showdown with automated tests in all browsers and a proper domain and webpage. 500$ should be enough to to keep showdown testing framework running for a year or two.
If you like our work and find our library useful, please donate through Pledgie or directly through paypal!! Your contribution will be greatly appreciated.
I tried it out. Works perfectly. I understand why you'd want to limit the scope of the project.
For those who find this after me, this regex works a bit better by including trailing +
's and ensuring there's a non-whitespace character after the first ++
and before the last:
/(?:\+){2}(?=\S)([\s\S]*?\S)(?:\+){2}(?!\+)/g
In some flavors of markdown, just like
~~
means<del>
,++
means<ins>
I'd like an option parallel with
strikethrough
that allows me to convert the following:into:
I believe it's fairly simple. My lang converter to approximate this is below, but probably cloning the strikethrough parser is more robust: