diff --git a/dist/showdown.js b/dist/showdown.js index 3aef215..65ccaa7 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 51e41c7..a8fa071 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 f2a9f82..eff22c7 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 c026935..071b772 100644 Binary files a/dist/showdown.min.js.map and b/dist/showdown.min.js.map differ diff --git a/src/subParsers/escapeSpecialCharsWithinTagAttributes.js b/src/subParsers/escapeSpecialCharsWithinTagAttributes.js index 27fc3ce..477f64c 100644 --- a/src/subParsers/escapeSpecialCharsWithinTagAttributes.js +++ b/src/subParsers/escapeSpecialCharsWithinTagAttributes.js @@ -6,9 +6,10 @@ showdown.subParser('escapeSpecialCharsWithinTagAttributes', function (text, opti 'use strict'; text = globals.converter._dispatch('escapeSpecialCharsWithinTagAttributes.before', text, options, globals); - // Build a regex to find HTML tags and comments. See Friedl's - // "Mastering Regular Expressions", 2nd Ed., pp. 200-201. - var regex = /(<[a-z\/!$]("[^"]*"|'[^']*'|[^'">])*>|)/gi; + // Build a regex to find HTML tags. + var regex = /(<[a-z\/!$]("[^"]*"|'[^']*'|[^'">])*>)/gi, + // due to catastrophic backtrace we split the old regex into two, one for tags and one for comments + regexComments = /-]|-[^>])(?:[^-]|-[^-])*)--)>/gi; text = text.replace(regex, function (wholeMatch) { return wholeMatch @@ -16,6 +17,11 @@ showdown.subParser('escapeSpecialCharsWithinTagAttributes', function (text, opti .replace(/([\\`*_~=|])/g, showdown.helper.escapeCharactersCallback); }); + text = text.replace(regexComments, function (wholeMatch) { + return wholeMatch + .replace(/([\\`*_~=|])/g, showdown.helper.escapeCharactersCallback); + }); + text = globals.converter._dispatch('escapeSpecialCharsWithinTagAttributes.after', text, options, globals); return text; }); diff --git a/test/cases/html-comments.html b/test/cases/html-comments.html index 37fa245..767353e 100644 --- a/test/cases/html-comments.html +++ b/test/cases/html-comments.html @@ -6,3 +6,5 @@
<!-- comment -->
 
+

<!----------------------------------------------------------------------------------------------------------------------------------------------------

+ diff --git a/test/cases/html-comments.md b/test/cases/html-comments.md index 08c7e1d..a9fcf5f 100644 --- a/test/cases/html-comments.md +++ b/test/cases/html-comments.md @@ -9,3 +9,7 @@ words words + +