Jelajahi Sumber

fix: allow escaping of colons

Previously, you couldn't escape colons (as they were semi-magic markdown characters).
Colons (:) can now be backslash escaped.
Estevao Soares dos Santos 6 tahun lalu
induk
melakukan
a4be301331

+ 1 - 1
src/subParsers/makehtml/encodeBackslashEscapes.js

@@ -14,7 +14,7 @@ showdown.subParser('makehtml.encodeBackslashEscapes', function (text, options, g
   text = globals.converter._dispatch('makehtml.encodeBackslashEscapes.before', text, options, globals).getText();
 
   text = text.replace(/\\(\\)/g, showdown.helper.escapeCharactersCallback);
-  text = text.replace(/\\([`*_{}\[\]()>#+.!~=|-])/g, showdown.helper.escapeCharactersCallback);
+  text = text.replace(/\\([`*_{}\[\]()>#+.!~=|:-])/g, showdown.helper.escapeCharactersCallback);
 
   text = globals.converter._dispatch('makehtml.encodeBackslashEscapes.after', text, options, globals).getText();
   return text;

+ 2 - 0
test/functional/makehtml/cases/issues/#510.specific-string-gets-removed-from-text.html

@@ -0,0 +1,2 @@
+<p>[^1]:a</p>
+<p>[^1]:a</p>

+ 3 - 0
test/functional/makehtml/cases/issues/#510.specific-string-gets-removed-from-text.md

@@ -0,0 +1,3 @@
+\[^1]:a
+
+[^1]\:a