Skip to content

feat: add a pre.terminal idiom for terminal output to the reading theme - #6542

Merged
leaf-agent merged 2 commits into
mainfrom
fix/issue-6541
Nov 19, 2026
Merged

leaf-agent merged 2 commits into
mainfrom
fix/issue-6541

Conversation

@leaf-agent

@leaf-agent leaf-agent commented Nov 19, 2026 •

Copy link
Copy Markdown
Collaborator

The reading theme now declares a pre.terminal idiom 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 tint lf-code gives 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.

Before (plain pre styling) After, light After, dark
before after light after dark

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:

  • Copying only the commands. Copying still takes whatever the reader selected, output included. A theme is CSS, so it could only do this with a script that rewrites the clipboard, or by making the output unselectable. Unselectable output would also stop a reader from pointing a comment at a line of it. The CSS comment records this, and adding either one is your call.
  • The window title bar from the release-note page. The block keeps the code block's own frame, and its <figcaption> names the run.

Verification: tests/model/test_themes.py and the layer contract tests (interact_contract/test_layer_contract.py, test_interact_layer.py) pass. The pictures are a --runtime export of a demo page rendered in Playwright's Chromium at 420px wide.

Closes #6541 — automated triage

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 leaf-agent left a comment

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Comment thread packages/reading/defaults.css Resolved
…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.
@leaf-agent
leaf-agent merged commit 2d6e1f6 into main Nov 19, 2026
6 checks passed
@leaf-agent
leaf-agent deleted the fix/issue-6541 branch November 19, 2026 22:10
leaf-agent added a commit that referenced this pull request Nov 22, 2026
…-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]>
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.

Reading theme: a class idiom for terminal output

1 participant