Repository navigation
feat: add a pre.terminal idiom for terminal output to the reading theme - #6542
Conversation
A page showing a command and what it printed had only a plain <pre>, which gives both the same weight, or lf-code, which numbers source lines. The reading theme now declares pre.terminal: a <b> holds each command, an <i> on its own line marks cut output in the code's muted ink, and a <mark> takes the accent's tint under the code's ink. Long lines wrap rather than scroll sideways. Copying keeps the browser's selection, output included. Closes #6541
leaf-agent
left a comment
There was a problem hiding this comment.
The terminal <mark> takes the colour Leaf already uses for the user's draft comment, even though a token for "the code line to notice" exists. pre.terminal mark mixes color-mix(in srgb, var(--lf-accent) 40%, transparent). That is the same hue as --lf-mark-pending (color-mix(in srgb, var(--lf-accent) 20%, transparent) in tokens.css), the wash marks.css paints on the passage a draft comment points at. So a reader can't tell a passage they are commenting on from one the author marked. Meanwhile lf-code already highlights a line to notice with --lf-hi-tint (lf-code :is(.lf-code-line, .lf-code-elided)[data-lf-hi] in packages/default/styles/code.css), a token tuned for the code canvas in both schemes. With that token, a terminal mark and an lf-code highlight look the same, and the pending-comment hue stays Leaf's alone. I'll push that change and update the CSS comment and the description to match.
…ent's accent wash pre.terminal mark mixed the accent at 40%, the hue of --lf-mark-pending, which marks.css paints on the passage a draft comment points at. It now takes --lf-hi-tint, the tint lf-code gives a line to notice.
…-fix (#6721) `test_every_idiom_in_the_catalog_stands_in_a_corpus_source` has failed on main since #6715. That change moved the terminal-session idiom from the `reading` package into Leaf's own registry as `pre.lf-terminal`, and the test checks every idiom in that registry. No example had ever held the idiom: #6542 added it to `reading`, which this test doesn't read. The fix-review example (`examples/review-a-fix.html`) says its regression test "fails on each without the fix" but showed no run. It now shows that run as a terminal session: output captured from the fix's own regression test, `test_a_draft_s_image_closes_back_to_the_draft`, run at #2882's commit with its runtime files set back to their parent's (2 failed) and then restored (2 passed). So the page carries the evidence for its claim and the idiom has a corpus source. The test fails on `b54a16fc4` with `no example holds pre.lf-terminal` and passes on this branch. `leaf page check` on the example's page directory reports no findings. The render check couldn't launch Chrome in the triage sandbox, so this PR's corpus render tests are the first browser draw of the new figure. The figure sits below the recordings, so it shouldn't change the page's first screen, but the site previews haven't been regenerated. The other failure in [run 44982643983](https://github.com/max-sixty/leaf/actions/runs/44982643983), `test_a_coarse_pointer_keeps_useful_status_without_keyboard_hints`, was fixed by #6717, which merged after that run's commit. Refs #6719 — automated triage --------- Co-authored-by: leaf-agent <[email protected]> Co-authored-by: leaf-agent <[email protected]>
The reading theme now declares a
pre.terminalidiom beside.callout, so a page that shows a command and what it printed needs no CSS of its own. A<b>holds each command, which the browser already sets bold. An<i>on a line of its own marks cut output in the code's muted ink, not italic. A<mark>takes--lf-hi-tint, the tintlf-codegives a line to notice, and keeps the code's ink in both schemes, where the browser's default is yellow under black. It leaves the accent's wash to the draft comment's passage highlight (--lf-mark-pending), so a marked line doesn't read as a passage the user is pointing at. Long lines wrap, breaking anywhere a path or hash has no break, so output doesn't scroll sideways on a phone. The registry entry's example is the markup from #6541, so an agent sees it in the page's vocabulary.prestyling)The last block in each "after" picture is a plain
<pre>for comparison, and it is unchanged. The second shows a long command and a hash wrapping at 420px.Two parts of the request this PR leaves out:
<figcaption>names the run.Verification:
tests/model/test_themes.pyand the layer contract tests (interact_contract/test_layer_contract.py,test_interact_layer.py) pass. The pictures are a--runtimeexport of a demo page rendered in Playwright's Chromium at 420px wide.Closes #6541 — automated triage