Skip to content

feat(html): let a page set its own body margin and background - #683

Merged
andiwand merged 3 commits into
mainfrom
feat/page-margin-reset
Aug 10, 2026
Merged

feat(html): let a page set its own body margin and background#683
andiwand merged 3 commits into
mainfrom
feat/page-margin-reset

Conversation

@andiwand

Copy link
Copy Markdown
Member

🤖 Generated with Claude Code

Stacked on #682 — review that one first.

Follow-up to the text view: every view except the pdf one was reading the
browser's default sheet for the body box, so a file listing, a source view or an
image opened inset by an eight-pixel white border that is not ours.

Each stylesheet now states body{margin:0;background:…} itself, spelled out even
in document.css, where the *{margin:0} reset already covered it — the rule
should be legible where you look for it. image.html and font.html shipped no
body rule at all and now get one.

Two pages take the space back deliberately rather than losing it:

  • the xml source view pads its own container by 16px, so folding a tree does not
    start against the window edge;
  • the font specimen keeps its eight pixels, as padding it owns.

Backdrops that were a choice stay as they were: pdf and video on their dark
grounds, a sheet on its canvas, a paginated document on its grey.

test/data.cmake advances the private reference-output pin: the twelve font
specimen pages carry the new body rule. otf/ttf are the only outputs that
changed — the full suite is otherwise byte-identical on both repos.

Checked in Chrome: text, xml, file listing, image, sheet, paginated odt.

andiwand and others added 2 commits August 10, 2026 20:25
The text view was the last one still on its first styling: a browser
default monospace against a three-pixel grey rule, no page padding, and
line numbers that drifted off their lines the further down the file you
read - the script sizing the number cells rounded a fractional line
height per cell.

Restyle it against the palette the xml, filesystem and sheet views
already use, pin the line height to a whole pixel, measure the lines
with `getBoundingClientRect`, keep the numbers out of a selection of the
page, and mark the hovered line across both columns.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01SJYhr3t6QBamsHRfZ7gPDw
Every view but the pdf one and the text one read the browser's default
sheet for the body box, so a file listing, a source view or an image
opened inset by an eight-pixel white border nobody had asked for.

Each stylesheet now states `body{margin:0;background:...}` itself -
spelled out even where `*{margin:0}` already covered it - and the image
and font pages, which shipped no body rule at all, get one. The xml view
takes the space back as padding on its own container; the font specimen
keeps its eight pixels, now as padding of its own.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01SJYhr3t6QBamsHRfZ7gPDw
Base automatically changed from feat/text-view-look to main August 10, 2026 18:40
@andiwand
andiwand enabled auto-merge (squash) August 10, 2026 18:41
@andiwand
andiwand disabled auto-merge August 10, 2026 18:42
@andiwand
andiwand merged commit 5cb9d27 into main Aug 10, 2026
25 checks passed
@andiwand
andiwand deleted the feat/page-margin-reset branch August 10, 2026 18:42
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