Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

HTML comments with odd number of - characters breaks parser #18

Closed
4 tasks done
EvHaus opened this issue Oct 18, 2021 · 3 comments
Closed
4 tasks done

HTML comments with odd number of - characters breaks parser #18

EvHaus opened this issue Oct 18, 2021 · 3 comments
Labels
💪 phase/solved Post is done

Comments

@EvHaus
Copy link

EvHaus commented Oct 18, 2021

Initial checklist

Affected packages and versions

6.1.0

Link to runnable example

https://codesandbox.io/s/remark-rehype-debug-forked-8tk7h?file=/src/index.js

Steps to reproduce

I'm not sure if this is a bug with remark-rehype or rehype-raw. Please forgive me if I got it wrong.

The issue is that HTML comments with an odd number of - characters is not parsed properly. If you feed the following code through remark-rehype and rehype-raw:

<!-- An HTML comment with 2 dashes -->
# This heading works (2 dashes)

You will get a proper parsed heading. However, if you use 3 dashes, like this:

<!--- An HTML comment with 3 dashes --->
# This heading is broken (3 dashes)

Then you get no parsed content at all.

The pattern repeats. 4 dashes works, 5 doesn't, 6 works, 7 doesn't, etc...

Expected behavior

Any number of dashes in the <!---- ---> comment tag should be supported.

Actual behavior

Only even numbers of dashes are parsed properly.

Runtime

Node v16

Package manager

yarn v1

OS

macOS

Build and bundle tools

Webpack

@github-actions github-actions bot added 👋 phase/new Post is being triaged automatically 🤞 phase/open Post is being triaged manually and removed 👋 phase/new Post is being triaged automatically labels Oct 18, 2021
@github-actions

This comment has been minimized.

@wooorm wooorm added the 💪 phase/solved Post is done label Oct 18, 2021
@github-actions github-actions bot removed the 🤞 phase/open Post is being triaged manually label Oct 18, 2021
@wooorm
Copy link
Member

wooorm commented Oct 18, 2021

Hey! The problem and the fix were in the underlying markdown parser, micromark. Thanks for raising the problem!

@EvHaus
Copy link
Author

EvHaus commented Oct 22, 2021

Confirmed this is fixed for me now after upgrading my deps.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
💪 phase/solved Post is done
Development

No branches or pull requests

2 participants