Skip to content

Commit

Permalink
fix(comments): Fix html comment parser
Browse files Browse the repository at this point in the history
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
  • Loading branch information
tivie committed Jul 20, 2016
1 parent 9b5a233 commit 238726c
Show file tree
Hide file tree
Showing 5 changed files with 7 additions and 7 deletions.
4 changes: 2 additions & 2 deletions 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.

4 changes: 2 additions & 2 deletions 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/hashHTMLBlocks.js
Original file line number Diff line number Diff line change
Expand Up @@ -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 <%...%>)
Expand Down

0 comments on commit 238726c

Please sign in to comment.