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

Ordinary list whose first item looks like the first heading is detected as TOC #7

Closed
Ytrog opened this issue Jun 22, 2017 · 11 comments
Closed
Labels
Area: Table of contents Pertaining to table of contents (TOC generation and detection, related heading operations). Issue: Bug Res: Fixed Fix is checked in, but it might be a few weeks until a release.

Comments

@Ytrog
Copy link

Ytrog commented Jun 22, 2017

When I have a header with a list beneath it containing links it seems to think it is a TOC (marking it as not up to date) and regenerating a TOC in place on saving. You should be able to save without it creating TOC's.

Example:

## Tasks
- [A task](http://link-to-task)
- [Another task](http://link-to-another-task)

On saving this is replaced by a TOC of the entire document.

Edit
Got it disabled using:
"markdown.extension.toc.updateOnSave": false

However it's still strange it detected a TOC here.

@yzhang-gh
Copy link
Owner

Thank you for the feedback. I'll look into it this weekend.

@yzhang-gh
Copy link
Owner

It seems that I cannot reproduce that with the snippet you provided 🤔.
Could you please provide more details? (e.g. vscode version, the text which was misrecognized as TOC)

image

@Ytrog
Copy link
Author

Ytrog commented Jun 23, 2017

VSCode 1.13.1
image

As I don't want to leak information I obfuscated the actual text (it shouldn't really matter):
image

@yzhang-gh
Copy link
Owner

Okay, I see the bug.
But I have no idea about why. Can you try to reproduce it with some not secret text? 😅


Below is the current behaviors,

To avoid distractive HTML comments, this extension will 'guess' where the TOC is. Currently, a TOC will be recognized if

  • It's a list block in Markdown syntax
  • Its first list item title matches the first heading in the file

@Ytrog
Copy link
Author

Ytrog commented Jun 23, 2017

Ah, the first item matches the title (a level 1 header) so the second rule triggers.

It would be like

# PR-123456 Build a new window

## Issues
- [PR-123456 Build a new window](http://issuetracker/PR-123456)
- [PR-123457 A related issue](http://issuetracker/PR-123457)

Too bad markdown doesn't have comments or it would be possible to make a NoTOC tag that doesn't show in the output.

@yzhang-gh
Copy link
Owner

I'll add an additional rule which is

  • It should be a within-document anchor (something like #header-title) not a link (http://...)

@Ytrog
Copy link
Author

Ytrog commented Jun 23, 2017

I like the idea 👍

@yzhang-gh
Copy link
Owner

I've fixed it. But I cannot publish the new version because of the bad network connection. Let's ship it tomorrow.

@yzhang-gh
Copy link
Owner

Published! If you are satisfied with it, please give me a 5 stars 😉

@Ytrog
Copy link
Author

Ytrog commented Jun 26, 2017

It seems fixed 😄

Amended my review ;)

@yzhang-gh
Copy link
Owner

Thanks 😎

@Lemmingh Lemmingh added Area: Table of contents Pertaining to table of contents (TOC generation and detection, related heading operations). Res: Fixed Fix is checked in, but it might be a few weeks until a release. labels Aug 21, 2021
@Lemmingh Lemmingh changed the title It seems to detect and format a TOC where there is none Ordinary list whose first item looks like the first heading is detected as TOC Aug 21, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Area: Table of contents Pertaining to table of contents (TOC generation and detection, related heading operations). Issue: Bug Res: Fixed Fix is checked in, but it might be a few weeks until a release.
Projects
None yet
Development

No branches or pull requests

3 participants