Goal
Generate stable anchor IDs on every heading and (optionally) a clickable table of contents at the top of long documents.
Why
GitHub does this automatically on the web. Reading the same file locally without anchors makes deep-linking and skimming harder.
Proposed approach
- For each `h1`–`h6`, generate a slug (lowercase, dashes, deduplicated like GitHub) and inject an `id` plus a hover-revealed `<a class="anchor" href="#slug">` icon — same pattern as github.com.
- Render a TOC at the top of the document.
Open questions
- TOC: always-on, opt-in via a marker like `[TOC]`, or floating sidebar?
- Slug algorithm: GitHub's exact rules (handles unicode, emoji, deduplication) vs the simpler default. Probably worth matching GitHub for consistency.
Constraints
- No CDN dependencies. Slug logic is small enough to write in-tree.
Acceptance criteria
Goal
Generate stable anchor IDs on every heading and (optionally) a clickable table of contents at the top of long documents.
Why
GitHub does this automatically on the web. Reading the same file locally without anchors makes deep-linking and skimming harder.
Proposed approach
Open questions
Constraints
Acceptance criteria