A table of contents is a list of the headings you already wrote, indented by level, each pointing at a GitHub-style anchor. “# Odd socks!” becomes “- [Odd socks!](#odd-socks)”. The exclamation mark stays in the label and is stripped from the anchor. “## In the dryer” is indented two spaces. A second “### In the dryer” becomes “#in-the-dryer-1”, because the first anchor of that text was already used.
“Odd socks in the dryer.” is not a heading. It is a paragraph, and the list is empty. That empty result means there was nothing to link, not that the page failed. Setext headings and ATX headings both count. The words inside the heading are the label, with emphasis markers removed from the visible text.
The anchors are guessed the way GitHub guesses them: trim, lowercase, drop characters that are not letters, marks, numbers, spaces, underscores, or hyphens, then turn spaces into hyphens. They are not checked against a live repository. If your host’s slugger differs, the link can miss. This page does not rewrite the document. It only prints the list you can paste under the title.
# Odd socks! ## In the dryer ### In the dryer
- [Odd socks!](#odd-socks) - [In the dryer](#in-the-dryer) - [In the dryer](#in-the-dryer-1) The plain sentence with no hashes produces an empty list.
Oddsock runs this in your browser. It is free, it does not upload the work, and it does not ask for an account.
“Odd socks in the dryer.” has no heading token. Only headings become entries. Add a # if that line should appear.
The heading is lowercased, punctuation other than letters, numbers, spaces, underscores, and hyphens is removed, and spaces become hyphens. “Odd socks!” is #odd-socks.
The second anchor gets -1, then -2, in the order the headings appear. “In the dryer” twice is #in-the-dryer and #in-the-dryer-1.
No. It prints a list. You paste that list where you want the contents.
It matches the GitHub-style rules above. A renderer with a different slugger can miss. Compare one anchor before you rely on the whole list.