feat(web): render Mermaid diagrams in markdown - #4989
Conversation
|
Important Review skippedAuto reviews are disabled on this repository. Please check the settings in the CodeRabbit UI or the ⚙️ Run configurationConfiguration used: Repository UI Review profile: CHILL Plan: Pro Plus Run ID: You can disable this status message by setting the Use the checkbox below for a quick retry:
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
ApprovabilityVerdict: Needs human review This PR introduces a new feature with ~400 lines of new component code for rendering Mermaid diagrams with interactive pan/zoom controls. New user-facing capabilities with substantial new logic warrant human review. You can customize Macroscope's approvability policy. Learn more. |
8509c4f to
a245ae8
Compare
What Changed
T3 Code now renders fenced Mermaid diagrams in chat messages and rendered Markdown file previews.
The diagram viewport supports pointer controls, keyboard controls, bounded pan, 50–300 percent zoom, and a reset action.
Why
Markdown diagrams appeared as source code. This made agent plans and architecture notes harder to read.
A stable Markdown component prevents diagram flicker when thread data changes. The viewport limits zoom and pan positions.
Fixes #4571
UI Changes
Before
After
Interaction
Watch the zoom, pan, and reset controls
Checklist
About 790 changed lines come from the generated lockfile update for Mermaid.
Validation
pnpm exec vp test run apps/web/src/components/MermaidDiagram.test.tspnpm exec vp lint apps/web/src/components/MermaidDiagram.tsx apps/web/src/components/MermaidDiagram.test.ts apps/web/src/components/ChatMarkdown.tsx apps/web/src/components/FileMarkdownViewer.tsxpnpm --filter @t3tools/web typecheckpnpm --filter @t3tools/web buildModel: GPT-5.6 Codex
Harness: T3 Code Codex harness
Note
Render Mermaid diagrams in chat markdown with pan/zoom support
MermaidDiagramcomponent (MermaidDiagram.tsx) that renders mermaid code fences as interactive diagrams with toolbar controls for zoom in/out and reset.MarkdownRenderContextin ChatMarkdown.tsx to passdiffThemeName,isStreaming, andresolvedThemeto child renderers without prop drilling.mermaidpackage (~11.x) as a dependency, which is dynamically imported at render time.Macroscope summarized a245ae8.