Vscode-markdown: False positive TOC detection

Created on 17 Oct 2018  ·  10Comments  ·  Source: yzhang-gh/vscode-markdown

What is the problem?

When editing a page with a top-level title of #Foo, adding a link to a bulleted list later in the
document of Foo will cause that list to become a table of contents.

image

How can I disable this?

How can I reproduce it?

See above.

Is there any error message in the console?

No

Bug

Most helpful comment

Same problem here.
is it possible to have an option to just turn off TOC detection ?
I've my own extension to generate TOC (because I customize it a little).

All 10 comments

This should be robustly fixed with the dev build.

List not in the form of [...](#...) will never be recognized as TOC starting from this build.

Thank you very much!

Is there a configuration to depth limit of TOC?
I don't mind the auto-update, as long as it stops at depth=3 (###).

You can control it with settings. (Workspace level is also supported)

@yzhang-gh What if I need a list of internal links?

For example, I'm creating a document that has a section on goals, and a section on projects.

Each subsection in goals has a list of projects which relate to that goal. If I add more than three (four?) projects to the list it turns into a TOC. How can I prevent this? (I do want a TOC in the document, and have placed it at the beginning)

Can you provide a minimal example (code snippet)?

How do you turn this off? What is the setting name?

Please see here for more information about settings.

Same problem here.
is it possible to have an option to just turn off TOC detection ?
I've my own extension to generate TOC (because I customize it a little).

Currently, we don't have such an option. I have opened a new issue for it.

If you have a little time and don't mind making a PR, here is the code pointer

https://github.com/yzhang-gh/vscode-markdown/blob/d73116562d5163452d3bf05f5c51dc5d620a4c54/src/toc.ts#L13

We have a similar option (as shown below), just copy it

https://github.com/yzhang-gh/vscode-markdown/blob/d73116562d5163452d3bf05f5c51dc5d620a4c54/src/syntaxDecorations.ts#L61-L68

Was this page helpful?
0 / 5 - 0 ratings