Skip to content

docs: sit the file-name tab flush with its code block - #4078

Merged
max-sixty merged 5 commits into
mainfrom
margin
Sep 12, 2026
Merged

max-sixty merged 5 commits into
mainfrom
margin

Conversation

@max-sixty

@max-sixty max-sixty commented Sep 12, 2026 •

Copy link
Copy Markdown
Owner

Code blocks titled with a file name (for example .config/wt.toml above a TOML excerpt) showed an awkward gap to the left of the name tab. Expressive Code's .header::before draws a 1px outline around the whole strip above the code, which our overrides left in place, and the tab was inset 0.6rem from the frame's left edge, so an empty outlined box sat beside it. The outline is removed and the tab now sits flush with the frame's left edge, keeping its own background and rounded corners; the copper rule still starts where the code does.

The browser test that already checks the label sits directly on its code now also checks the label and the code share a left edge; with the old inset restored, it fails.

This was written by Claude Code on behalf of max-sixty

🤖 Generated with Claude Code

https://claude.ai/code/session_016NGjseUKXkyL8qHLhaXsnt

max-sixty and others added 4 commits September 12, 2026 13:13
#4000 stretched every terminal frame to the full content panel on
viewports of 72rem and up, to give `wt list --full` room. Once the panel
is wider than the 62rem column, Starlight offsets the column inside it,
so shell snippets moved left of the prose they belong to and spanned
past it on the right, while TOML frames stayed in the column. At 2560px
on /tips-patterns/, prose starts at x=760 and shell frames at x=248,
1504px wide.

#4039 had already made terminal output fit the column: `wt list`
examples render at 98 columns and the column widened to 62rem. With the
stretch disabled, no output-bearing frame on any page overflows; three
long one-line commands scroll, as long TOML lines already do. So the rule
goes rather than being narrowed.

The desktop browser test only ran at widths where the panel and column
are the same size, where the rule changed nothing. It now also runs at
1920px and asserts every code frame stays within the column; with the
old rule restored it fails on the homepage.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_016NGjseUKXkyL8qHLhaXsnt
Pages on a worktree's dev server lost all code-block styling after a
merge from main. Astro caches rendered Markdown with the Expressive Code
stylesheet URL baked in. That URL's hash comes from the code-rendering
config and plugins, which Astro's content-cache key does not cover. The
merge changed `astro.config.mjs` and the terminal plugin, Astro restarted
the server in place, and the restarted server served a new stylesheet
hash while content kept rendering with the old renderer. Every page then
linked `ec.fq08u.css`, which returned 404.

Restarting the process did not recover either, because the cached pages
survive a plain `astro dev`. The dev script now passes `--force`, as the
build already does, so a restart re-renders from the current renderer.
docs/CLAUDE.md says to restart with `wt hook post-start docs` after
`astro.config.mjs` changes, since the in-place restart can't be fixed
from this repo.

The hook also sets `ASTRO_DEV_BACKGROUND=1`. When `astro dev` detects an
AI agent (`CLAUDECODE`, `CODEX_THREAD_ID`), it respawns itself detached
and drops `--force`. The respawned server is reparented to launchd,
outside tether's process tree, so worktree removal can't stop it; three
worktrees currently run their dev servers this way.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_016NGjseUKXkyL8qHLhaXsnt
Code blocks titled with a file name showed an empty outlined box to the
left of the name tab. Expressive Code's `.header::before` draws a 1px
outline around the whole strip above the code, which our header
overrides left in place, and the tab was inset 0.6rem from the frame's
left edge. The outline is removed and the tab sits flush with the
frame's left edge, keeping its own background and rounded corners.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_016NGjseUKXkyL8qHLhaXsnt

@worktrunk-bot worktrunk-bot left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

The alignment this fixes isn't pinned by anything, which is why the gap survived unnoticed in the first place. docs/tests/browser-site.test.mjs already measures this exact frame — the fileFrame block that picks the .frame.has-title containing ~/.config/worktrunk/config.toml — but only on the vertical axis: assert.ok(Math.abs(fileFrame.titleBottom - fileFrame.codeTop) < 1, ... 'file label is detached from its code'). Nothing measures the horizontal edge, so re-introducing an inset on .title, or an Expressive Code upgrade that reasserts padding-inline-start on .header (it sets that from frames.editorTabsMarginInlineStart, which the override here neutralises with padding: 0), regresses this silently.

The horizontal twin fits in the same page.evaluate — add titleLeft: title.getBoundingClientRect().left and codeLeft: pre.getBoundingClientRect().left beside the existing measurements, then assert alongside the vertical one:

assert.ok(
  Math.abs(fileFrame.titleLeft - fileFrame.codeLeft) < 1,
  `${theme} file label is inset from its code`,
);

Both boxes sit at the frame's content-box left once the margin is gone (.expressive-code pre carries margin: 0, and the .header override zeroes its padding), so the 1px tolerance matches the existing check. Happy to push it if you'd like.

The file-label check measured only the vertical gap between the tab and
its code, so an inset tab (or an Expressive Code upgrade that restores
the header's inline padding) would regress silently. It now also asserts
the label and the code share a left edge; with the old 0.6rem inset
restored, the test fails.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_016NGjseUKXkyL8qHLhaXsnt
@max-sixty
max-sixty merged commit dd38933 into main Sep 12, 2026
40 checks passed
@max-sixty
max-sixty deleted the margin branch September 12, 2026 22:06
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.

2 participants