Skip to content

[pull] develop from mermaid-js:develop - #231

Merged
pull[bot] merged 10 commits into
code:developfrom
mermaid-js:develop
Sep 1, 2026
Merged

[pull] develop from mermaid-js:develop#231
pull[bot] merged 10 commits into
code:developfrom
mermaid-js:develop

Conversation

@pull

@pull pull Bot commented Sep 1, 2026

Copy link
Copy Markdown

See Commits and Changes for more details.


Created by pull[bot] (v2.0.0-alpha.4)

Can you help keep this open source service alive? 💖 Please sponsor : )

knsv and others added 10 commits August 24, 2026 16:04
The "Adding a New Diagram/Chart" page documented three steps while the
review checklist enforces around fifteen, and three of its instructions
had gone stale: styles are no longer wired up by hand in a themes object,
detection no longer lives in detectType.ts, and commonDb moved under
diagrams/common. Rewrite it as a sequenced build with usecase as the
reference implementation, and end with the checklist a reviewer applies,
so contributors can self-review against the same bar.

Add the Layout Maker's Guide next to it, covering the LayoutData
contract, the createCommonLayoutRenderer stages, validateLayout and the
0-1000 score, DDLT fixtures and the sweep, and the cases that actually
break layout engines. Both are listed under Contributing.
Layout maker's guide:

- Say what "your job is coordinates" means. You never touch the DOM; you
  are handed measured nodes and hand back a center per node and a
  polyline per edge, and everything downstream works from those numbers.
- Scope the output contract to `runLayoutCore`. The blanket "fill in
  these fields and nothing else" contradicted the guide's own pipeline,
  where `prepareLayout` is allowed to rebuild the graph before
  measurement.
- Add a "Layout space" section. Positions are centers, so the left edge
  is `x - width / 2`; libraries that report a top-left or bottom-left
  origin need converting in `runLayoutCore`. The plane has no fixed
  origin and coordinates need not be positive, since the renderer fits
  the bounding box into the viewBox.
- Answer the leaf-versus-group size question directly. Leaf `width` and
  `height` arrive measured and must not be recalculated; groups are the
  one place a size is yours to set.
- Add "Performance on large diagrams": the flowchart corpus under
  `e2e/platform/dev-diagrams/performance/`, how to run the dev-explorer
  profiler over it, how to read the phase table (`↳ ours` against `↳ lib`,
  and `huge3.mmd` being parse-dominated), why `baseline.json` is a shape
  to compare against rather than a threshold, and the algorithmic
  mistakes that actually cost time.
- Give the fixture-tree code block a language.

New diagram guide:

- Document both supported db lifecycles. Fourteen diagrams define `db` as
  a getter returning a new instance; the rest share one object whose
  `clear()` resets it. The guide asserted only the first, which is not
  what the reference implementation does.
- "hand-drawn" in prose, `handDrawn` for the config value.
…r-guides

docs: rewrite the diagram guide and add a layout maker's guide
ELK reserves a 12px ports-surrounding margin at both ends of a node side
before distributing edge anchors along it. On a side shorter than 24px —
a start/end state circle is 14px across — the usable span is negative and
ELK's clamping parks the anchor off-center, so the only edge in
'[*] --> [*]' attached 3px off the dot's center. No node-level option can
override this: the spacing is only read per hierarchy level.

Drop such anchors when applying routed sections and let the edge aim at
the node center instead; the border clip then lands it dead center, the
same way the dagre pipeline attaches edges. The check is side-specific so
fork/join bars keep their spread anchors along the long side.
Add a state+ELK snapshot fixture for the start/end centering case so the
rendered result is guarded by the visual suite, and a unit test pinning
the side-specific part of the anchor drop: a wide, thin fork/join bar
must keep two spread anchors instead of funnelling edges to its centre
(verified to fail when the side check is replaced with min(width,height)).

Also derive the portsSurrounding option string from the margin constant
so the two cannot drift apart, and document the border tolerance.
…ering

fix(elk): center edges attached to small nodes
@pull pull Bot locked and limited conversation to collaborators Sep 1, 2026
@pull pull Bot added the ⤵️ pull label Sep 1, 2026
@pull
pull Bot merged commit e36ef27 into code:develop Sep 1, 2026
11 of 12 checks passed
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants