Skip to content

feat: add collapsible sections plugin#913

Open
hung6895 wants to merge 1 commit intomdx-editor:mainfrom
hung6895:feat/collapsible-sections
Open

feat: add collapsible sections plugin#913
hung6895 wants to merge 1 commit intomdx-editor:mainfrom
hung6895:feat/collapsible-sections

Conversation

@hung6895
Copy link
Copy Markdown

Summary

  • Adds a collapsibleSectionsPlugin that enables collapsing/expanding document sections by heading level
  • Click the left 24px of any heading to toggle collapse — content under that heading (until the next heading of same or higher level) is hidden
  • Exposes toggleAllSections$ and toggleHeadingCollapse$ signals for programmatic control
  • Includes a Ladle story (CollapsibleSections) with Collapse All / Expand All controls for testing

Test plan

  • Run npm run typecheck — passes
  • Run npm run lint — passes
  • Run npm run test:once — existing tests pass
  • Open Ladle story and verify:
    • Chevron indicators appear on heading hover
    • Clicking left 24px of a heading collapses/expands its section
    • Clicking the right side of a heading still allows text editing
    • Collapsing an H1 hides all nested H2/H3 content
    • Expanding an H1 preserves nested heading collapse state
    • "Collapse All" / "Expand All" buttons work
    • Markdown output is unchanged after collapse/expand (transient UI-only state)
    • Adding/removing headings updates collapse UI correctly

🤖 Generated with Claude Code

Add support for collapsing/expanding document sections by heading level.
Click the left side of any heading to toggle collapse. All content under
the heading (until the next heading of same or higher level) is hidden.
Includes Collapse All / Expand All signals for programmatic control.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant