diff --git a/dist/showdown.js b/dist/showdown.js index 561e2b1..f61f1a0 100644 Binary files a/dist/showdown.js and b/dist/showdown.js differ diff --git a/dist/showdown.js.map b/dist/showdown.js.map index c14a075..ba91e84 100644 Binary files a/dist/showdown.js.map and b/dist/showdown.js.map differ diff --git a/dist/showdown.min.js b/dist/showdown.min.js index b9e9494..60cbcfd 100644 Binary files a/dist/showdown.min.js and b/dist/showdown.min.js differ diff --git a/dist/showdown.min.js.map b/dist/showdown.min.js.map index 900b5d6..a1834e3 100644 Binary files a/dist/showdown.min.js.map and b/dist/showdown.min.js.map differ diff --git a/src/showdown.js b/src/showdown.js index a0ee56f..14a472b 100644 --- a/src/showdown.js +++ b/src/showdown.js @@ -13,7 +13,8 @@ var showdown = {}, headerLevelStart: 1, parseImgDimensions: false, simplifiedAutoLink: false, - literalMidWordUnderscores: false + literalMidWordUnderscores: false, + strikethrough: false }, globalOptions = JSON.parse(JSON.stringify(defaultOptions)); //clone default options out of laziness =P diff --git a/src/subParsers/spanGamut.js b/src/subParsers/spanGamut.js index 0193c3d..e2568da 100644 --- a/src/subParsers/spanGamut.js +++ b/src/subParsers/spanGamut.js @@ -20,6 +20,7 @@ showdown.subParser('spanGamut', function (text, options, globals) { text = showdown.subParser('autoLinks')(text, options, globals); text = showdown.subParser('encodeAmpsAndAngles')(text, options, globals); text = showdown.subParser('italicsAndBold')(text, options, globals); + text = showdown.subParser('strikethrough')(text, options, globals); // Do hard breaks: text = text.replace(/ +\n/g, '
\n'); diff --git a/src/subParsers/strikethrough.js b/src/subParsers/strikethrough.js new file mode 100644 index 0000000..b84ab39 --- /dev/null +++ b/src/subParsers/strikethrough.js @@ -0,0 +1,9 @@ +showdown.subParser('strikethrough', function (text, options) { + 'use strict'; + + if (options.strikethrough) { + text = text.replace(/(?:~T){2}([^~]+)(?:~T){2}/g, '$1'); + } + + return text; +}); diff --git a/test/features/#164.3.strikethrough.html b/test/features/#164.3.strikethrough.html new file mode 100644 index 0000000..68139e4 --- /dev/null +++ b/test/features/#164.3.strikethrough.html @@ -0,0 +1,5 @@ +

a strikethrough word

+ +

this should~~not be parsed

+ +

strike-through text

diff --git a/test/features/#164.3.strikethrough.md b/test/features/#164.3.strikethrough.md new file mode 100644 index 0000000..3498b1a --- /dev/null +++ b/test/features/#164.3.strikethrough.md @@ -0,0 +1,5 @@ +a ~~strikethrough~~ word + +this should~~not be parsed + +~~strike-through text~~ diff --git a/test/node/showdown.js b/test/node/showdown.js index 80834ff..5dd74a7 100644 --- a/test/node/showdown.js +++ b/test/node/showdown.js @@ -24,7 +24,8 @@ describe('showdown.options', function () { headerLevelStart: 1, parseImgDimensions: false, simplifiedAutoLink: false, - literalMidWordUnderscores: false + literalMidWordUnderscores: false, + strikethrough: false }; expect(showdown.getDefaultOptions()).to.be.eql(opts); }); diff --git a/test/node/testsuite.features.js b/test/node/testsuite.features.js index 77e0e24..4278638 100644 --- a/test/node/testsuite.features.js +++ b/test/node/testsuite.features.js @@ -18,6 +18,8 @@ describe('makeHtml() features testsuite', function () { converter = new showdown.Converter({simplifiedAutoLink: true}); } else if (testsuite[i].name === '#164.2.disallow_underscore_emphasis_mid_word') { converter = new showdown.Converter({literalMidWordUnderscores: true}); + } else if (testsuite[i].name === '#164.3.strikethrough') { + converter = new showdown.Converter({strikethrough: true}); } else { converter = new showdown.Converter(); }