Add collapse and expand controls to markdown table of contents panel#4875
Conversation
- Introduces per-heading disclosure toggles for nesting control - Adds H1/H2/H3 level collapse buttons to quickly reduce heading depth - Removes stale collapsed IDs when the TOC changes
|
|
Caution Review failedPull request was closed or merged during review WalkthroughThis pull request adds collapsible/expandable functionality to the Markdown table of contents. A new 🚥 Pre-merge checks | ✅ 2✅ Passed checks (2 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |

Adds level-based collapse buttons (H1, H2, H3) and per-section disclosure chevrons to the TOC panel.
markdown-toc-collapse-state.ts— pure functions for managing collapsed ID sets: toggle, prune stale IDs on items change, collapse to a given heading level.MarkdownTableOfContentsPanel.tsx— header row now has an H1/H2/H3 button group. Each parent node gets aChevronRightbutton that toggles its children. Indentation adjusted for the chevron column.Testing:
pnpm vitest runpasses for the new test files.