fix(strikethrough): allow escapinging tilde char

Since tilde is now used as a magic markdown character,
in strikethrough syntax, we need to enable escaping it.

Closes #331
This commit is contained in:
Estevao Soares dos Santos 2017-01-28 23:54:28 +00:00
parent a4c24c9805
commit 24d47d7c68
8 changed files with 5 additions and 1 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

@ -12,6 +12,6 @@
showdown.subParser('encodeBackslashEscapes', function (text) { showdown.subParser('encodeBackslashEscapes', function (text) {
'use strict'; 'use strict';
text = text.replace(/\\(\\)/g, showdown.helper.escapeCharactersCallback); text = text.replace(/\\(\\)/g, showdown.helper.escapeCharactersCallback);
text = text.replace(/\\([`*_{}\[\]()>#+-.!])/g, showdown.helper.escapeCharactersCallback); text = text.replace(/\\([`*_{}\[\]()>#+-.!~])/g, showdown.helper.escapeCharactersCallback);
return text; return text;
}); });

View File

@ -0,0 +1 @@
<p>~~test~~</p>

View File

@ -0,0 +1 @@
\~~test~~

View File

@ -57,6 +57,8 @@ describe('makeHtml() features testsuite', function () {
converter = new showdown.Converter({encodeEmails: false}); converter = new showdown.Converter({encodeEmails: false});
} else if (testsuite[i].name === '#330.simplifiedAutoLink-drops-character-before-and-after-linked-mail') { } else if (testsuite[i].name === '#330.simplifiedAutoLink-drops-character-before-and-after-linked-mail') {
converter = new showdown.Converter({encodeEmails: false, simplifiedAutoLink: true}); converter = new showdown.Converter({encodeEmails: false, simplifiedAutoLink: true});
} else if (testsuite[i].name === '#331.allow-escaping-of-tilde') {
converter = new showdown.Converter({strikethrough: true});
} else { } else {
converter = new showdown.Converter(); converter = new showdown.Converter();
} }