The block follows the theme now, but every token in it is one color.
Add syntax highlighting, using the palette from the approved design.
Render: add rehype-highlight and pass it to react-markdown. The plugin
array sits at module scope, because react-markdown remounts the rendered
tree when the array identity changes. That is the same hazard the
remarkPlugins memo already guards against.
Detection: `detect` is on, because most agent-authored fences carry no
language tag and would never highlight without it. `subset` restricts
detection to the languages agents actually post. highlight.js guesses
badly on short snippets, and a wrong guess colors the whole block wrongly.
Palette: eight `--code-syntax-*` aliases carry the roles. Each one points
at a token that already exists and already has a `.dark` override, so a
custom property resolves per mode at its use site and one definition
covers both themes.
The mapping is BORROWED, and this is the part to review. Paperclip has no
syntax palette. `--status-task-icon-*` and `--chip-match-title-fg` name
task-status and search-chip concerns. They were used because they are the
only hues that carry a real per-mode value; the fixed `--status-task-*`
hues go dim on the dark code surface. The coupling is confined to the
alias block. Repointing those eight lines moves the whole palette, and no
rule changes. A test asserts that the syntax rules never reference the
borrowed tokens directly.
Verified in both themes on a real task. Light resolves keyword #7c3aed,
identifier oklch(0.145 0 0), function oklch(0.4 0.13 265), comment
oklch(0.556 0 0). Dark resolves #9474f0, oklch(0.985 0 0),
oklch(0.78 0.1 265), oklch(0.708 0 0).
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
The review gate asks for a test that verifies the fix. Add one.
The original defect was a hardcoded color. The block used #1e1e2e and
#cdd6f4 in the normal AND the prose-invert variables, so the theme could
not change it. The regression to guard against is therefore simple: a
literal color returns to one of these surfaces.
Assert on the stylesheet, which follows the pattern already used by
MarkdownAccentStyles.test.ts:
- the rendered block rides --muted, --foreground, --border, --radius-lg
- the editor content block rides the same four tokens
- the normal and the inverted prose variables point at the same tokens
- none of the three surfaces contains a hex, rgb() or hsl() literal
- the copy and wrap controls do not use --muted, which is now the fill
of the block they sit on
Verified that the tests fail on the original defect. Restoring #1e1e2e
and #cdd6f4 fails 2 of the 5.
Export codeBlockActionStyle so the control test can read it.
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>