Skip to content

feat: add document outline sidebar - #162

Merged
lezli01 merged 1 commit into
masterfrom
feat/table-of-contents
Oct 25, 2026
Merged

lezli01 merged 1 commit into
masterfrom
feat/table-of-contents

Conversation

@lezli01

@lezli01 lezli01 commented Oct 25, 2026

Copy link
Copy Markdown
Owner

Summary

Adds a table of contents for Markdown files, so headings can be browsed and jumped to.

  • Outline sidebar view: a third sidebar view alongside Recents and Search files. Open it from a new toolbar button or Ctrl/⌘+Shift+O. The same button or shortcut, or ✕, returns to Recents.
  • Heading list: headings are indented relative to the document's shallowest level, with top-level ones in bold, and the list updates live as you type.
  • Accurate headings: markdownHeadings() in src/lib/markdown.ts uses the preview's own markdown-it parse, so it lists exactly what the preview renders. A # inside a code block is skipped, setext headings are included, and inline formatting is reduced to plain text.
  • Jumping: clicking a heading calls revealLine(line, "start"), which puts the caret on the heading with the heading at the top of the editor. The preview follows via the existing scroll sync in split view. In preview-only mode the preview scrolls directly with scrollToSyncLine.
  • Empty states: a short message when no document is open, when the file is JSON/YAML, or when it has no headings yet.
  • README: feature list updated.

Not included

  • Highlighting the section currently in view.

Test plan

  • npm run lint, npm test (287 passed, 3 new), npm run build
  • Manual check in tauri dev: toggle via button and shortcut; jumping works in editor, split and preview modes; code-block # is ignored; setext heading is listed; live updates while typing

🤖 Generated with Claude Code

Browse the headings of the current Markdown file as an indented table
of contents in the sidebar, opened from a new toolbar button or
Ctrl/Cmd+Shift+O. Headings come from the preview's own markdown-it
parse, so code-block '#' lines are skipped and setext headings count.
Clicking a heading moves the editor caret there with the heading at the
top of the view; the preview follows via scroll sync, or scrolls on its
own in preview-only mode.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
@lezli01
lezli01 merged commit a6126af into master Oct 25, 2026
8 checks passed
@lezli01
lezli01 deleted the feat/table-of-contents branch October 25, 2026 09:52
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