2015-08-03 10:47:49 +08:00
|
|
|
showdown.subParser('strikethrough', function (text, options, globals) {
|
2015-07-11 22:59:06 +08:00
|
|
|
'use strict';
|
|
|
|
|
2017-02-27 03:13:52 +08:00
|
|
|
function parseInside (txt) {
|
|
|
|
if (options.simplifiedAutoLink) {
|
|
|
|
txt = showdown.subParser('simplifiedAutoLinks')(txt, options, globals);
|
|
|
|
}
|
|
|
|
return '<del>' + txt + '</del>';
|
|
|
|
}
|
|
|
|
|
2015-07-11 22:59:06 +08:00
|
|
|
if (options.strikethrough) {
|
2016-03-21 01:08:44 +08:00
|
|
|
text = globals.converter._dispatch('strikethrough.before', text, options, globals);
|
2017-02-27 03:13:52 +08:00
|
|
|
text = text.replace(/(?:~){2}([\s\S]+?)(?:~){2}/g, function (wm, txt) { return parseInside(txt); });
|
2016-03-21 01:08:44 +08:00
|
|
|
text = globals.converter._dispatch('strikethrough.after', text, options, globals);
|
2015-07-11 22:59:06 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
return text;
|
|
|
|
});
|