aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/Text/Pandoc/Readers/HTML.hs5
-rw-r--r--test/command/4019.md8
2 files changed, 11 insertions, 2 deletions
diff --git a/src/Text/Pandoc/Readers/HTML.hs b/src/Text/Pandoc/Readers/HTML.hs
index 8d37deb26..915fa852f 100644
--- a/src/Text/Pandoc/Readers/HTML.hs
+++ b/src/Text/Pandoc/Readers/HTML.hs
@@ -1172,8 +1172,9 @@ htmlTag f = try $ do
case next of
TagComment s
| "<!--" `isPrefixOf` inp -> do
- char '<'
- manyTill anyChar endAngle
+ string "<!--"
+ count (length s) anyChar
+ string "-->"
stripComments <- getOption readerStripComments
if stripComments
then return (next, "")
diff --git a/test/command/4019.md b/test/command/4019.md
new file mode 100644
index 000000000..ab13f0233
--- /dev/null
+++ b/test/command/4019.md
@@ -0,0 +1,8 @@
+```
+pandoc --wrap=preserve
+This <!-- x > 0 --> works!
+This <!-- x > 0 --> fails?
+^D
+<p>This <!-- x > 0 --> works!
+This <!-- x > 0 --> fails?</p>
+```