fix(viewer): make Full-Width toggle actually toggle width; center default at ~780px#159
Open
andrey-golovko wants to merge 2 commits into
Open
Conversation
…ggle now meaningful
The .markdown-body and .markdown-body.full-width CSS rules in
MarkdownViewer.svelte were byte-for-byte identical, so the Full-Width toggle
had no effect on the document body — it only fed the TOC overhang derivation.
Change the default .markdown-body padding to:
padding: 50px max(24px, calc((100% - 780px) / 2));
which centers content at ~780px on wide screens (matching the 780 magic
number already used by isOverhanging at MarkdownViewer.svelte:183) and keeps
a 24px gutter floor on narrow screens. The existing .full-width rule's
responsive clamp(24px, 5vw, 50px) padding is now genuinely the wide
alternative, restoring the toggle's purpose.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
The Full-Width toggle in
MarkdownViewer.svelteis currently a visual no-op for the document body. The default and.full-widthrules are byte-for-byte identical:The
isFullWidthstate only feeds theisOverhangingderivation that decides whether the TOC overlaps the content (MarkdownViewer.svelte:183) — it does not affect the body's width or padding.A side effect is that on wide monitors the body fills the entire viewer pane, producing very long line lengths.
Change
One-line CSS edit — the default
.markdown-bodynow uses a centering padding:(100% - 780px) / 2produces symmetric gutters that visually center an ~780 px content column. The780matches the existing magic number already used byisOverhangingatMarkdownViewer.svelte:183, so TOC overhang behavior is consistent.max(24px, …)floor keeps a sensible minimum gutter (same 24 px as before)..markdown-body.full-widthis unchanged — its existingclamp(24px, 5vw, 50px)padding is now a genuine wide alternative, so toggling Full-Width has a visible effect for the first time..markdown-bodyremains the scroll container, so the scrollbar continues to sit at the pane edge (centering via horizontal padding rather thanmargin: auto).Out of scope
isFullWidthstate, localStorage persistence, and TOC overhang logic atMarkdownViewer.svelte:180-187are untouched.Test plan
npm run buildsucceeds (Svelte/Vite, no new warnings on touched rules)cargo tauri build) succeeds; toggling Full-Width visibly switches between centered ~780 px column and full-width on a wide monitorsettings.showToc) — TOC overhang behavior unchanged🤖 Generated with Claude Code