markdown-toc icon indicating copy to clipboard operation
markdown-toc copied to clipboard

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

Open arnauldvm opened this issue 7 years ago • 3 comments

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.

arnauldvm avatar Feb 27 '18 15:02 arnauldvm

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

image

alanwalk avatar Apr 09 '18 09:04 alanwalk

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 avatar Jul 24 '18 15:07 arnauldvm

Fixing this might also be a solution for #38

arnauldvm avatar Jan 14 '19 08:01 arnauldvm