Skip to content

Commit

Permalink
fix: allow escaping of colons
Browse files Browse the repository at this point in the history
Previously, you couldn't escape colons (as they were semi-magic markdown characters).
Colons (:) can now be backslash escaped.
  • Loading branch information
tivie authored and SyntaxRules committed Feb 1, 2022
1 parent e3ddcaf commit 25c4420
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 1 deletion.
2 changes: 1 addition & 1 deletion src/subParsers/encodeBackslashEscapes.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ showdown.subParser('encodeBackslashEscapes', function (text, options, globals) {
text = globals.converter._dispatch('encodeBackslashEscapes.before', text, options, globals);

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('encodeBackslashEscapes.after', text, options, globals);
return text;
Expand Down
2 changes: 2 additions & 0 deletions test/issues/#510.specific-string-gets-removed-from-text.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
<p>[^1]:a</p>
<p>[^1]:a</p>
3 changes: 3 additions & 0 deletions test/issues/#510.specific-string-gets-removed-from-text.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
\[^1]:a

[^1]\:a

0 comments on commit 25c4420

Please sign in to comment.