Table of Contents
Starlight
Starlight already has this feature, so no additional work is required. However, you can override the default one β.
βSnakeβ Table of Contents
See:
Implementation
Check out the source code to see how to implement it:
- src/components/TOC.astro β
- src/components/TOCHelper.ts β
- src/components/TOCHeading.astro β
- src/toc.js β
TODO:
- Fix bug: it crashes if there are missing header levels, like
h4
directly underh2
. - Fix βsnakeβ styles.
Starlight-Specific Config
-
Create
TableOfContents
component -
Configure Astro