@bhdouglass/satteri-toc
v0.0.1
Published
Replace a "Table of Contents" heading with an auto-generated list of links to all subsequent headings in the document. Similar to [remark-toc](https://github.com/remarkjs/remark-toc).
Readme
@bhdouglass/satteri-toc
Replace a "Table of Contents" heading with an auto-generated list of links to all subsequent headings in the document. Similar to remark-toc.
Installation
npm install @bhdouglass/satteri-tocsatteri is a peer dependency.
Usage
import { satteri } from "@astrojs/markdown-satteri";
import satteriToc from "@bhdouglass/satteri-toc";
satteri({
mdastPlugins: [satteriToc()],
});In your markdown or MDX, add a heading with the text "Table of Contents":
## Table of ContentsThe plugin replaces that heading with an unordered list of links pointing to each heading that follows it. Slug generation uses github-slugger, matching the IDs satteri assigns to headings.
API
satteriToc()
Returns a Sätteri mdast plugin. Takes no options.
Example
See this plugin in action in my Astro blog.
