cmark

My personal build of CMark ✏️

Commit
42d75e3a6e66b334ca701a866c0517dcec8b0118
Parent
2a477bb14758a2849c1e8aa14bafba6bb749bf35
Author
John MacFarlane <jgm@berkeley.edu>
Date

Improved js regex for html comments.

Closes #263. Note, this only affects inline comments. With block comments we parse differently, and don't guarantee that only valid HTML5 comments will pass. This all needs to be made more explicit in the spec.

However, this fix addresses the cpu problem.

Diffstat

1 file changed, 1 insertion, 1 deletion

Status File Name N° Changes Insertions Deletions
Modified js/lib/inlines.js 2 1 1
diff --git a/js/lib/inlines.js b/js/lib/inlines.js
@@ -33,7 +33,7 @@ var ATTRIBUTEVALUESPEC = "(?:" + "\\s*=" + "\\s*" + ATTRIBUTEVALUE + ")";
 var ATTRIBUTE = "(?:" + "\\s+" + ATTRIBUTENAME + ATTRIBUTEVALUESPEC + "?)";
 var OPENTAG = "<" + TAGNAME + ATTRIBUTE + "*" + "\\s*/?>";
 var CLOSETAG = "</" + TAGNAME + "\\s*[>]";
-var HTMLCOMMENT = "<!--([^-]+|[-][^-]+)*-->";
+var HTMLCOMMENT = "<!---->|<!--(?:-?[^>-])(?:-?[^-])*-->";
 var PROCESSINGINSTRUCTION = "[<][?].*?[?][>]";
 var DECLARATION = "<![A-Z]+" + "\\s+[^>]*>";
 var CDATA = "<!\\[CDATA\\[([^\\]]+|\\][^\\]]|\\]\\][^>])*\\]\\]>";