Skip to content

Commit

Permalink
fix(strikethrough): fix striketrough being wrongly parsed inside code…
Browse files Browse the repository at this point in the history
…Spans
  • Loading branch information
tivie committed Jan 29, 2017
1 parent 4243a31 commit 169cbe8
Show file tree
Hide file tree
Showing 7 changed files with 14 additions and 5 deletions.
2 changes: 1 addition & 1 deletion dist/showdown.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion dist/showdown.js.map

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion dist/showdown.min.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion dist/showdown.min.js.map

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion src/subParsers/encodeCode.js
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
3 changes: 3 additions & 0 deletions test/features/#164.3.strikethrough.html
Original file line number Diff line number Diff line change
@@ -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 changes: 6 additions & 0 deletions test/features/#164.3.strikethrough.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,3 +3,9 @@ a ~~strikethrough~~ word
this should~~not be parsed

~~strike-through text~~

`~~strikethough inside code span~~`

escaped \~~strikethrough~~

escaped \~~strikethrough\~~

0 comments on commit 169cbe8

Please sign in to comment.