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

Ignore comments that don't start with TOC #50

Open
movermeyer opened this Issue Jun 4, 2018 · 1 comment

Comments

Projects
None yet
1 participant
@movermeyer

movermeyer commented Jun 4, 2018

I wanted to add an attribution to my TOC, so people knew that I used Markdown TOC to generate it.

<!-- Generated with "Markdown TOC" extension for Visual Studio Code -->
<!-- TOC -->
- [Version 2.0.1](#version-201)
- [Version 2.0.0](#version-200)
    - [Breaking changes](#breaking-changes)

<!-- /TOC -->

But this didn't work, since Markdown TOC looks for any comment that has TOC anywhere in the comment. It stripped the comment entirely.

Surpisingly, it doesn't even have to be upper case, nor a separate word:

<!-- This is the README for the stockfish project -->
<!-- TOC -->
- [Version 2.0.1](#version-201)
- [Version 2.0.0](#version-200)
    - [Breaking changes](#breaking-changes)
<!-- /TOC -->

It still stripped the comment entirely, despite TOC only appearing in "stockfish"

I would like for Markdown TOC to:

  1. Ignore comments that don't start with TOC
    • Perhaps match the regex <!--\s*TOC
    • Perhaps match case sensitive (unless there is a reason not to)

movermeyer added a commit to movermeyer/markdown-toc that referenced this issue Jun 4, 2018

@movermeyer

This comment has been minimized.

movermeyer commented Jun 4, 2018

As a short-term workaround, you can insert zero-width spaces (U+200B) characters between the TOC characters in your comments.

That way, the current regex doesn't notice the line.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment