An Obsidian plugin that generates a table of contents from your note's headings — no visible HTML markers, tracked through a small YAML frontmatter key instead.
- **No visible markers**: unlike plugins that insert HTML comments (`<!-- TOC -->`) into your source view, the TOC section is identified by its heading and tracked via frontmatter
- **Safe updates**: the TOC section is only ever matched by its heading title (your configured title or common ones like "Contents"), so regenerating never touches other sections of your note
- **Idempotent**: regenerating an unchanged note produces byte-identical content — safe to combine with sync and auto-formatting plugins
- **Wikilink navigation**: entries are `[[#Heading|Heading]]` links that work in preview and live preview
<ahref="https://www.buymeacoffee.com/mattkk"target="_blank"><imgsrc="https://cdn.buymeacoffee.com/buttons/v2/default-yellow.png"alt="Buy Me A Coffee"style="height: 60px !important;width: 217px !important;"></a>
Duplicate heading names are listed, but only the first occurrence is linked — Obsidian wikilinks cannot address later occurrences of the same heading text.
The plugin marks TOC-managed notes with a minimal frontmatter key, written via Obsidian's `processFrontMatter` API (your other frontmatter is never rewritten by hand):
The TOC section itself is located by matching an H2 against your configured title or the common aliases "Table of Contents", "TOC", "Contents", "Index", and "Outline" — headings inside code fences are ignored. Requires Obsidian 1.7.2+.
### Development
```bash
npm install
npm run dev # watch build
npm test # vitest unit tests
npm run build # typecheck + production build
```
Core logic lives in `src/` as pure, unit-tested functions (`toc-section.ts`, `toc-generator.ts`, `heading-filter.ts`); `main.ts` contains only Obsidian wiring.
If you find this plugin useful, consider a donation! Thank you!
<ahref="https://www.buymeacoffee.com/mattkk"target="_blank"><imgsrc="https://cdn.buymeacoffee.com/buttons/v2/default-yellow.png"alt="Buy Me A Coffee"style="height: 60px !important;width: 217px !important;"></a>