From 6f94a997e9c0ece4467e47f94f93b89ce5dd3ff8 Mon Sep 17 00:00:00 2001 From: Robin Stocker Date: Wed, 6 Mar 2024 13:55:47 +1100 Subject: [PATCH] Fix HTML comment parsing with `-` before closing `-->` (#286) Fixes #285. --- lib/common.js | 2 +- test/regression.txt | 16 ++++++++++++++++ 2 files changed, 17 insertions(+), 1 deletion(-) diff --git a/lib/common.js b/lib/common.js index 2db7dc81..7f31f265 100644 --- a/lib/common.js +++ b/lib/common.js @@ -24,7 +24,7 @@ var ATTRIBUTEVALUESPEC = "(?:" + "\\s*=" + "\\s*" + ATTRIBUTEVALUE + ")"; var ATTRIBUTE = "(?:" + "\\s+" + ATTRIBUTENAME + ATTRIBUTEVALUESPEC + "?)"; var OPENTAG = "<" + TAGNAME + ATTRIBUTE + "*" + "\\s*/?>"; var CLOSETAG = "]"; -var HTMLCOMMENT = "||" +var HTMLCOMMENT = "||" var PROCESSINGINSTRUCTION = "[<][?][\\s\\S]*?[?][>]"; var DECLARATION = "]*>"; var CDATA = ""; diff --git a/test/regression.txt b/test/regression.txt index bf34ab6c..40630a7b 100644 --- a/test/regression.txt +++ b/test/regression.txt @@ -502,3 +502,19 @@ x

x

x<!>

```````````````````````````````` + +#285 +```````````````````````````````` example +foo + +foo + +foo + +foo more --> +. +

foo

+

foo

+

foo

+

foo more -->

+````````````````````````````````