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.
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.
Footnotes
- 1 markdown - How to link to a named anchor in Multimarkdown? | Stack Overflow
- 2 Since this is not part of the standard, the specifics for the link can vary, however the most common practice I’ve seen is kebab case.
Top comments (4)
How did you get the footnotes to have a raised number like that?
Thanks a lot! Works for me :-)
Thanks Stephen! This really helped me. (A bit after the event, I know ... )
Helped me a lot!