fix(strikethrough): Fix strikethrough issue with escaped chars

Closes #214
This commit is contained in:
Estevão Soares dos Santos 2015-10-30 00:58:56 +00:00
parent f81789f0fb
commit 5669317fe4
8 changed files with 4 additions and 2 deletions

BIN
dist/showdown.js vendored

Binary file not shown.

BIN
dist/showdown.js.map vendored

Binary file not shown.

BIN
dist/showdown.min.js vendored

Binary file not shown.

Binary file not shown.

View File

@ -3,7 +3,7 @@ showdown.subParser('strikethrough', function (text, options, globals) {
if (options.strikethrough) {
text = globals.converter._dispatch('strikethrough.before', text, options);
text = text.replace(/(?:~T){2}([^~]+)(?:~T){2}/g, '<del>$1</del>');
text = text.replace(/(?:~T){2}([\s\S]+?)(?:~T){2}/g, '<del>$1</del>');
text = globals.converter._dispatch('strikethrough.after', text, options);
}

View File

@ -0,0 +1 @@
<p>Your friend <del><a href="www.google.com"><strong>test*</strong></a></del> (<del><a href="www.google.com"><em>@test</em></a></del>) updated his/her description</p>

View File

@ -0,0 +1 @@
Your friend ~~[**test\***](www.google.com)~~ (~~[*@test*](www.google.com)~~) updated his/her description

View File

@ -19,7 +19,7 @@ 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') {
} else if (testsuite[i].name === '#164.3.strikethrough' || testsuite[i].name === '#214.escaped-markdown-chars-break-strikethrough') {
converter = new showdown.Converter({strikethrough: true});
} else if (testsuite[i].name === 'disable-gh-codeblocks') {
converter = new showdown.Converter({ghCodeBlocks: false});