fix(comments): Fix html comment parser

When an html comment was followed by a a long line of dashes, it would
freeze the parser as the lookahead in the html comment parser regex was
very slow. The regex was modified and simplified, so no lookahead is
needed anymore.

Closes #276
This commit is contained in:
Estevao Soares dos Santos 2016-07-20 22:01:10 +01:00
parent 9b5a2330f6
commit 238726ca91
5 changed files with 1 additions and 1 deletions

BIN
dist/showdown.js vendored

Binary file not shown.

BIN
dist/showdown.js.map vendored

Binary file not shown.

BIN
dist/showdown.min.js vendored

Binary file not shown.

Binary file not shown.

View File

@ -56,7 +56,7 @@ showdown.subParser('hashHTMLBlocks', function (text, options, globals) {
showdown.subParser('hashElement')(text, options, globals));
// Special case for standalone HTML comments:
text = text.replace(/(<!(--[^\r]*?--\s*)+>[ \t]*(?=\n{2,}))/g,
text = text.replace(/(<!--[\s\S]*?-->)/g,
showdown.subParser('hashElement')(text, options, globals));
// PHP and ASP-style processor instructions (<?...?> and <%...%>)