|
@@ -15,7 +15,8 @@ var showdown = {},
|
|
headerLevelStart: 1,
|
|
headerLevelStart: 1,
|
|
parseImgDimensions: false,
|
|
parseImgDimensions: false,
|
|
simplifiedAutoLink: false,
|
|
simplifiedAutoLink: false,
|
|
- literalMidWordUnderscores: false
|
|
|
|
|
|
+ literalMidWordUnderscores: false,
|
|
|
|
+ strikethrough: false
|
|
},
|
|
},
|
|
globalOptions = JSON.parse(JSON.stringify(defaultOptions)); //clone default options out of laziness =P
|
|
globalOptions = JSON.parse(JSON.stringify(defaultOptions)); //clone default options out of laziness =P
|
|
|
|
|
|
@@ -1910,6 +1911,7 @@ showdown.subParser('spanGamut', function (text, options, globals) {
|
|
text = showdown.subParser('autoLinks')(text, options, globals);
|
|
text = showdown.subParser('autoLinks')(text, options, globals);
|
|
text = showdown.subParser('encodeAmpsAndAngles')(text, options, globals);
|
|
text = showdown.subParser('encodeAmpsAndAngles')(text, options, globals);
|
|
text = showdown.subParser('italicsAndBold')(text, options, globals);
|
|
text = showdown.subParser('italicsAndBold')(text, options, globals);
|
|
|
|
+ text = showdown.subParser('strikethrough')(text, options, globals);
|
|
|
|
|
|
// Do hard breaks:
|
|
// Do hard breaks:
|
|
text = text.replace(/ +\n/g, ' <br />\n');
|
|
text = text.replace(/ +\n/g, ' <br />\n');
|
|
@@ -1918,6 +1920,16 @@ showdown.subParser('spanGamut', function (text, options, globals) {
|
|
|
|
|
|
});
|
|
});
|
|
|
|
|
|
|
|
+showdown.subParser('strikethrough', function (text, options) {
|
|
|
|
+ 'use strict';
|
|
|
|
+
|
|
|
|
+ if (options.strikethrough) {
|
|
|
|
+ text = text.replace(/(?:~T){2}([^~]+)(?:~T){2}/g, '<del>$1</del>');
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ return text;
|
|
|
|
+});
|
|
|
|
+
|
|
/**
|
|
/**
|
|
* Strip any lines consisting only of spaces and tabs.
|
|
* Strip any lines consisting only of spaces and tabs.
|
|
* This makes subsequent regexs easier to write, because we can
|
|
* This makes subsequent regexs easier to write, because we can
|