From 24d47d7c6814aa862ff6ab73fec1aaba55a9c587 Mon Sep 17 00:00:00 2001 From: Estevao Soares dos Santos Date: Sat, 28 Jan 2017 23:54:28 +0000 Subject: [PATCH] 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 --- dist/showdown.js | Bin 78005 -> 78006 bytes dist/showdown.js.map | Bin 228524 -> 228525 bytes dist/showdown.min.js | Bin 32170 -> 32171 bytes dist/showdown.min.js.map | Bin 34829 -> 34829 bytes src/subParsers/encodeBackslashEscapes.js | 2 +- .../#331.allow-escaping-of-tilde.html | 1 + test/features/#331.allow-escaping-of-tilde.md | 1 + test/node/testsuite.features.js | 2 ++ 8 files changed, 5 insertions(+), 1 deletion(-) create mode 100644 test/features/#331.allow-escaping-of-tilde.html create mode 100644 test/features/#331.allow-escaping-of-tilde.md diff --git a/dist/showdown.js b/dist/showdown.js index bfbd1441cc45d475e9c80e86d515939ff93bfd01..ef48514910b40182c1aeb92db2eed843b9dfc885 100644 GIT binary patch delta 16 Ycmdn`kY(FLmJNX$80$6%Zb)eW07nc5{r~^~ delta 27 jcmdn?kY(#bmJNX$SYkEx(jg;LbYvK`!g&*B<*#0QKVzc>n+a delta 26 icmZ4en{m}|#tkbyCO3F#PVV>QpIqS1y7{@s5fcEc{|p!a diff --git a/dist/showdown.min.js.map b/dist/showdown.min.js.map index c92d706197516963a69e53cc6a3bb65db90a8f29..278be22f1b82ac3af572c26f0d96ce03cc2ffa3d 100644 GIT binary patch delta 45 zcmeC3z|=c|X+v+&#+-.!])/g, showdown.helper.escapeCharactersCallback); + text = text.replace(/\\([`*_{}\[\]()>#+-.!~])/g, showdown.helper.escapeCharactersCallback); return text; }); diff --git a/test/features/#331.allow-escaping-of-tilde.html b/test/features/#331.allow-escaping-of-tilde.html new file mode 100644 index 0000000..3fa7c62 --- /dev/null +++ b/test/features/#331.allow-escaping-of-tilde.html @@ -0,0 +1 @@ +

~~test~~

\ No newline at end of file diff --git a/test/features/#331.allow-escaping-of-tilde.md b/test/features/#331.allow-escaping-of-tilde.md new file mode 100644 index 0000000..95c5b05 --- /dev/null +++ b/test/features/#331.allow-escaping-of-tilde.md @@ -0,0 +1 @@ +\~~test~~ \ No newline at end of file diff --git a/test/node/testsuite.features.js b/test/node/testsuite.features.js index 505cafc..a8a81ed 100644 --- a/test/node/testsuite.features.js +++ b/test/node/testsuite.features.js @@ -57,6 +57,8 @@ describe('makeHtml() features testsuite', function () { converter = new showdown.Converter({encodeEmails: false}); } else if (testsuite[i].name === '#330.simplifiedAutoLink-drops-character-before-and-after-linked-mail') { 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 { converter = new showdown.Converter(); }