Repository navigation
fix(app): mermaid flowcharts with subgraphs, shapes and line breaks draw as written - #109
Merged
Merged
Conversation
…nd diffs A mermaid block with a flowchart draws as the artifact view's diagram (now a shared FlowchartSvg), with Source in the frame's head; other Mermaid stays highlighted source with a quiet note. A diff or patch block draws with the chat's diff renderer: files named and numbered, bare +/- lines without numbers. Drafts stay text until they land, and anything that can't draw stays as it was. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…raw as written
The flowchart reader now takes the syntax agents write: every common node
shape (and A@{ shape: … }), labels without their quotes, <br> as a line
break, #quot; and & codes decoded; every edge form with its label,
chains and a & b fan-outs; and subgraphs, nested, as titled tinted boxes.
Layout lays each subgraph out inside and places it as one block, honours
its direction as Mermaid does, and leaves a cycle's closing edge out of
layering so loops curve round the side. Charts without subgraphs are laid
out exactly as before.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
This branch was successfully deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This also lands #101 (Mermaid and diff blocks in replies), which never reached
main. #101 was retargeted onto #100's branch to stack them. #100 merged first, and this repo doesn't delete branches on merge, so GitHub didn't move #101 tomain. #101 then merged into the stalefeat/chat-callouts-refsbranch. Its commit is replayed here as its own commit (feat(app): mermaid flowcharts and diffs…), rebased on currentmain. Its changelog bullets moved from the shipped v0.3.20 to Unreleased.The fix. An agent's diagram of a physics step (below) drew badly with the app's own Mermaid renderer: stray
(["…"])and[/"…"/]around labels, a literal<br/>, quoted edge labels, and no subgraphs, soStepbecame a bare node.lib/art/mermaid.tsandcomponents/art/flowchart.tsxnow handle:(..)/([..])pill,[[..]]subroutine,[(..)]cylinder,((..))and(((..)))ellipses,>..]flag,{{..}}hexagon, both parallelograms and both trapezoids, plusA@{ shape: … }for about 35 names.{..}stays the tinted box (it was never a diamond).<br>variants become real lines (SVG<tspan>, and the node grows to fit), entities decoded, simple tags dropped. It's SVG text only, never HTML.-->,---,-.->,==>,===,-.-,--o,--x,<-->,~~~, labels in all four styles, chains (A --> B --> C) andA & B --> C & D. Also;, front matter and%%{init}%%.directioninside a subgraph is honoured as Mermaid does.{..}, multi-line edge labels,style/classDef/click.Proof: the agent's diagram from
cal, verbatim, in a chat reply.At the default 680px column it scrolls sideways: light · dark. Simple flowcharts are unchanged: the artifact map is pixel-identical before and after (light, dark).
Checks
tsc,typecheck:plugins,check:titles,check:csp,check:themes,pnpm build,npx tsc -p e2eand the docs build pass.pnpm test: 463 tests pass, including the newlib/art/mermaid.test.ts, 10 tests:&;e2e/code-blocks.spec.ts(now with the fixture),artifacts.spec.tsandmath.spec.tspass: 14 tests, on a fresh build.Open questions
Step → Accloop brushes the top-right of theDetectbox. It's readable; better edge routing would be a separate change.🤖 Generated with Claude Code