mirror of
https://github.com/showdownjs/showdown.git
synced 2024-03-22 13:30:55 +08:00
5c50675cca
correctly When a user enters a URL with emphasis or strikethrough, the html output were incorrect. Now, URLs inside emphasis or strikethrough are parsed corerctly Closes #347
19 lines
619 B
JavaScript
19 lines
619 B
JavaScript
showdown.subParser('strikethrough', function (text, options, globals) {
|
|
'use strict';
|
|
|
|
function parseInside (txt) {
|
|
if (options.simplifiedAutoLink) {
|
|
txt = showdown.subParser('simplifiedAutoLinks')(txt, options, globals);
|
|
}
|
|
return '<del>' + txt + '</del>';
|
|
}
|
|
|
|
if (options.strikethrough) {
|
|
text = globals.converter._dispatch('strikethrough.before', text, options, globals);
|
|
text = text.replace(/(?:~){2}([\s\S]+?)(?:~){2}/g, function (wm, txt) { return parseInside(txt); });
|
|
text = globals.converter._dispatch('strikethrough.after', text, options, globals);
|
|
}
|
|
|
|
return text;
|
|
});
|