alanwalk / markdown-toc

MarkdownTOC(Table Of Contents) Plugin for Visual Studio Code.
MIT License
141 stars 111 forks source link

Clarification (or Bug?): what is the role of <a name="..." id="..."></a> #45

Open arnauldvm opened 6 years ago

arnauldvm commented 6 years ago

Documentation says:

Insert anchor for header <a id="markdown-header" name="header"></a>

I'm not quite sure what this is supposed to do.

If I add such a line in my document, it disappears automatically as soon as the TOC is refreshed.

What I would expect it something like this:

<!-- TOC -->

- [Component View](#CV)

<!-- /TOC -->

<a id="markdown-component-view" name="CV"></a>

## Component View

Bla bla...

(or something similar)

I.e. deciding myself of the anchor name, to avoid changing the links when the title slightly change.

It works perfectly when I build my TOC manually, but not with the extension.

alanwalk commented 6 years ago

Hi, you need add a param in <!-- TOC insertAnchor=true -->, tool will auto insert <a id="markdown-component-view" name="CV"> </a>

image

arnauldvm commented 6 years ago

Tried the "insertAnchor:true" parameter, but this is not what I was looking for.

What it does is generate the <a ...> tag for me, based on the heading text.

What I was looking for is the possibility to fix the name of the anchor myself.
(The objective being to keep the internal links consistent if I slightly change a heading text).

Kr.

arnauldvm commented 5 years ago

Fixing this might also be a solution for #38