Markdown TOC
Generate a table of contents from a Markdown file's headers.
Steps
-
Read the target Markdown file.
-
Run the generator script to produce a TOC block:
python3 scripts/gen_toc.py <path/to/file.md>The script prints a fenced TOC block listing each
#-prefixed header as a GitHub-style anchor link, indented by heading level. -
Optionally insert the TOC into the file (place it after the title or front matter). Keep the original headers unchanged.
Output
A Markdown list like:
- [Introduction](#introduction)
- [Goals](#goals)
- [Usage](#usage)
