Skip to content

feat(preview): unified reading width + outline (TOC) panel#100

Closed
beihai23 wants to merge 1 commit into
mattenarle10:mainfrom
amazing-project:feat/preview-wide-width
Closed

feat(preview): unified reading width + outline (TOC) panel#100
beihai23 wants to merge 1 commit into
mattenarle10:mainfrom
amazing-project:feat/preview-wide-width

Conversation

@beihai23

Copy link
Copy Markdown
Contributor

Two small, related reading-mode enhancements. Happy to split into two PRs if you prefer — they only share app.css and app.tsx; the rest of the files are independent.

1. Unified reading-width control

The reading-width slider (narrow / comfort / wide / full) previously only affected reading mode — the split preview's .mdv-prose was hardcoded to max-width: 720px. This makes split preview follow the same setting, and repurposes the full step to mean "fill the viewport":

  • .mdv-prose now uses var(--mdv-reading-prose-width) instead of 720px, so both split and reading modes respect the slider.
  • full adds an is-reading-width-full class → max-width: none, table { width: 100% }, and tighter 16px horizontal padding (handy for wide multi-column tables).
  • One width control, persisted, works everywhere.

2. Outline (TOC) panel for reading mode

A docked outline panel on the right of the reading view:

  • Toggle via the reading-mode title bar (list icon) or the command palette (show outline / hide outline). State is persisted.
  • Reads the rendered h1h6 from the prose article — each heading already carries a GitHub-style slug id from the markdown renderer (heading_open rule in markdown.ts), so no separate parser is needed.
  • Clicking an entry scrolls to that heading. The panel mirrors ReadingFind's (open, scope, contentKey) contract so it re-walks fresh DOM after each preview re-render.

Verification

  • bun run build (tsc) ✅
  • bun test — 24/24 ✅
  • Manual: enter reading mode (⌘.) → drag the reading-width slider to full for fill-viewport; click the outline icon (or ⌘K → "show outline") for the TOC.

🤖 Generated with Claude Code

Two reading-mode enhancements:

1. Unify preview width into the reading-width control
   - Remove the standalone "fill width" toggle; its behavior (fill
     viewport + 100% tables + tighter padding) moves into the "full"
     step of the existing reading-width slider.
   - Split preview now follows reading-width too — .mdv-prose uses the
     --mdv-reading-prose-width variable instead of a hardcoded 720px.
   - One width control (narrow / comfort / wide / full), effective in
     both split and reading modes, persisted.

2. Add a docked table-of-contents (outline) panel for reading mode
   - Toggle from the reading-mode title bar or the command palette.
   - Reads the rendered headings (each already carries a GitHub-style
     slug id from the markdown renderer) and scrolls to the chosen
     heading on click. State persisted.

Co-Authored-By: Claude <[email protected]>
@mattenarle10

Copy link
Copy Markdown
Owner

LOOKS F-IN GOOD TO ME

@mattenarle10

Copy link
Copy Markdown
Owner

Closing as superseded by #102, which landed the unified reading width/outline work plus the follow-up editor gutter polish.

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.

2 participants