diff --git a/dist/showdown.js b/dist/showdown.js index 94349cb..dcdf75c 100644 Binary files a/dist/showdown.js and b/dist/showdown.js differ diff --git a/dist/showdown.js.map b/dist/showdown.js.map index fe9eac1..a915d0b 100644 Binary files a/dist/showdown.js.map and b/dist/showdown.js.map differ diff --git a/dist/showdown.min.js b/dist/showdown.min.js index 4e1842b..e4073af 100644 Binary files a/dist/showdown.min.js and b/dist/showdown.min.js differ diff --git a/dist/showdown.min.js.map b/dist/showdown.min.js.map index 946a88b..6c89361 100644 Binary files a/dist/showdown.min.js.map and b/dist/showdown.min.js.map differ diff --git a/src/subParsers/encodeBackslashEscapes.js b/src/subParsers/encodeBackslashEscapes.js index 674e69c..7909ed9 100644 --- a/src/subParsers/encodeBackslashEscapes.js +++ b/src/subParsers/encodeBackslashEscapes.js @@ -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; diff --git a/src/subParsers/escapeSpecialCharsWithinTagAttributes.js b/src/subParsers/escapeSpecialCharsWithinTagAttributes.js index 4a0e929..27fc3ce 100644 --- a/src/subParsers/escapeSpecialCharsWithinTagAttributes.js +++ b/src/subParsers/escapeSpecialCharsWithinTagAttributes.js @@ -13,7 +13,7 @@ showdown.subParser('escapeSpecialCharsWithinTagAttributes', function (text, opti text = text.replace(regex, function (wholeMatch) { return wholeMatch .replace(/(.)<\/?code>(?=.)/g, '$1`') - .replace(/([\\`*_~=])/g, showdown.helper.escapeCharactersCallback); + .replace(/([\\`*_~=|])/g, showdown.helper.escapeCharactersCallback); }); text = globals.converter._dispatch('escapeSpecialCharsWithinTagAttributes.after', text, options, globals); diff --git a/src/subParsers/tables.js b/src/subParsers/tables.js index 79498eb..dcd74c9 100644 --- a/src/subParsers/tables.js +++ b/src/subParsers/tables.js @@ -57,6 +57,10 @@ showdown.subParser('tables', function (text, options, globals) { text = globals.converter._dispatch('tables.before', text, options, globals); + // find escaped pipe characters + text = text.replace(/\\(\|)/g, showdown.helper.escapeCharactersCallback); + + // parse tables text = text.replace(tableRgx, function (rawTable) { var i, tableLines = rawTable.split('\n'); diff --git a/test/features/tables/#345.escape-pipe-character.html b/test/features/tables/#345.escape-pipe-character.html new file mode 100644 index 0000000..059ef88 --- /dev/null +++ b/test/features/tables/#345.escape-pipe-character.html @@ -0,0 +1,30 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
OperatorDescription
&Logical AND
&&Shortcut AND
|Logical OR
||Shortcut OR
^Logical XOR
diff --git a/test/features/tables/#345.escape-pipe-character.md b/test/features/tables/#345.escape-pipe-character.md new file mode 100644 index 0000000..690b649 --- /dev/null +++ b/test/features/tables/#345.escape-pipe-character.md @@ -0,0 +1,7 @@ +| Operator | Description | +|----------|-------------| +| & | Logical AND | +| && | Shortcut AND | +| \| | Logical OR | +| \|\| | Shortcut OR | +| ^ | Logical XOR | diff --git a/test/issues/#345.no-escape-for-the-pipe-character.html b/test/issues/#345.no-escape-for-the-pipe-character.html new file mode 100644 index 0000000..9c79cde --- /dev/null +++ b/test/issues/#345.no-escape-for-the-pipe-character.html @@ -0,0 +1 @@ +

this |

diff --git a/test/issues/#345.no-escape-for-the-pipe-character.md b/test/issues/#345.no-escape-for-the-pipe-character.md new file mode 100644 index 0000000..26055b3 --- /dev/null +++ b/test/issues/#345.no-escape-for-the-pipe-character.md @@ -0,0 +1 @@ +this \|