I am writing a large Markdown document and would like to place a table of contents of sorts at the beginning that will provide links to various locations in the document. Ho
This question seems to have a different answer according to the markdown implementation.
In fact, the official Markdown documentation is silent on this topic.
In such cases, and if you want a portable solution, you could use HTML.
Before any header, or in the same header line, define an ID using some HTML tag.
For example:
You will see this in your code but not in the rendered document.
See a full example (online and editable) here.
## Content
* [Chapter 1](#Chapter1)
* [Chapter 2](#Chapter2)
## Chapter 1
Some text here.
Some text here.
Some text here.
## Chapter 2
Some text here.
Some text here.
Some text here.
To test this example, you must add some extra space between the content list and the first chapter or reduce the window height.
Also, do not use spaces in the name of the ids.