Skip to content

Mermaid post-slice-4 polish: silent-misparse fixes + flowchart doc-parity gaps #32

Closed

Description

@jjbaumert

Follow-up batch from the four-slice mermaid project (PRs #4, #17, #26, #31) — the whole-branch reviews' deferred items plus a doc-parity gap analysis against https://mermaid.ai/open-source/syntax/flowchart.html, confirmed by executing every doc example through our renderer (crates/mermaid/examples/doc_gallery.rs, committed on main).

Fix first — silent divergences ✅ DONE in #44

  1. Circle/cross edge-ends parse as phantom nodes — terminators now bind to the edge (A--oB = circle-ended edge to B, matching mermaid's documented rule).
  2. Edges to subgraph ids create phantom nodes — now a loud error naming the subgraph. Actual cluster-boundary edge routing remains deferred (below).

Cheap doc-parity adds ✅ DONE in #44

Subroutine [[…]]; multi-length arrows; invisible ~~~; bidirectional <--> / o--o / x--x; no-space label spellings; YAML front-matter skip (error lines preserved); classDef default auto-apply. Also fixed en route: quote-aware ; statement splitting (the docs' A["This is a #35; test"] example errored mid-quote) and -.-/=== no longer render a phantom arrowhead.

Deferred items (the remaining work; per-slice details in the worktree ledgers)

Flowchart / structural

  • Actual edge-to-subgraph routing (edge attaches to the cluster box; today it errors loudly).
  • Flowchart-onto-boxgraph unification — also the natural moment for the two state items below marked (†).

State: (†) ;-in-transition-label truncation; (†) header can't chain same-line statements; notes can target synthetic __start_N ids; composite/node collision guards untested.

Class: same-line class A { } errors; multiplicity labels sit on opposite sides of an edge; 14px multiplicity offset overshoots short segments; classDef default merge semantics — we apply default wholesale to unclassed nodes only, mermaid merges default's properties per-property under explicit classes (cosmetic; flowchart side, filed from the #44 review).

ER: blank-line-in-block permissiveness (confirm intent); doubled validate_id; ragged per-row key column.

Sequence (slice-3 backlog): Note over A,B,C drops the third participant; <br/> in participant displays/edge labels measured multi-line but rendered literal; self-message text reservation 4px tight; props soup lacks actor/cross/async lines.

Lib: DiagramKind::label() has zero callers (public-API removal decision).

Deliberate non-goals (do not "fix")

HTML in labels stays escaped (mermaid renders it; we never will for untrusted docs); markdown strings, FontAwesome, entity-code decoding, @{ shape: … } expanded shapes, icon/image nodes, edge ids/animations, click/linkStyle/style remain out of scope with loud errors.

Parity matrix

Post-#44 (executed 2026-07-11): 54 of 62 doc examples render, 8 error loudly, 0 silent divergences. Full per-example table in crates/mermaid/examples/doc_gallery.rs (cargo run -p ogrenotes-mermaid --example doc_gallery). Every remaining error case is in the non-goals list or the deferred list above.

Activity

  1. jjbaumert commented on Jul 11, 2026

    @jjbaumert
    OwnerAuthor

    Polish branch note for the deferred list (from the whole-branch review): our classDef default auto-apply gives explicitly-classed nodes none of default's properties (first-matching-class-wins-wholesale), while real mermaid merges default's properties per-property under the explicit class. Spec-literal and cosmetic-only; defer with the other styling nuances.

    Also fixed en route (beyond the filed highlights): quote-unaware ; statement splitting truncated quoted labels containing semicolons — the docs' own entity-code example A["This is a #35; test"] errored. Found by the committed doc gallery, fixed on the polish branch.

  2. jjbaumert commented on Jul 11, 2026

    @jjbaumert
    OwnerAuthor

    Reopened: PR #44's title contained "closes #32" which GitHub treated as a closing keyword on merge. #44 completed the fix-first + cheap-adds sections; this issue stays open as the deferred list (see updated body).

  3. jjbaumert commented on Jul 12, 2026

    @jjbaumert
    OwnerAuthor

    State-polish branch note: the deferred item "state ;-in-transition-label truncation" is FIXED (superseded) — the state parser's ; splitting is now label-aware (once a : label starts, ; stays in the label to end of line, matching mermaid). Remaining on this item: nothing for state; the boxgraph-unification pairing now only concerns the header same-line-chaining asymmetry.

  4. jjbaumert commented on Sep 30, 2026

    @jjbaumert
    OwnerAuthor

    A review of the Mermaid support (2026-09-29) found these items from this issue's deferred list are now fixed on main:

    Still open from this list:

    • the state header can't be followed by statements on the same line;
    • the class multiplicity placement items;
    • the ER items;
    • edge-to-subgraph routing and flowchart→boxgraph unification;
    • classDef default being merged wholesale.

    New findings from the review are filed separately as #274–#289, which don't duplicate anything here.


    Generated by Claude Code


    Generated by Claude Code

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions