Browse Source

fix(strikethrough): fix striketrough being wrongly parsed inside codeSpans

Estevao Soares dos Santos 8 years ago
parent
commit
169cbe8e2d

+ 1 - 1
dist/showdown.js

@@ -1678,7 +1678,7 @@ showdown.subParser('encodeCode', function (text, options, globals) {
     .replace(/</g, '&lt;')
     .replace(/>/g, '&gt;')
   // Now, escape characters that are magic in Markdown:
-    .replace(/([*_{}\[\]\\=-])/g, showdown.helper.escapeCharactersCallback);
+    .replace(/([*_{}\[\]\\=~-])/g, showdown.helper.escapeCharactersCallback);
 
   text = globals.converter._dispatch('encodeCode.after', text, options, globals);
   return text;

File diff suppressed because it is too large
+ 0 - 0
dist/showdown.js.map


File diff suppressed because it is too large
+ 0 - 0
dist/showdown.min.js


File diff suppressed because it is too large
+ 0 - 0
dist/showdown.min.js.map


+ 1 - 1
src/subParsers/encodeCode.js

@@ -16,7 +16,7 @@ showdown.subParser('encodeCode', function (text, options, globals) {
     .replace(/</g, '&lt;')
     .replace(/>/g, '&gt;')
   // Now, escape characters that are magic in Markdown:
-    .replace(/([*_{}\[\]\\=-])/g, showdown.helper.escapeCharactersCallback);
+    .replace(/([*_{}\[\]\\=~-])/g, showdown.helper.escapeCharactersCallback);
 
   text = globals.converter._dispatch('encodeCode.after', text, options, globals);
   return text;

+ 3 - 0
test/features/#164.3.strikethrough.html

@@ -1,3 +1,6 @@
 <p>a <del>strikethrough</del> word</p>
 <p>this should~~not be parsed</p>
 <p><del>strike-through text</del></p>
+<p><code>~~strikethough inside code span~~</code></p>
+<p>escaped ~~strikethrough~~</p>
+<p>escaped ~~strikethrough~~</p>

+ 6 - 0
test/features/#164.3.strikethrough.md

@@ -3,3 +3,9 @@ a ~~strikethrough~~ word
 this should~~not be parsed
 
 ~~strike-through text~~
+
+`~~strikethough inside code span~~`
+
+escaped \~~strikethrough~~
+
+escaped \~~strikethrough\~~

Some files were not shown because too many files changed in this diff