# refactor\(web\): chat markdown code blocks live in their own module · PR \#22690 · pingdotgg/t3code

[View on GitCafe](https://git.cafe/pingdotgg/t3code/pull/22690)

Repository: [pingdotgg/t3code](https://git.cafe/pingdotgg/t3code)

Visibility: public

State: merged

Source repository: pingdotgg/t3code

Source branch: refactor/chat-markdown-code-blocks

Target branch: main

Head commit: eadb13d18e5902bba671f0fa814711ea0a479180

[Discussion and reviews](https://git.cafe/pingdotgg/t3code/pull/22690)

[Commits](https://git.cafe/pingdotgg/t3code/pull/22690/commits?format=markdown)

[Files changed](https://git.cafe/pingdotgg/t3code/pull/22690/diffs?format=markdown)

## Description

---

ChatMarkdown.tsx was a 3,560-line file that held every markdown renderer. This stack splits it into focused modules so each piece is readable on its own.

The code block, its frame and the Shiki renderers move to `chat/MarkdownCodeBlock.tsx`, along with the highlight cache. The fence parsing helpers move to `MarkdownCodeBlock.logic.ts`. The shared action-failure logger moves to `chat/markdownActionFailure.ts`. `ComposerCodeBlockNodeView` now imports `MarkdownCodeBlockFrame` from the new module.

This is a pure move. Each renderer was already its own component, so no render boundary changes. Behavior is unchanged.

| | Before | After |
|---|---|---|
| `ChatMarkdown.tsx` lines | 3560 | 3069 |
| New files | | chat/MarkdownCodeBlock.tsx (390), MarkdownCodeBlock.logic.ts (119), markdownActionFailure.ts (15) |
| Renders | unchanged: no component, subscription or context boundary moved | unchanged |

Renders were not measured for this layer. It changes no render boundaries: the components, their props, and the two contexts stay exactly as they were.

Tests run:
- `vp test run --project browser src/components/ChatMarkdown.browser.test.tsx src/components/ChatMarkdown.permissions.browser.test.tsx` (11 passed)
- `vp test run --project unit src/reactCompilerCoverage.test.ts` for every touched file (0 bailouts)
- `tsc --noEmit` for apps/web, and `vp lint` on changed files

🤖 Generated with [Claude Code](https://claude.com/claude-code)
