Repository navigation
Set a list closer under its paragraph, and space the previews as the page - #423
Merged
Merged
Conversation
Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_01HnFn8HVAncUyJ6jU4yhnRM
The browser gives a paragraph and the list after it a margin of 1em each, which collapse to the gap between two paragraphs: the list looks as if a blank line stood above it. Both margins of that pair are now 0.35em, on a page, in the previews, on a slide and in a comment. The list may sit behind the empty marker of its source line in a preview, or in the box of an incremental list or of a slide's step, so the rule names those wrappers too. A list after a box's title, a heading or another list keeps the browser's margins. The browser tests measure the gaps on a page and on a slide, through its steps, against the gap between two paragraphs and below a heading. Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_01HnFn8HVAncUyJ6jU4yhnRM
A loose list's first item starts with a paragraph whose top margin of
1em collapses through the list into the gap above it, so the list kept
the gap of two paragraphs: that paragraph's top margin is 0.35em too
when the list follows a paragraph. A line {.sorted} or
{.nonincremental} before a list puts it in a box, as {.incremental}
does, and the rule now looks through those boxes as well. The page's
test checks a loose list after a paragraph, its items still a
paragraph's gap apart.
Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01HnFn8HVAncUyJ6jU4yhnRM
The rule took any paragraph but a box's title, and so also moved the list of a [[!toc]] under its "Contents" title, whose own margin it overrode. The text's paragraphs are the renderer's only paragraphs without a class, so the rule now takes those alone. The page's test checks that the list at the start of a box stays a paragraph's gap below the box's title. Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_01HnFn8HVAncUyJ6jU4yhnRM
Each block of a preview follows an empty marker of its source line, which the preview follows the cursor's line by. The marker had overflow: hidden, which made it a block formatting context: the margins on its two sides no longer collapsed through it, and every gap between two blocks in the preview was twice the page's (32 pixels against 16 between two paragraphs). No commit or plan says why it was there; an empty block of no height needs nothing to hide. Without it the margins collapse through the marker, and the marker is still a box at the next block's top, or a few pixels above it, for followLine's scroll and scrollIntoView. A browser test of the side by side preview compares the gaps between a text's blocks with the page's. Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_01HnFn8HVAncUyJ6jU4yhnRM
Co-Authored-By: Claude Fable 5.2 <[email protected]> Claude-Session: https://claude.ai/code/session_01HnFn8HVAncUyJ6jU4yhnRM
#418 added two bindings to the browserJS list of Test.Browser.Workspace where this branch added one; the merge keeps all three. Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_01HnFn8HVAncUyJ6jU4yhnRM
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.
WP5.148: a list right after a paragraph sits closer to it, and the editor's previews space a text's blocks as the page does. The owner: between a text and the list after it the render leaves a large gap, "tak jakby był tam enter", and space is wasted.
What was found
.source-linemarkers the previews use for following the cursor's line hadoverflow: hidden, which made each a formatting context of its own and stopped the margins on its two sides from collapsing through it. The rule had it since it was written (WP5.36); it hid nothing, the marker being empty.What is built (CSS only, in
web/style.css):has), and the first paragraph of a loose list's first item with them. It holds where the renderer puts something between the two: a source-line marker in a preview, the box of an incremental, non-incremental or sorted list, the box of a step after[[!pause]]. Only paragraphs without a class count, so a box's title, the contents' title and a spoiler's error line are left alone.overflow: hiddenis gone from.source-line. The marker is still an empty block with a box, sofollowLineandscrollIntoViewstill have something to scroll to; a block followed now lands about 16 px lower in the pane than before.An incremental list and a list after a pause keep the same gap while their items and steps appear.
Known and left
[[!div]]), a list after display math (a box, not a paragraph), and{.day}lists keep their spacing.htmlfence's own<p>followed by<ul>moves too, its frame being a page body.parskip): a list stands a paragraph's skip below its paragraph there, as before. Read from the template, not from a rendered PDF.Tests (a real browser)
Test.Browser.Spoilers, "a list right after a paragraph"): paragraph, list, paragraph, paragraph; a heading then a list at 19.9 px; a loose list; a list at the start of a box.Test.Browser.Slides): a plain list, a heading, an incremental list across its steps, a list after a pause.Test.Browser.Workspace, "spaces a text's blocks in the side by side preview as the page does"): six gaps between seven blocks, equal to the page's within half a pixel.Verification
Run locally:
format,lint; the browser groups touched and those that follow lines or scroll, alone (106 examples: the workspace's 10, the editor's 51, the frames' 18, the slides' 17, the spoilers' 9, the presentation preview's follow). No Haskell outside the tests changed;build-nativeandbuild-wasmbeyond the test build are left to CI.Codex
{#id}) is wrapped in a box the rule does not name, and keeps the full gap (said). (4) A list whose first item starts with a heading keeps that heading's margin above it. The rule is CSS written case by case because the renderer puts wrappers between the two; a rule that cannot miss a case would have the renderer mark the pair, which is a change of every page's HTML and a package of its own.(rounds are added here)
🤖 Generated with Claude Code
https://claude.ai/code/session_01HnFn8HVAncUyJ6jU4yhnRM