DEV Community

Stephen Charles Weiss
Stephen Charles Weiss

Posted on • Originally published at stephencharlesweiss.com on

Named Anchors & Markdown

When writing longer files in Markdown, I find it useful to create links within the document to help readers navigate.

This cross referencing makes jumping around the document even simpler.1 (Note: this 1 is an example of the link I'm talking about!)

For example:

### <a id="my-header"></a> Header

…
And then later, I want to go to [Header](#my-header), you create a link, just like any other.
Enter fullscreen mode Exit fullscreen mode

The reason we have to add the anchor tag to the Header is that the Markdown spec doesn’t automatically do it.

Fortunately, many Markdown resolvers do. Dev.to, Gitlab, VSCode, Remark, etc. all do!

If you’re using one of these to convert the Markdown to HTML, things are even simpler2 :

### My Stupendous Header

…
And then later, I want to go to the [header](#my-stupendous-header), you create a link, just like any other.
Enter fullscreen mode Exit fullscreen mode

Footnotes

Latest comments (4)

Collapse
 
thiagokj profile image
Thiago Cajaíba

Helped me a lot!

Collapse
 
caffiendkitten profile image
DaNeil C

How did you get the footnotes to have a raised number like that?

Collapse
 
luisjosesanchez profile image
Luis José Sánchez

Thanks a lot! Works for me :-)

Collapse
 
murrayvarey profile image
MurrayVarey

Thanks Stephen! This really helped me. (A bit after the event, I know ... )