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

Generated ToC includes commented headers #178

Open
NathanielPerryAtAwatoXello opened this issue Apr 4, 2022 · 0 comments
Open

Generated ToC includes commented headers #178

NathanielPerryAtAwatoXello opened this issue Apr 4, 2022 · 0 comments

Comments

@NathanielPerryAtAwatoXello

markdown-toc will include headers that are inside of HTML comments (<!-- comment -->), as is allowed in GitHub Flavored Markdown.

Steps to reproduce

sample.md

# Header 1 listed

<!--
# Header 2 unlisted
-->

# Header 3 listed

Then run: npx markdown-toc sample.md

Actual result

- [Header 1 listed](#header-1-listed)
- [Header 2 unlisted](#header-2-unlisted)
- [Header 3 listed](#header-3-listed)

Expected result

- [Header 1 listed](#header-1-listed)
- [Header 3 listed](#header-3-listed)

Workaround

# Header 1 listed

<!--
```
# Header 2 unlisted
```
-->

# Header 3 listed
gregdan3 added a commit to gregdan3/markdown-toc-redux that referenced this issue Sep 17, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant