Conversation
GitHub draws a ```mermaid fence as a diagram, so authors write them expecting one, but the pull request panel showed the raw source. Mermaid fences in GitHub-authored markdown now render as diagrams, with a toggle back to the highlighted source and a fallback to it when a diagram cannot parse. Mermaid is imported dynamically and its rendered SVG is cached per source and theme, so the library stays out of the main bundle and remounting a long body does not re-run its layout pass. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Bugbot is paused — on-demand spend limit reachedBugbot uses usage-based billing for this team and has hit its on-demand spend limit. A team admin can raise the spend limit in the Cursor dashboard, or wait for the next billing cycle to continue. |
ApprovabilityVerdict: Not approved Macroscope's review found this PR not approvable — This PR adds a default-on Mermaid rendering capability to production pull-request views, including a large client-side dependency, asynchronous SVG rendering, caching, and source/fallback controls. Its cross-cutting runtime scope and unresolved medium-severity cache/render-lifecycle findings warrant human review. Not approved because:
Adjust the Minimum Blocking Severity for this repo — including turning it Off — in Settings. You can add or adjust custom eligibility rules. Learn more. |
Review found two ways the cache could mislead the renderer. Its key held a 32-bit hash and a length rather than the source, so two same-length diagrams whose hashes collide would share an entry. And the effect's early return re-read the cache instead of trusting what the render pass saw, so a write landing in between stranded the placeholder — the cache has no way to tell React it changed. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: CHILL Plan: Team Run ID: ⛔ Files ignored due to path filters (1)
📒 Files selected for processing (7)
Included review availability: Your plan provides up to 10 included reviews per hour; 9 remain after this review. 📝 WalkthroughWalkthroughThe PR adds Mermaid rendering for pull request markdown. It introduces theme-aware SVG caching, serialized asynchronous rendering, diagram/source toggling, error fallbacks, responsive sizing, and Mermaid-focused tests. ChangesMermaid rendering
Estimated code review effort: 4 (Complex) | ~45 minutes Merge Risk: ⚪ Minimal · up to Mermaid rendering is isolated to pull request markdown, retains source and failure fallbacks, and no actionable merge risk remains. Sequence Diagram(s)sequenceDiagram
participant MarkdownPre
participant MarkdownMermaidBlock
participant MermaidDiagram
participant renderMermaidSvg
MarkdownPre->>MarkdownMermaidBlock: detect enabled Mermaid fence
MarkdownMermaidBlock->>MermaidDiagram: render diagram view
MermaidDiagram->>renderMermaidSvg: request themed SVG
renderMermaidSvg-->>MermaidDiagram: return cached or rendered SVG
MermaidDiagram-->>MarkdownMermaidBlock: display SVG or source fallback
Suggested reviewers: 🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
Full details: Docstring CoverageExplanation Docstring coverage is 53.85% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 13 functions across 5 files. (2 skipped: 2 unsupported.)
✨ Finishing Touches 💡 1🛠️ Fix failing CI checks 💡
🧪 Generate unit tests (beta)
Comment |
What Changed
mermaidfences in GitHub-authored markdown now render as diagrams in the pull request panel — bodies, comments, and review annotations, all of which go throughPullRequestMarkdown. A toggle in the block's toolbar switches back to the highlighted source, and a diagram that cannot parse falls back to it automatically with a one-line note.flowchart LR Fence["mermaid fence"] --> Pre["ChatMarkdown pre renderer"] Pre -->|"mermaidDiagrams off"| Code["Highlighted source"] Pre -->|"mermaidDiagrams on"| Cache{"SVG cached?"} Cache -->|hit| Draw["Diagram"] Cache -->|miss| Load["dynamic import"] Load --> Render["Serialized render"] Render --> Draw Render -->|parse error| CodeDetails worth knowing:
mermaid.coreplus per-diagram-type chunks fetched on demand;mainand theChatMarkdownchunk contain none of it.securityLevel: "strict": pull request bodies are attacker-controlled text, so mermaid's DOMPurify pass stays on and its click/script directives stay off.suppressErrorRenderingkeeps mermaid from injecting its own error graph next to the React fallback.mermaidDiagramsprop, so chat rendering is untouched. Streaming markdown keeps showing source, since a half-written diagram cannot parse.Why
GitHub draws a ```mermaid fence in a pull request body as a diagram, so authors write them expecting a diagram. The panel showed the raw source, which is exactly the content GitHub's own rendering promised to draw.
On the diff size: 803 of the changed lines are
pnpm-lock.yaml, which pnpm needs for the one new dependency, and 67 are the new test. The source change is about 358 lines.Related: #9621 takes the same feature much wider — chat, plans, and file previews as well. This one is deliberately limited to the GitHub panel, where GitHub's rendering already sets the expectation, and stays around 250 lines.
UI Changes
Rendering this pull request's own body in the panel, light and dark.
Before
After
The
<>button in the block's toolbar returns to the source view shown above; the wrap toggle only appears there, since line wrapping cannot affect an SVG.Checklist
Verified with focused tests for the render cache, concurrent dedupe, per-theme reconfigure, and failure recovery, plus the existing markdown suites; lint, format, and typecheck clean on the changed files.
Model: Claude Opus 5. Harness: Claude Code, driven from T3 Code.
🤖 Generated with Claude Code
Note
Render
mermaiddiagrams in pull request bodiesmermaidpackage and amermaidDiagramsflag toChatMarkdown, enabled byPullRequestMarkdown.mermaidfences withMarkdownMermaidBlock, which provides a toggle to view highlighted source.MarkdownCodeBlockaccepts optionalactionsandshowWrapToggleprops; existing callers retain default behavior.Macroscope summarized 378d286.
Summary by CodeRabbit
New Features
Documentation