markdown-it-toc-and-anchor
markdown-it plugin to add a toc and anchor links in headings
Plain-English Explanation: markdown-it-toc-and-anchor
This plugin automatically adds a table of contents and clickable anchor links to markdown documents. When you write a markdown file with headings, the plugin processes it and injects two useful features: a navigable list of all your headings (a "table of contents"), and small anchor symbols next to each heading that readers can click to jump to that section and copy its link.
The way it works is simple. You write your markdown normally with headings like "# Introduction" and "## Getting Started." When the plugin processes your document, it scans all those headings, generates a clickable table of contents (which you can insert anywhere using a special @[toc] tag), and adds a small "#" symbol next to each heading that links back to it. Readers can click those symbols to jump to that section, or right-click to copy the link. The plugin also lets you customize what the anchor symbols look like, which heading levels to include, and where the symbols appear.
This is useful for anyone creating long-form content on the web—bloggers, documentation writers, course creators, or anyone else publishing markdown-based pages. Instead of manually writing out a table of contents or adding anchor links by hand, the plugin handles it all automatically. If you later restructure your document by moving sections around or adding new headings, the table of contents and links update themselves.
The plugin is highly configurable. You can choose whether to include a table of contents at all, which heading levels to include (maybe you want to skip the ` and start from `), what class names to use for styling, and what symbol to use as the anchor link. It's built as an extension for markdown-it, a popular JavaScript markdown parser, so it fits into the existing tooling many developers already use.