Context
The Markdown component renders assistant messages using marked. Code blocks get <pre><code class="language-X"> tags but display as plain monochrome text with no syntax coloring. This makes code output harder to read compared to the diff/file viewer panels which already use Shiki.
Goal
Code blocks inside rendered markdown should have syntax-highlighted coloring, using the same Shiki setup already in the codebase.
Approach
Use async post-render highlighting (a brief flash of unstyled code is acceptable):
- After
marked renders HTML and it's inserted into the DOM, walk the <code class="language-*"> elements
- Use Shiki's
codeToHtml() to highlight each block (reuse the theme config and cache pattern from content-code.tsx)
- Replace the plain
<code> innerHTML with the highlighted output
- Respect light/dark theme (
github-light / github-dark as in content-code.tsx)
Alternative: Use marked's async API or a custom renderer that calls Shiki during parsing. Either approach is fine as long as code blocks end up colored.
Files to modify
app-prefixable/src/components/markdown.tsx — main change: add Shiki highlighting to code blocks
app-prefixable/src/index.css — may need minor CSS adjustments for Shiki's output (e.g. .shiki styles)
- Reuse highlight logic from
app-prefixable/src/components/diff/content-code.tsx (cache, theme config, bundledLanguages check)
Acceptance Criteria
Context
The
Markdowncomponent renders assistant messages usingmarked. Code blocks get<pre><code class="language-X">tags but display as plain monochrome text with no syntax coloring. This makes code output harder to read compared to the diff/file viewer panels which already use Shiki.Goal
Code blocks inside rendered markdown should have syntax-highlighted coloring, using the same Shiki setup already in the codebase.
Approach
Use async post-render highlighting (a brief flash of unstyled code is acceptable):
markedrenders HTML and it's inserted into the DOM, walk the<code class="language-*">elementscodeToHtml()to highlight each block (reuse the theme config and cache pattern fromcontent-code.tsx)<code>innerHTML with the highlighted outputgithub-light/github-darkas incontent-code.tsx)Alternative: Use
marked's async API or a custom renderer that calls Shiki during parsing. Either approach is fine as long as code blocks end up colored.Files to modify
app-prefixable/src/components/markdown.tsx— main change: add Shiki highlighting to code blocksapp-prefixable/src/index.css— may need minor CSS adjustments for Shiki's output (e.g..shikistyles)app-prefixable/src/components/diff/content-code.tsx(cache, theme config,bundledLanguagescheck)Acceptance Criteria
```typescript) render with syntax colors<span>color styles