Repository navigation
fix(web): render Mermaid diagrams as images - #13970
asonawalla wants to merge 1 commit into
Conversation
ApprovabilityVerdict: Not approved Macroscope's review found this PR not approvable — This PR changes the default presentation of existing Mermaid code blocks into rendered, zoomable SVG diagrams and adds a substantial client-side Mermaid rendering dependency and pipeline. Because the behavior is automatic across existing Markdown content rather than opt-in, the production and product-default impact merits human review. You can add or adjust custom eligibility rules. Learn more. |
|
Navigate logical layers of code changes, visualize relationships, and explore their blast radius. No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Repository: pingdotgg/t3code/.coderabbit.yaml Review profile: CHILL Plan: Advanced Run ID: ⛔ Files ignored due to path filters (1)
📒 Files selected for processing (5)
Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 9 remain after this review. 📝 WalkthroughWalkthroughThe web Markdown renderer now displays completed Mermaid fences as themed SVG images. The new renderer serializes Mermaid calls, caches generated images, and cleans up temporary containers. Source code remains available while rendering, after failures, and in expandable image details. ChangesMermaid image rendering
Priority: ⬇️ Low Estimated code review effort: 3 (Moderate) | ~25 minutes Change: Bug fix Sequence Diagram(s)sequenceDiagram
participant ChatMarkdown
participant renderMermaidImage
participant Mermaid
ChatMarkdown->>renderMermaidImage: request image for completed fence
renderMermaidImage->>Mermaid: render diagram
Mermaid-->>renderMermaidImage: return SVG
renderMermaidImage-->>ChatMarkdown: return SVG data URL
ChatMarkdown-->>ChatMarkdown: display image and expandable source
Possibly related PRs
Suggested reviewers: Merge Risk: ⚪ Minimal · up to Mermaid diagrams retain their source fallback and can be zoomed. No material issue remains to resolve before merging. Security Architecture ReviewSecurity architecture risk: 🟡 Moderate · up to Diagrams use a safer image display path, but many distinct diagrams can still queue rendering work after they are no longer needed. That could slow or stall diagram rendering in the current client session. No code-execution or data-exposure path was established. Retained concerns
Security review detailsSecurity Blast Radius
Security Findings and Attack Paths
Trust Boundaries and Controls
Resilience and Maintainability Implications
Hardening Proposals
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
Full details: Docstring CoverageExplanation Docstring coverage is 25.00% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 4 functions across 4 files. (1 skipped: 1 unsupported.)
✨ Finishing Touches🧪 Generate unit tests (beta)
Comment |
|
This is a great feature, hope it gets merged soon |
Upstream: pingdotgg/t3code#13970 by @asonawalla, plus fork-map registration and a khroma@2.1.0 MIT license override. Co-authored-by: Azim Sonawalla <azim.sonawalla@gmail.com> Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
|
Note This comment is posted by Julius' dot Closing under the prior-approval rule. Automatic Mermaid rendering adds a new Markdown capability. Maintainers declined this direction in #6191, and this PR has no later approval of its direction and scope. The supplied visual evidence and focused checks do not replace that approval. Please obtain explicit maintainer approval before requesting reconsideration. |
What Changed
Mermaid fences now render as SVG images in the shared web/desktop Markdown renderer. Diagrams use the existing image viewer for zooming and keep their source available for copying. Invalid or incomplete diagrams retain the code fallback.
Why
The renderer previously sent every fenced block through syntax highlighting, so Mermaid diagrams appeared as text. Mermaid now loads only when needed, renders completed fences, and caches images by source and theme.
Native mobile is unchanged.
UI Changes
Expanded diagram
Before recording:
before.mp4
After recording:
after.mp4
The after recording covers the image viewer, source controls, a sequence diagram in light mode, and malformed-diagram fallback.
Validation
ChatMarkdown.test.tsxandlib/mermaid.test.ts.Checklist
Implemented with GPT-6-Astra via the Codex harness in T3 Code.
Summary by CodeRabbit