GitHub's anchors
Lower case, punctuation removed, spaces to hyphens, and repeats numbered -1, -2, as github-slugger does.
Build a linked table of contents from a Markdown file's headings, with anchors made the way GitHub makes them, nested by level and skipping code blocks.
Paste the Markdown or open the file
Choose the deepest heading level to list
Copy the list into your document
A long README or set of notes is easier to use with a list of its sections at the top. This reads the headings in your Markdown and writes that list, each entry a link to its heading, indented by level.
Headings are found the way the CommonMark specification defines them. A line starting with one to six # characters and a space is a heading of that level, and a closing run of # is dropped. A line of text underlined with equals signs is a level 1 heading, and one underlined with hyphens a level 2 heading. Lines inside fenced code blocks, between ``` or ~~~ fences, and lines indented four spaces are code and are skipped. A # with no space after it, as in #hashtag, is text.
The text shown in the list is the heading as it reads once rendered: links keep their words, code keeps its contents, and emphasis markers are removed.
When GitHub renders Markdown, each heading gets an id the link can point to. The rule comes from the github-slugger package: lower-case the text, delete punctuation and symbols (keeping letters in any script, figures, hyphens, underscores and spaces), and replace each space with a hyphen. Headings that come out the same get -1, -2 and so on, in order. Other sites that render Markdown may make anchors differently, so check a link or two there.
Choose the deepest level to include; level 3 is a common choice for a README. Entries nest two spaces per level, starting from the shallowest heading kept, and a skipped level nests one step rather than two, so the list stays valid Markdown. Tick “Number the entries” for an ordered list.
To turn the document into a web page, use Markdown to HTML.
Nothing is uploaded. The document is read in this tab.
Lower case, punctuation removed, spaces to hyphens, and repeats numbered -1, -2, as github-slugger does.
ATX and underlined headings as CommonMark defines them, skipping code blocks and indented code.
The document is read in your browser and never sent anywhere.
Nothing uploaded: open the Network panel while it runs and check.
No daily limits or watermarks: free batches take up to 20 images.
Works offline: once the page has loaded, on any current browser.
It lower-cases the heading's text, removes punctuation and symbols except hyphens, and turns each space into a hyphen. "What's new in v2.0?" becomes whats-new-in-v20. A second heading with the same text gets -1 on the end, a third -2.
No. A line starting with
A README usually opens with one
No. It writes the list only, for you to paste where you want it, usually under the title. Run it again after editing headings, since the anchors follow the heading text.