Skip to content

feat(chat): prose code blocks get room — T3, and the plan is complete - #79

Merged
ndemianc merged 1 commit into
developfrom
feat/chat-typography-t3
Aug 16, 2026
Merged

feat(chat): prose code blocks get room — T3, and the plan is complete#79
ndemianc merged 1 commit into
developfrom
feat/chat-typography-t3

Conversation

@ndemianc

Copy link
Copy Markdown
Contributor

D5, the last slice of docs/CHAT-TYPOGRAPHY.md. pre padding 9px 11px12px 14px, with the block's vertical margin joining D3's em rhythm so raising the prose size opens it too.

The part D5 didn't anticipate

pre is a global selector in this stylesheet, and it draws four different things:

<pre> what it is has its own padding?
.lc-ascii the empty state's ASCII logo no
.tl-ask .mcpargs the MCP approval card's command block yes
.tl-cmd .termout the terminal output pane yes
bare <pre><code> the prose code block D5 is about

Only the logo has no override, so widening bare pre would have quietly moved it. Scoped to .msg .body pre — the same distinction T2 had to make between .msg and .msg .body, which is to say the same mistake waiting in a new place.

Gated to reading width, like D3

Measured against develop:

sidebar (420px) editor (1200px)
prose pre padding 9px 11pxunchanged 12px 14px
prose pre margin 8pxunchanged 14px (1em at the shipped prose size)
ASCII logo · terminal pane · inline code unchanged unchanged

A 380px sidebar is deliberately dense, and six more pixels a side is content width it doesn't have.

Inline code is deliberately untouched

D5 says keep it theme-driven — no color, ever, because the red/orange in dark themes comes from the theme and hard-coding one fights every theme rather than fixing anything.

Its tight padding: 1px 5px is also correct rather than an oversight: vertical padding on an inline box doesn't grow the line box, so a roomier inline span overlaps the line above it. "Code surfaces get room" is a statement about blocks, not spans. Both halves are now guarded, since both are the kind of thing added while tidying.

Guards

Each bypass-verified by reverting the fix:

bypass caught
the rule removed
bare pre widened — moves the ASCII logo
the margin reverting to an absolute, leaving D3's rhythm
inline code starting to set a colour
inline padding grown
the rule moved outside the width gate

One test message corrected while bypassing. An assertion claimed to prove the rule was inside the gate, when it only catches a second, ungated copy declared earlier in the file — membership in the gate block is what actually proves it. The message now says what it checks.


With this, every slice of CHAT-TYPOGRAPHY.md has shipped: T1 (measure) → T2+T5 (type scale + escape hatch) → T4 (speaker treatment) → T6 (side) → T7 (shell column) → T3 (code surfaces). Two of those — D8 and D9 — weren't in the original decomposition; both came from looking at the reference again after shipping, which is the argument for slices small enough to look at.

32 tests in webviewCss, 33 suites green.

docs/CHAT-TYPOGRAPHY.md D5, the last slice. `pre` padding 9px 11px -> 12px 14px, with the
block's vertical margin joining D3's em rhythm so raising the prose size opens it too.

THE PART D5 DID NOT ANTICIPATE: `pre` is a GLOBAL selector in this stylesheet, and it draws
four different things — the empty state's ASCII logo, the MCP approval card's command
block, the terminal output pane, and the prose code block the decision is actually about.
Only the logo has no padding override of its own, so widening bare `pre` would have quietly
moved it. Scoped to `.msg .body pre`, which is the same distinction T2 had to make between
`.msg` and `.msg .body` — the same mistake waiting in a new place.

Gated to reading width, like D3. Measured against develop:

                                    sidebar (420px)      editor (1200px)
  prose pre padding                 9px 11px unchanged   12px 14px
  prose pre margin                  8px unchanged        14px (1em at prose size)
  ASCII logo / terminal / inline    unchanged            unchanged

Inline code is deliberately untouched. D5 says keep it theme-driven — no `color`, ever — and
its tight 1px 5px padding is correct rather than an oversight: vertical padding on an inline
box does not grow the line box, so a roomier span overlaps the line above it. "Code surfaces
get room" is a statement about blocks, not spans, and both halves are now guarded.

Guards, each bypass-verified by reverting the fix:
  - the rule removed; bare `pre` widened (which moves the ASCII logo)
  - the margin reverting to an absolute, leaving D3's rhythm
  - inline code starting to set a colour; inline padding grown
  - the rule moved outside the width gate, so the sidebar changes too

One test message corrected while bypassing: an assertion claimed to prove the rule was
inside the gate when it only catches a second ungated copy declared earlier. Membership in
the gate block is what actually proves it; the message now says so.

32 tests in webviewCss, 33 suites green.
Copilot AI lite review requested due to automatic review settings August 16, 2026 01:04

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull request overview

This PR completes the T3/D5 “code surfaces” slice of docs/CHAT-TYPOGRAPHY.md by increasing prose code block padding and switching its vertical spacing to the same em-based rhythm used elsewhere—while keeping other <pre> usages (empty-state ASCII logo, MCP approval card blocks, terminal panes) unchanged.

Changes:

  • Scoped the larger code-block padding/margin to .msg .body pre and gated it to @media (min-width: 760px) to preserve sidebar density.
  • Added CSS-invariant tests guarding against accidental global pre widening and against inline-code starting to set a hard-coded color or changing its padding.
  • Updated docs/CHAT-TYPOGRAPHY.md to reflect the shipped behavior and the scoping/gating rationale.

Reviewed changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated no comments.

File Description
extensions/levelcode-ai/media/chat.html Applies the gated, scoped .msg .body pre padding/margin change without altering the global pre baseline.
extensions/levelcode-ai/test/webviewCss.test.js Adds invariants ensuring prose code blocks get room only where intended and inline code remains theme-driven.
docs/CHAT-TYPOGRAPHY.md Documents the shipped T3/D5 outcome, including why the rule must be scoped and width-gated.

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

@ndemianc
ndemianc merged commit 4e6593b into develop Aug 16, 2026
2 checks passed
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