Skip to content

feat(sankey): add Apple-style rendering with smart labels and custom node colors#7272

Merged
ashishjain0512 merged 15 commits into
mermaid-js:developfrom
xinbenlv:feature/sankey-apple-style-interactive
Apr 1, 2026
Merged

feat(sankey): add Apple-style rendering with smart labels and custom node colors#7272
ashishjain0512 merged 15 commits into
mermaid-js:developfrom
xinbenlv:feature/sankey-apple-style-interactive

Conversation

@xinbenlv

@xinbenlv xinbenlv commented Dec 29, 2025

Copy link
Copy Markdown
Contributor

📑 Summary

This PR adds Apple-style rendering enhancements to Sankey diagrams, including smart label positioning, outlined labels, and custom node colors.

Resolves #6129 - Sankey improvements: Let user specify node and path color

Related to #6290 - This PR provides an alternative/extended implementation with additional features beyond custom colors.

✨ New Features

1. Custom Node Colors (nodeColors)

Allows specifying colors for individual nodes via frontmatter config:

---
config:
  sankey:
    nodeColors:
      Revenue: "#424245"
      Profit: "#34c759"
      Expenses: "#ff3b30"
---
sankey
source,Revenue,100
Revenue,Profit,60
Revenue,Expenses,40

2. Outlined Labels (labelStyle: 'default')

New default label style with white stroke background for better readability on dark backgrounds.

To use the original plain text labels, set labelStyle: 'legacy'.

3. Smart Label Positioning

Labels automatically position based on node layer relative to the central node (node with maximum value):

  • Nodes left of center → labels on left (right-aligned)
  • Nodes right of center → labels on right (left-aligned)

4. Configurable Layout

New options:

  • nodeWidth: Width of node rectangles (default: 10)
  • nodePadding: Padding between nodes (default: 12)

📏 Design Decisions

  • nodeColors vs colors: Used nodeColors (object mapping node ID → color) for clarity. Nodes not specified fall back to default D3 color scheme.
  • labelStyle enum: 'default' = outlined labels (new), 'legacy' = plain text labels (original). No breaking change since 'default' is now the default.
  • Smart label positioning: Inspired by Apple's financial flow diagrams - labels don't overlap with nodes and flows.
  • Backward compatible: Existing diagrams render with the new outlined style automatically.

📋 Tasks

  • 📖 have read the contribution guidelines
  • 💻 have added necessary unit/e2e tests.
  • 📓 have added documentation.
  • 🦋 generate changeset

Energy Demo

Before
energy-flow-before

After
energy-flow-after

Apple Finance

Before
image

After
sankey-after

@changeset-bot

changeset-bot Bot commented Dec 29, 2025

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: 0660f07

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 1 package
Name Type
mermaid Minor

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@netlify

netlify Bot commented Dec 29, 2025

Copy link
Copy Markdown

Deploy Preview for mermaid-js ready!

Name Link
🔨 Latest commit 0660f07
🔍 Latest deploy log https://app.netlify.com/projects/mermaid-js/deploys/69cd0f33673d630008cd04d1
😎 Deploy Preview https://deploy-preview-7272--mermaid-js.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify project configuration.

@github-actions github-actions Bot added the Type: Enhancement New feature or request label Dec 29, 2025
@pkg-pr-new

pkg-pr-new Bot commented Dec 29, 2025

Copy link
Copy Markdown

Open in StackBlitz

@mermaid-js/examples

npm i https://pkg.pr.new/@mermaid-js/examples@7272

mermaid

npm i https://pkg.pr.new/mermaid@7272

@mermaid-js/layout-elk

npm i https://pkg.pr.new/@mermaid-js/layout-elk@7272

@mermaid-js/layout-tidy-tree

npm i https://pkg.pr.new/@mermaid-js/layout-tidy-tree@7272

@mermaid-js/mermaid-zenuml

npm i https://pkg.pr.new/@mermaid-js/mermaid-zenuml@7272

@mermaid-js/parser

npm i https://pkg.pr.new/@mermaid-js/parser@7272

@mermaid-js/tiny

npm i https://pkg.pr.new/@mermaid-js/tiny@7272

commit: 0660f07

@codecov

codecov Bot commented Dec 29, 2025

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 3.03030% with 96 lines in your changes missing coverage. Please review.
✅ Project coverage is 3.34%. Comparing base (f52a239) to head (0660f07).
⚠️ Report is 18 commits behind head on develop.

Files with missing lines Patch % Lines
...ages/mermaid/src/diagrams/sankey/sankeyRenderer.ts 0.00% 57 Missing ⚠️
packages/mermaid/src/diagrams/sankey/styles.js 0.00% 27 Missing ⚠️
packages/mermaid/src/utils/sanitizeDirective.ts 0.00% 12 Missing ⚠️
Additional details and impacted files

Impacted file tree graph

@@           Coverage Diff           @@
##           develop   #7272   +/-   ##
=======================================
  Coverage     3.34%   3.34%           
=======================================
  Files          525     524    -1     
  Lines        55320   55385   +65     
  Branches       795     795           
=======================================
+ Hits          1850    1853    +3     
- Misses       53470   53532   +62     
Flag Coverage Δ
unit 3.34% <3.03%> (+<0.01%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

Files with missing lines Coverage Δ
packages/mermaid/src/config.type.ts 100.00% <ø> (ø)
packages/mermaid/src/defaultConfig.ts 43.43% <100.00%> (+0.77%) ⬆️
packages/mermaid/src/utils/sanitizeDirective.ts 5.33% <0.00%> (-0.83%) ⬇️
packages/mermaid/src/diagrams/sankey/styles.js 0.00% <0.00%> (ø)
...ages/mermaid/src/diagrams/sankey/sankeyRenderer.ts 0.58% <0.00%> (-0.17%) ⬇️

... and 1 file with indirect coverage changes

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@argos-ci

argos-ci Bot commented Dec 29, 2025

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Argos notifications ↗︎

Build Status Details Updated (UTC)
default (Inspect) 👍 Changes approved 5 changed, 9 added Apr 1, 2026, 12:40 PM

@xinbenlv

Copy link
Copy Markdown
Contributor Author

Dear authors, just friendly ping to see if this PR is something you would cojnsider?

1 similar comment
@xinbenlv

Copy link
Copy Markdown
Contributor Author

Dear authors, just friendly ping to see if this PR is something you would cojnsider?

@ashishjain0512 ashishjain0512 self-assigned this Jan 28, 2026
@ashishjain0512

Copy link
Copy Markdown
Collaborator

Hey @xinbenlv

Thanks for this contribution. We will review this PR soon.

@xinbenlv

xinbenlv commented Feb 6, 2026

Copy link
Copy Markdown
Contributor Author

Thank you @ashishjain0512

@xinbenlv

Copy link
Copy Markdown
Contributor Author

Hi team, look forward to your early feedback. let me know if there is anything I can help make the review easier

@knsv knsv left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done together with Claude Code.

Thanks for this contribution, @xinbenlv — the Apple-style financial flow rendering looks excellent, and the before/after screenshots really sell the value of these enhancements. Apologies that this has been waiting for review since late December; let's work through the feedback and get this across the finish line.


What's working well

🎉 [praise] The e2e test coverage is thorough — tests for label styles, node width/padding, custom colors with fallback, and the full financial flow demo. This is exactly the kind of coverage Sankey diagrams need.

🎉 [praise] Using config.schema.yaml as the source of truth for new config options is the correct approach. The schema additions for nodeWidth, nodePadding, labelStyle, and nodeColors are well-structured.

🎉 [praise] Before/after screenshots for both energy flow and Apple finance diagrams are very helpful for reviewers. Thank you for including these.

🎉 [praise] The getNodeColor abstraction cleanly separates custom colors from the default D3 color scheme, with a natural fallback.


Things to address

🔴 [blocking] Schema damage — SankeyLinkColor definition truncated

config.schema.yaml: The patch accidentally removes two lines from the existing SankeyLinkColor definition when inserting the new SankeyLabelStyle block:

  • gradient: Use a gradient of the source and target for the color of the link. (from meta:enum)
  • default: gradient

These are essential to the existing Sankey link coloring behavior. The SankeyLabelStyle definition needs to be inserted after the complete SankeyLinkColor block, not in place of its last two lines. Please restore the deleted lines.

🔴 [blocking] Security concern — sanitizeDirective.ts bypass

sanitizeDirective.ts:38-39: The hardcoded dictionaryConfigKeys allowlist skips recursive sanitization for nodeColors, meaning arbitrary user-provided strings bypass the theme variable character whitelist. While color values may seem benign, this creates a precedent where future dictionary configs could silently skip sanitization.

A safer approach would be to either:

  1. Validate that each value in nodeColors matches a CSS color pattern (e.g., /^#[0-9a-fA-F]{3,8}$|^rgb/) before accepting it
  2. Or run the existing sanitization on the values while skipping the key validation (since the keys are user-defined node IDs)

This is shared infrastructure — changes here affect all diagram types, so it's worth getting the pattern right.

🔴 [blocking] Default rendering output change — potentially breaking

The PR changes two aspects of default rendering for all existing Sankey diagrams:

  1. Label style: labelStyle defaults to 'default' (outlined labels with two text elements). All existing diagrams now render with stroke-outlined labels instead of plain text.
  2. Label positioning: Changed from position-based (d.x0 < width / 2) to layer-based (relative to the max-value "central" node). This repositions labels on existing diagrams.

Per project conventions, "changing default rendering output in ways visible to consumers" is considered potentially breaking — Mermaid is rendered server-side by GitHub/GitLab, so this would affect existing documents. It would be great to consider:

  • Defaulting labelStyle to 'legacy' so existing diagrams are unaffected, and users opt-in to the new style
  • Or treating this as a minor bump with clear migration notes in the changeset

🟡 [important] Hardcoded colors in styles.js — theme support

styles.js: The new styles use hardcoded colors that won't adapt to dark/forest/neutral themes:

  • stroke: rgba(255, 255, 255, 0.9) — white background stroke will be invisible on light-themed backgrounds, and incorrect on dark theme
  • fill: ${options.textColor || '#1d1d1f'} — the #1d1d1f fallback is a dark color that won't work on dark theme

Worth using theme variables throughout (e.g., options.mainBkg or options.background for stroke, options.textColor without a hardcoded fallback). You can reference existing diagrams like journey/styles.js for the pattern.

🟡 [important] Missing changeset

The PR checklist notes this isn't done yet. This is a feature-level change that needs pnpm changeset → select @mermaid-js/mermaidminor bump → feat: prefixed description.

🟡 [important] Missing documentation

New config options (nodeColors, labelStyle, nodeWidth, nodePadding) need documentation in packages/mermaid/src/docs/. New feature docs should use the MERMAID_RELEASE_VERSION placeholder for version references.

🟡 [important] defaultConfig.ts — unusual pattern for nodeColors

defaultConfig.ts:268: Setting nodeColors: undefined with the comment "allows it through sanitizeDirective" couples the default config to sanitization behavior in a non-obvious way. If the sanitization approach is revised per the security concern above, this coupling may no longer be needed. Worth revisiting after addressing the sanitizeDirective.ts feedback.

🟢 [nit] Type safety in findCentralNodeLayer

sankeyRenderer.ts:36: The function accepts any[] — since the d3-sankey typings are available, it would be nice to use the actual node type for better safety, though I understand d3-sankey's types can be tricky.

🟢 [nit] Duplicated D3 chains in label rendering

sankeyRenderer.ts:197-236: The three label rendering branches (bg, fg, legacy) share nearly identical D3 chain calls. A small helper to build the common chain could reduce the duplication.


Out of scope (pre-existing)

Noticed while reading: sankeyRenderer.ts line 64 appears to use defaultSankeyConfig.width! as the fallback for height, which looks like a pre-existing bug. Not related to this PR, but worth a separate fix.


Looking forward to your updates — the core feature set here is really valuable for Sankey users. 🙌

@xinbenlv

xinbenlv commented Feb 24, 2026

Copy link
Copy Markdown
Contributor Author

Thank you @knsv for your review and encouragement. I will address these comments accordingly soon.

@knsv knsv mentioned this pull request Feb 27, 2026
4 tasks
@xinbenlv

Copy link
Copy Markdown
Contributor Author

Thank you @knsv, @ashishjain0512 . I've updated the PR,
All tests passes except for the only pending one is failing in argo for visual regressions. I personally inspected and it seems as expected - yes we are introducing new visual. Could you take a look and see if this is ready to be merged? Thx!
Or let me know if there is any change needed from me.

@ashishjain0512

Copy link
Copy Markdown
Collaborator

Great job @xinbenlv !
I have reviewed the argos and approved the build.

Just fix these conflicts, and we'll be happy to merge for the next release.

@ashishjain0512 ashishjain0512 self-requested a review March 17, 2026 12:57
@github-actions

Copy link
Copy Markdown
Contributor

Lockfile Validation Failed

The following issue(s) were detected:

Please address these and push an update.

Posted automatically by GitHub Actions

@xinbenlv xinbenlv force-pushed the feature/sankey-apple-style-interactive branch from ac34cf1 to ca80ff5 Compare March 20, 2026 22:17
@xinbenlv

Copy link
Copy Markdown
Contributor Author

@knsv Thank you for the thorough review! Here's how each item has been addressed:


🔴 Blocking Items

1. Schema damage — SankeyLinkColor definition truncated
Resolved. The SankeyLinkColor definition in config.schema.yaml is now complete with all three enum values (source, target, gradient), full meta:enum descriptions, and default: gradient.

2. Security concern — sanitizeDirective.ts bypass
Resolved. Replaced the dictionaryConfigKeys allowlist approach with CSS color pattern validation. nodeColors values are now validated against /^#[\da-f]{3,8}$|^rgb\([\d\s%,.]+\)$|^hsl\([\d\s%,.]+\)$|^[a-z]+$/i — invalid values are rejected and logged. No more bypassing recursive sanitization.

3. Default rendering output change — potentially breaking
Resolved. labelStyle now defaults to legacy, preserving existing Sankey diagram rendering. Users must explicitly opt-in to outlined style. Set in both config.schema.yaml and the renderer fallback.


🟡 Important Items

4. Hardcoded colors in styles.js — theme support
Resolved. Replaced hardcoded colors with theme variables: ${options.mainBkg || options.background || '#fff'} for stroke background and ${options.textColor} for label fill. Only a #fff fallback remains when no theme variable is available.

5. Missing changeset
Resolved. Added .changeset/sankey-apple-style.md with 'mermaid': minor bump and feat: prefixed description.

6. Missing documentation
Resolved. Added documentation to packages/mermaid/src/docs/syntax/sankey.md covering all new config options with examples:

  • labelStylelegacy (default) vs outlined
  • nodeWidth — node rectangle width in pixels (default: 10)
  • nodePadding — vertical padding between nodes (default: 12)
  • nodeColors — custom color map with CSS color validation

All use the MERMAID_RELEASE_VERSION placeholder for version references.

7. defaultConfig.tsnodeColors: undefined
Acceptable. nodeColors: undefined remains so that configKeys includes the key for sanitizeDirective — but since the sanitization approach was revised (item 2), this coupling is now safe: values are validated by CSS color regex, not skipped.


🟢 Nits

8. Type safety in findCentralNodeLayer
Resolved. Replaced any[] with a proper SankeyNodeWithLayer interface that extends d3SankeyNode<{ id: string }, Record<string, unknown>> with an optional layer property (computed at runtime by d3-sankey but not in the type definitions).

9. Duplicated D3 chains in label rendering
Resolved. Extracted a shared appendLabel(className?) helper that builds the common D3 chain (.selectAll(), .data(), .join(), .attr(), .text()). The outlined/legacy branches now call this helper instead of duplicating the chain.


All feedback has been addressed. Ready for re-review when you have a chance!

@xinbenlv xinbenlv requested a review from knsv March 21, 2026 00:14
@xinbenlv

Copy link
Copy Markdown
Contributor Author

Everything passes except for visual regression tests that needs decision from maintainer

@xinbenlv

Copy link
Copy Markdown
Contributor Author

Friendly ping @knsv and @ashishjain0512 if anything left

1 similar comment
@xinbenlv

Copy link
Copy Markdown
Contributor Author

Friendly ping @knsv and @ashishjain0512 if anything left

- Implement collapsible nodes with recursive pruning
- Auto-zoom layout to fill canvas when nodes are hidden
- Strict CSV order sorting for stable node positions
- Target-based link coloring with transparency and blend mode
- Smart indicator icons (only shown when collapsed)
- Smooth fade animations for enter/exit transitions
- Add precomputed topology to identify central node (max flow)
- Central node (Revenue) can collapse both left and right sides
- Other nodes can only collapse their children direction
- Auto-zoom: remaining nodes expand to fill canvas after collapse
- Collapse animation: nodes shrink towards anchor, expand from anchor
- Central node is 1.5x wider for visual emphasis
- Indicators show collapse state with directional arrows
…node colors

- Add smart label positioning based on node layer relative to central node
- Add outlined label style (labelStyle: 'outlined') as new default
- Add nodeColors config option for custom node color mapping
- Add configurable nodeWidth and nodePadding options
- Update styles.js with new CSS for outlined labels
- Fix YAML frontmatter indentation in demos/sankey.html
- Add Cypress tests for new features

BREAKING CHANGE: labelStyle now defaults to 'outlined' instead of 'default'
autofix-ci Bot and others added 10 commits March 29, 2026 03:38
- Rename labelStyle 'outlined' to 'default' (new default behavior)
- Rename labelStyle 'default' to 'legacy' (original behavior)
- Remove demo-sankey.html (demonstration file only)
- Update tests, demo, and renderer for new naming
…ocs build

The curly braces in the YAML description were being parsed as Vue template
syntax, causing a 'Duplicate attribute' error during vitepress docs build.
- Restore SankeyLinkColor gradient meta:enum and default that were accidentally deleted
- Rename labelStyle 'default' to 'outlined', default to 'legacy' (non-breaking)
- Restore original position-based label positioning for legacy mode
- Validate nodeColors values as CSS colors in sanitizeDirective
- Use theme variables instead of hardcoded colors in styles.js
- Add changeset
… options

- Improve type safety: use SankeyNodeWithLayer interface for findCentralNodeLayer
- Reduce code duplication: extract appendLabel helper for D3 label chains
- Add documentation for labelStyle, nodeWidth, nodePadding, and nodeColors
d3SankeyNode.value is number | undefined - add nullish coalescing to fix TS errors.
@xinbenlv xinbenlv force-pushed the feature/sankey-apple-style-interactive branch from c3edf11 to ff155b1 Compare March 29, 2026 10:38
@xinbenlv

Copy link
Copy Markdown
Contributor Author

Rebased onto latest develop and resolved all conflicts. Tests should be green — ready for re-review! 🙏

@ashishjain0512 ashishjain0512 added this pull request to the merge queue Apr 1, 2026
Merged via the queue into mermaid-js:develop with commit e7667c5 Apr 1, 2026
23 checks passed
@mermaid-bot

mermaid-bot Bot commented Apr 1, 2026

Copy link
Copy Markdown

@xinbenlv, Thank you for the contribution!
You are now eligible for a year of Premium account on MermaidChart.
Sign up with your GitHub account to activate.

@github-actions github-actions Bot mentioned this pull request May 11, 2026
nschloe pushed a commit to live-clones/forgejo that referenced this pull request May 12, 2026
…531)

This PR contains the following updates:

| Package | Change | [Age](https://docs.renovatebot.com/merge-confidence/) | [Confidence](https://docs.renovatebot.com/merge-confidence/) |
|---|---|---|---|
| [mermaid](https://github.com/mermaid-js/mermaid) | [`11.13.0` → `11.15.0`](https://renovatebot.com/diffs/npm/mermaid/11.13.0/11.15.0) | ![age](https://developer.mend.io/api/mc/badges/age/npm/mermaid/11.15.0?slim=true) | ![confidence](https://developer.mend.io/api/mc/badges/confidence/npm/mermaid/11.13.0/11.15.0?slim=true) |

---

### Mermaid Gantt Charts are vulnerable to an Infinite Loop DoS
[CVE-2026-41150](https://nvd.nist.gov/vuln/detail/CVE-2026-41150) / [GHSA-6m6c-36f7-fhxh](GHSA-6m6c-36f7-fhxh)

<details>
<summary>More information</summary>

#### Details
##### Impact

Mermaid v11.14.0 and earlier are vulnerable to a denial-of-service attack when rendering gantt charts, if they use the [`excludes` attribute](https://mermaid.js.org/syntax/gantt.html?#excludes) to exclude all dates.

Example:

```
gantt
  excludes monday,tuesday,wednesday,thursday,friday,saturday,sunday
  DoS :2025-01-01, 1d
```

`mermaid.parse` is unaffected, unless you then call the `ganttDb.getTasks()` (which is called when rendering a diagram).

##### Patches

This has been patched in:

- [v11.15.0](https://github.com/mermaid-js/mermaid/releases/tag/mermaid%4011.15.0) (see [faafb5d49106dd32c367f3882505f2dd625aa30e](mermaid-js/mermaid@faafb5d))
- [v10.9.6](https://github.com/mermaid-js/mermaid/releases/tag/v10.9.6) (see [a59ea56174712ee5430dfd5bc877cb5151f501a6](mermaid-js/mermaid@a59ea56))

##### Workarounds

There are no workarounds available without updating to a newer version of mermaid.

#### Severity
- CVSS Score: 5.3 / 10 (Medium)
- Vector String: `CVSS:4.0/AV:N/AC:L/AT:N/PR:N/UI:P/VC:N/VI:N/VA:L/SC:N/SI:N/SA:L`

#### References
- [https://github.com/mermaid-js/mermaid/security/advisories/GHSA-6m6c-36f7-fhxh](https://github.com/mermaid-js/mermaid/security/advisories/GHSA-6m6c-36f7-fhxh)
- [https://github.com/mermaid-js/mermaid/commit/a59ea56174712ee5430dfd5bc877cb5151f501a6](https://github.com/mermaid-js/mermaid/commit/a59ea56174712ee5430dfd5bc877cb5151f501a6)
- [https://github.com/mermaid-js/mermaid/commit/faafb5d49106dd32c367f3882505f2dd625aa30e](https://github.com/mermaid-js/mermaid/commit/faafb5d49106dd32c367f3882505f2dd625aa30e)
- [https://github.com/mermaid-js/mermaid](https://github.com/mermaid-js/mermaid)
- [https://github.com/mermaid-js/mermaid/releases/tag/mermaid%4011.15.0](https://github.com/mermaid-js/mermaid/releases/tag/mermaid%4011.15.0)
- [https://github.com/mermaid-js/mermaid/releases/tag/v10.9.6](https://github.com/mermaid-js/mermaid/releases/tag/v10.9.6)

This data is provided by [OSV](https://osv.dev/vulnerability/GHSA-6m6c-36f7-fhxh) and the [GitHub Advisory Database](https://github.com/github/advisory-database) ([CC-BY 4.0](https://github.com/github/advisory-database/blob/main/LICENSE.md)).
</details>

---

### Mermaid: Improper sanitization of configuration leads to CSS injection
[CVE-2026-41159](https://nvd.nist.gov/vuln/detail/CVE-2026-41159) / [GHSA-87f9-hvmw-gh4p](GHSA-87f9-hvmw-gh4p)

<details>
<summary>More information</summary>

#### Details
##### Impact

Mermaid's default configuration allows injecting CSS that applies outside of the Mermaid diagram via the `fontFamily`, `themeCSS`, and `altFontFamily` configuration options.

Live demo: [mermaid.live](https://mermaid.live/edit#pako:eNpNjktLxDAUhf9KvFBR6JS-60QQfODKlUvJ5k6TtsEmKTHFGUP-u-mI6Nmdy3fOPR56wwVQSBIvtXSUeAaD0e4ZlZxPDChhcLxFfwiEauOuLq_9Afv30ZpVczpaITS5kGox1qF2gfSeBwYhJAnThAyz-ewntI68vG5-0z3Z7e7IA9OQwmglB-rsKlJQwircLPgNZeAmocTPAi4GXGfHgOkQYwvqN2PUbzJuGSegA84f0a0LRyeeJI4W_xChubCPcbQD2pwbgHo4Aq2aKmvbqq3zoiu7pizqFE6RybN9VFfFY1HWXRVS-Dr_zLObrt7_V_gGGXZlGg)

Example code:

```
%%{init: {"fontFamily": "x;a{b} :not(&){background:green !important} c{d}"}}%%
flowchart LR
    A --> B
```

The injected CSS exploits stylis's `&` (scope reference) handling. `:not(&)` escapes the `#mermaid-xxx` automatic scoping, applying styles to all page elements. Global at-rules (`@font-face`, `@keyframes`, `@counter-style`) are also injectable as stylis hoists them to top level.

This allows page defacement and DOM attribute exfiltration via CSS `:has()` selectors.

##### Patches

- [v11.15.0](https://github.com/mermaid-js/mermaid/releases/tag/mermaid%4011.15.0) (see [64769738d5b59211e1decb471ffbaca8afec51aa](mermaid-js/mermaid@6476973))
- [v10.9.6](https://github.com/mermaid-js/mermaid/releases/tag/v10.9.6) (see [a9d9f0d8eb790349121508688cd338253fd80d76](mermaid-js/mermaid@a9d9f0d))

##### Workarounds

If you can't upgrade mermaid, you can set the [`secure`](https://mermaid.js.org/config/schema-docs/config.html#secure) config value in the mermaid config to avoid allowing diagrams to modify `fontFamily`, `themeCSS`, `altFontFamily`, and `themeVariables`.

Setting [`"securityLevel": "sandbox"`](https://mermaid.js.org/config/schema-docs/config.html#securitylevel)  will also prevent this.

##### Credits

Reported by @&#8203;zsxsoft on behalf of @&#8203;KeenSecurityLab

#### Severity
- CVSS Score: 5.3 / 10 (Medium)
- Vector String: `CVSS:4.0/AV:N/AC:L/AT:N/PR:N/UI:P/VC:N/VI:L/VA:N/SC:L/SI:L/SA:L`

#### References
- [https://github.com/mermaid-js/mermaid/security/advisories/GHSA-87f9-hvmw-gh4p](https://github.com/mermaid-js/mermaid/security/advisories/GHSA-87f9-hvmw-gh4p)
- [https://github.com/mermaid-js/mermaid/commit/64769738d5b59211e1decb471ffbaca8afec51aa](https://github.com/mermaid-js/mermaid/commit/64769738d5b59211e1decb471ffbaca8afec51aa)
- [https://github.com/mermaid-js/mermaid/commit/a9d9f0d8eb790349121508688cd338253fd80d76](https://github.com/mermaid-js/mermaid/commit/a9d9f0d8eb790349121508688cd338253fd80d76)
- [https://github.com/mermaid-js/mermaid](https://github.com/mermaid-js/mermaid)
- [https://github.com/mermaid-js/mermaid/releases/tag/mermaid%4011.15.0](https://github.com/mermaid-js/mermaid/releases/tag/mermaid%4011.15.0)
- [https://github.com/mermaid-js/mermaid/releases/tag/v10.9.6](https://github.com/mermaid-js/mermaid/releases/tag/v10.9.6)

This data is provided by [OSV](https://osv.dev/vulnerability/GHSA-87f9-hvmw-gh4p) and the [GitHub Advisory Database](https://github.com/github/advisory-database) ([CC-BY 4.0](https://github.com/github/advisory-database/blob/main/LICENSE.md)).
</details>

---

### Mermaid: Improper sanitization of `classDef` in state diagrams leads to HTML injection
[CVE-2026-41149](https://nvd.nist.gov/vuln/detail/CVE-2026-41149) / [GHSA-ghcm-xqfw-q4vr](GHSA-ghcm-xqfw-q4vr)

<details>
<summary>More information</summary>

#### Details
##### Impact

Under the default configuration, Mermaid state diagram's `classDef` allow DOM injection that escapes the SVG, although `<script>` tags are removed, preventing XSS.

##### Proof-of-concept

```
stateDiagram-v2
  classDef xss fill:red</style></svg><style>*{x:x;y:y;overflow:visible!important;contain:none!important;transform:none!important;filter:none!important;clip-path:none!important}</style><div style="x:x;y:y;color:red;font:5em/1 monospace;display:grid;place-items:center;z-index:2147483647;width:100vw;height:100vh;position:fixed;top:0;left:0;background:black">HACKED</div><svg><style>a:b
  [*] --> A:::xss
```

##### Patches

- [v11.15.0](https://github.com/mermaid-js/mermaid/releases/tag/mermaid%4011.15.0) (see [37ff937f1da2e19f882fd1db01235db4d01f4056](mermaid-js/mermaid@37ff937))
- [v10.9.6](https://github.com/mermaid-js/mermaid/releases/tag/v10.9.6) (see [4e2d512bf5bf6f9de1a8f0a48da78dc4d09ac4f3](mermaid-js/mermaid@4e2d512))

##### Workarounds

If you can not update to a patched version, setting [`"securityLevel": "sandbox"`](https://mermaid.js.org/config/schema-docs/config.html#securitylevel)  will prevent this, by rendering the mermaid diagram in a sandboxed `<iframe>`.

##### Credits

Thanks to @&#8203;zsxsoft from @&#8203;KeenSecurityLab for reporting this vulnerability.

#### Severity
- CVSS Score: 5.3 / 10 (Medium)
- Vector String: `CVSS:4.0/AV:N/AC:L/AT:N/PR:N/UI:P/VC:N/VI:L/VA:N/SC:L/SI:L/SA:L`

#### References
- [https://github.com/mermaid-js/mermaid/security/advisories/GHSA-ghcm-xqfw-q4vr](https://github.com/mermaid-js/mermaid/security/advisories/GHSA-ghcm-xqfw-q4vr)
- [https://github.com/mermaid-js/mermaid/commit/37ff937f1da2e19f882fd1db01235db4d01f4056](https://github.com/mermaid-js/mermaid/commit/37ff937f1da2e19f882fd1db01235db4d01f4056)
- [https://github.com/mermaid-js/mermaid/commit/4e2d512bf5bf6f9de1a8f0a48da78dc4d09ac4f3](https://github.com/mermaid-js/mermaid/commit/4e2d512bf5bf6f9de1a8f0a48da78dc4d09ac4f3)
- [https://github.com/mermaid-js/mermaid](https://github.com/mermaid-js/mermaid)
- [https://github.com/mermaid-js/mermaid/releases/tag/mermaid%4011.15.0](https://github.com/mermaid-js/mermaid/releases/tag/mermaid%4011.15.0)
- [https://github.com/mermaid-js/mermaid/releases/tag/v10.9.6](https://github.com/mermaid-js/mermaid/releases/tag/v10.9.6)
- [https://mermaid.js.org/config/schema-docs/config.html#securitylevel](https://mermaid.js.org/config/schema-docs/config.html#securitylevel)

This data is provided by [OSV](https://osv.dev/vulnerability/GHSA-ghcm-xqfw-q4vr) and the [GitHub Advisory Database](https://github.com/github/advisory-database) ([CC-BY 4.0](https://github.com/github/advisory-database/blob/main/LICENSE.md)).
</details>

---

### Mermaid: Improper sanitization of `classDefs` in diagrams leads to CSS injection
[CVE-2026-41148](https://nvd.nist.gov/vuln/detail/CVE-2026-41148) / [GHSA-xcj9-5m2h-648r](GHSA-xcj9-5m2h-648r)

<details>
<summary>More information</summary>

#### Details
##### Details

The state diagram and any other diagram type that routes user-controlled style strings through createCssStyles parser for Mermaid v11.14.0 and earlier captures `classDef` values with an unrestricted regex:

```jison
// packages/mermaid/src/diagrams/state/parser/stateDiagram.jison:83
<CLASSDEFID>[^\n]*   { this.popState(); return 'CLASSDEF_STYLEOPTS' }
```

The value passes unsanitized through `addStyleClass()` -> `createCssStyles()` -> `style.innerHTML` (mermaidAPI.ts:418). A `}` in the value closes the generated CSS selector, and everything after becomes a new CSS rule on the page.

##### PoC

```
stateDiagram-v2
      classDef x }*{ background-image: url("http://media.giphy.com/media/SggILpMXO7Xt6/giphy.gif")}
```

Live demo:
<https://mermaid.live/edit#pako:eNpFjzFvgzAQhf-KdVNbEcBgMHhtlkqtOnSJKi8ONsYKBmRMlRTx3-skanvTfbp7996t0IxSAYPZC6_2Rmgn7O4rQ00v5nmvWnRG29OKjqI5aTcug9wZK7RiaHH9A4fO-4kliVXSiFibqbvEzWjvnHxo_fI6vR3e6cGXyX2qTcvhcYMItDMSmHeLisAqZ8UVYeUDQhx8p6ziwEIrhTtx4MNVM4nhcxztrywE0h2wVvRzoGWS_z_8rahBKvcckntgmN5OAFvhDIzUNCZZQXCR5nVaZkUEF2BVFpOcEkoxxhUuyRbB980yjStapKHqoKFlhvPtB7BFZEU>

##### Patches

This has been patched in:

- [v11.15.0](https://github.com/mermaid-js/mermaid/releases/tag/mermaid%4011.15.0) (see [e9b0f34d8d82a6260077764ee45e1d7d90957a0f](mermaid-js/mermaid@e9b0f34))
- [v10.9.6](https://github.com/mermaid-js/mermaid/releases/tag/v10.9.6) (see [8fead23c59166b7bab6a39eac81acebee2859102](mermaid-js/mermaid@8fead23))

##### Workarounds

Setting [`"securityLevel": "sandbox"`](https://mermaid.js.org/config/schema-docs/config.html#securitylevel)  will prevent this, by rendering the mermaid diagram in a sandboxed `<iframe>`.

##### Impact

 Enables page defacement, user tracking via `url()` callbacks, and DOM attribute exfiltration via CSS `:has()` selectors.

#### Severity
- CVSS Score: 5.3 / 10 (Medium)
- Vector String: `CVSS:4.0/AV:N/AC:L/AT:N/PR:N/UI:P/VC:N/VI:L/VA:N/SC:L/SI:L/SA:L`

#### References
- [https://github.com/mermaid-js/mermaid/security/advisories/GHSA-xcj9-5m2h-648r](https://github.com/mermaid-js/mermaid/security/advisories/GHSA-xcj9-5m2h-648r)
- [https://github.com/mermaid-js/mermaid/commit/8fead23c59166b7bab6a39eac81acebee2859102](https://github.com/mermaid-js/mermaid/commit/8fead23c59166b7bab6a39eac81acebee2859102)
- [https://github.com/mermaid-js/mermaid/commit/e9b0f34d8d82a6260077764ee45e1d7d90957a0f](https://github.com/mermaid-js/mermaid/commit/e9b0f34d8d82a6260077764ee45e1d7d90957a0f)
- [https://github.com/mermaid-js/mermaid](https://github.com/mermaid-js/mermaid)
- [https://github.com/mermaid-js/mermaid/releases/tag/mermaid%4011.15.0](https://github.com/mermaid-js/mermaid/releases/tag/mermaid%4011.15.0)
- [https://github.com/mermaid-js/mermaid/releases/tag/v10.9.6](https://github.com/mermaid-js/mermaid/releases/tag/v10.9.6)
- [https://mermaid.js.org/config/schema-docs/config.html#securitylevel](https://mermaid.js.org/config/schema-docs/config.html#securitylevel)

This data is provided by [OSV](https://osv.dev/vulnerability/GHSA-xcj9-5m2h-648r) and the [GitHub Advisory Database](https://github.com/github/advisory-database) ([CC-BY 4.0](https://github.com/github/advisory-database/blob/main/LICENSE.md)).
</details>

---

### Release Notes

<details>
<summary>mermaid-js/mermaid (mermaid)</summary>

### [`v11.15.0`](https://github.com/mermaid-js/mermaid/releases/tag/mermaid%4011.15.0)

[Compare Source](https://github.com/mermaid-js/mermaid/compare/mermaid@11.14.0...mermaid@11.15.0)

##### Minor Changes

- [#&#8203;7174](mermaid-js/mermaid#7174) [`0aca217`](mermaid-js/mermaid@0aca217) Thanks [@&#8203;milesspencer35](https://github.com/milesspencer35)! - feat(sequence): Add support for decimal start and increment values in the `autonumber` directive

- [#&#8203;7512](mermaid-js/mermaid#7512) [`8e17492`](mermaid-js/mermaid@8e17492) Thanks [@&#8203;aruncveli](https://github.com/aruncveli)! - feat(flowchart): add datastore shape

  In Data flow diagrams, a datastore/warehouse/file/database is used to represent data persistence. It is denoted by a rectangle with only top and bottom borders, and can be used in flowcharts with `A@{ shape: datastore, label: "Datastore" }`.

- [#&#8203;6440](mermaid-js/mermaid#6440) [`9ad8dde`](mermaid-js/mermaid@9ad8dde) Thanks [@&#8203;yordis](https://github.com/yordis), [@&#8203;lgazo](https://github.com/lgazo)! - feat: add Event Modeling diagram

- [#&#8203;7707](mermaid-js/mermaid#7707) [`27db774`](mermaid-js/mermaid@27db774) Thanks [@&#8203;txmxthy](https://github.com/txmxthy)! - feat(architecture): expose four fcose layout knobs for `architecture-beta` diagrams (`nodeSeparation`, `idealEdgeLengthMultiplier`, `edgeElasticity`, `numIter`) so authors can tune layout density and spread overlapping siblings without changing diagram source

- [#&#8203;7604](mermaid-js/mermaid#7604) [`bf9502f`](mermaid-js/mermaid@bf9502f) Thanks [@&#8203;M-a-c](https://github.com/M-a-c)! - feat(class): add nested namespace support for class diagrams via dot notation and syntactic nesting

  If you have namespaces in class diagrams that use `.`s already and want to render them without nesting (≤v11.14.0 behaviour), you can use set `class.hierarchicalNamespaces=false` in your mermaid config:

  ```yaml
  config:
    class:
      hierarchicalNamespaces: false
  ```

- [#&#8203;7272](mermaid-js/mermaid#7272) [`88cdd3d`](mermaid-js/mermaid@88cdd3d) Thanks [@&#8203;xinbenlv](https://github.com/xinbenlv)! - feat(sankey): add outlined label style, configurable nodeWidth/nodePadding, and custom node colors

##### Patch Changes

- [#&#8203;7737](mermaid-js/mermaid#7737) [`e9b0f34`](mermaid-js/mermaid@e9b0f34) Thanks [@&#8203;ashishjain0512](https://github.com/ashishjain0512)! - fix: prevent unbalanced CSS styles in classDefs

- [#&#8203;7737](mermaid-js/mermaid#7737) [`37ff937`](mermaid-js/mermaid@37ff937) Thanks [@&#8203;ashishjain0512](https://github.com/ashishjain0512)! - fix: create CSS styles using the CSSOM

  This removes some invalid CSS and normalizes some CSS formatting.

- [#&#8203;7508](mermaid-js/mermaid#7508) [`bfe60cc`](mermaid-js/mermaid@bfe60cc) Thanks [@&#8203;biiab](https://github.com/biiab)! - fix(stateDiagram): `end note` now only closes a note when used on a new line

- [#&#8203;7737](mermaid-js/mermaid#7737) [`faafb5d`](mermaid-js/mermaid@faafb5d) Thanks [@&#8203;ashishjain0512](https://github.com/ashishjain0512)! - fix(gantt): add iteration limit for `excludes` field

- [#&#8203;7737](mermaid-js/mermaid#7737) [`65f8be2`](mermaid-js/mermaid@65f8be2) Thanks [@&#8203;ashishjain0512](https://github.com/ashishjain0512)! - fix: disallow some CSS at-rules in custom CSS

- [#&#8203;7726](mermaid-js/mermaid#7726) [`1502f32`](mermaid-js/mermaid@1502f32) Thanks [@&#8203;aloisklink](https://github.com/aloisklink)! - fix(wardley): fix unnecessary sanitization of text

- [#&#8203;7578](mermaid-js/mermaid#7578) [`1f98db8`](mermaid-js/mermaid@1f98db8) Thanks [@&#8203;Gaston202](https://github.com/Gaston202)! - fix(class): self-referential class multiplicity labels no longer rendered multiple times

  Fixes [#&#8203;7560](mermaid-js/mermaid#7560). Resolves an issue where cardinality labels on self-referential class relationships were rendered three times due to edge splitting in the dagre layout. The fix ensures that each sub-edge only carries its relevant label positions.

- [#&#8203;7592](mermaid-js/mermaid#7592) [`2343e38`](mermaid-js/mermaid@2343e38) Thanks [@&#8203;knsv-bot](https://github.com/knsv-bot)! - fix(sequence): add background box behind alt/else section title labels in sequence diagrams

- [#&#8203;7589](mermaid-js/mermaid#7589) [`7fb9509`](mermaid-js/mermaid@7fb9509) Thanks [@&#8203;NYCU-Chung](https://github.com/NYCU-Chung)! - fix(block): prevent column widths from shrinking when mixing different column spans

- [#&#8203;7632](mermaid-js/mermaid#7632) [`3f9e0f1`](mermaid-js/mermaid@3f9e0f1) Thanks [@&#8203;ekiauhce](https://github.com/ekiauhce)! - fix(sequence): correct messageAlign label position for right-to-left arrows in sequence diagrams

- [#&#8203;7642](mermaid-js/mermaid#7642) [`7a8fb85`](mermaid-js/mermaid@7a8fb85) Thanks [@&#8203;tractorjuice](https://github.com/tractorjuice)! - fix(wardley): allow hyphens in unquoted component names

  Multi-word names containing hyphens — e.g. `real-time processing`, `end-user`, `on-call engineer` — now parse without quoting, bringing the grammar in line with the OnlineWardleyMaps (OWM) convention. `A->B` (no-space arrow) still tokenises correctly.

- [#&#8203;7523](mermaid-js/mermaid#7523) [`5144ed4`](mermaid-js/mermaid@5144ed4) Thanks [@&#8203;darshanr0107](https://github.com/darshanr0107)! - fix(block): Arrow blocks in block-beta diagrams not spanning the specified number of columns when using `:n` syntax.

- [#&#8203;7262](mermaid-js/mermaid#7262) [`13d9bfa`](mermaid-js/mermaid@13d9bfa) Thanks [@&#8203;darshanr0107](https://github.com/darshanr0107)! - fix(block): Ensure block diagram hexagon blocks respect column spanning syntax

- [#&#8203;7684](mermaid-js/mermaid#7684) [`e14bb88`](mermaid-js/mermaid@e14bb88) Thanks [@&#8203;aloisklink](https://github.com/aloisklink)! - fix: loosen `uuid` dependency range to allow v14

  Mermaid does not use any of the vulnerable code in CVE-2026-41907,
  but this allows users to silence any `npm audit` alerts on it.

- [#&#8203;7633](mermaid-js/mermaid#7633) [`9217c0d`](mermaid-js/mermaid@9217c0d) Thanks [@&#8203;Felix-Garci](https://github.com/Felix-Garci)! - fix(block): add support for all arrow types in block diagrams

- [#&#8203;7587](mermaid-js/mermaid#7587) [`5e7eb62`](mermaid-js/mermaid@5e7eb62) Thanks [@&#8203;MaddyGuthridge](https://github.com/MaddyGuthridge)! - chore: drop lodash-es in favour of es-toolkit

- [#&#8203;7693](mermaid-js/mermaid#7693) [`afaf306`](mermaid-js/mermaid@afaf306) Thanks [@&#8203;dull-bird](https://github.com/dull-bird)! - fix(quadrant-chart): allow CJK, emoji, Latin-1 accented characters, and other non-ASCII text in unquoted axis/quadrant/point labels.

  Previously the lexer only matched ASCII `[A-Za-z]+` for text tokens, even though the grammar referenced `UNICODE_TEXT`. Bare Chinese, Japanese, Korean, emoji, and accented Latin characters in labels caused a parse error. Added a `[^\x00-\x7F]+` lexer rule to emit `UNICODE_TEXT` and included it in the `alphaNumToken` grammar rule.

  Fixes [#&#8203;7120](mermaid-js/mermaid#7120).

- [#&#8203;7737](mermaid-js/mermaid#7737) [`4755553`](mermaid-js/mermaid@4755553) Thanks [@&#8203;ashishjain0512](https://github.com/ashishjain0512)! - fix: improve D3 types for mermaidAPI funcs

- [#&#8203;7737](mermaid-js/mermaid#7737) [`6476973`](mermaid-js/mermaid@6476973) Thanks [@&#8203;ashishjain0512](https://github.com/ashishjain0512)! - fix: handle `&` when namespacing CSS rules

- [#&#8203;7520](mermaid-js/mermaid#7520) [`8c1a0c1`](mermaid-js/mermaid@8c1a0c1) Thanks [@&#8203;RodrigojndSantos](https://github.com/RodrigojndSantos)! - fix(stateDiagram): comments starting with one `%` are no longer treated as comments

  Switch to using two `%%` if you want to write a comment.

- Updated dependencies \[[`7a8fb85`](mermaid-js/mermaid@7a8fb85), [`675a64c`](mermaid-js/mermaid@675a64c)]:
  - [@&#8203;mermaid-js/parser](https://github.com/mermaid-js/parser)@&#8203;1.1.1

### [`v11.14.0`](https://github.com/mermaid-js/mermaid/releases/tag/mermaid%4011.14.0)

[Compare Source](https://github.com/mermaid-js/mermaid/compare/mermaid@11.13.0...mermaid@11.14.0)

Thanks to our awesome mermaid community that contributed to this release: [@&#8203;ashishjain0512](https://github.com/ashishjain0512), [@&#8203;tractorjuice](https://github.com/tractorjuice), [@&#8203;autofix-ci\[bot\]](https://github.com/autofix-ci%5Bbot%5D), [@&#8203;aloisklink](https://github.com/aloisklink), [@&#8203;knsv](https://github.com/knsv), [@&#8203;kibanana](https://github.com/kibanana), [@&#8203;chandershekhar22](https://github.com/chandershekhar22), [@&#8203;khalil](https://github.com/khalil), [@&#8203;ytatsuno](https://github.com/ytatsuno), [@&#8203;sidharthv96](https://github.com/sidharthv96), [@&#8203;github-actions\[bot\]](https://github.com/github-actions%5Bbot%5D), [@&#8203;dripcoding](https://github.com/dripcoding), [@&#8203;knsv-bot](https://github.com/knsv-bot), [@&#8203;jeroensmink98](https://github.com/jeroensmink98), [@&#8203;Alex9583](https://github.com/Alex9583), [@&#8203;GhassenS](https://github.com/GhassenS), [@&#8203;omkarht](https://github.com/omkarht), [@&#8203;darshanr0107](https://github.com/darshanr0107), [@&#8203;leentaylor](https://github.com/leentaylor), [@&#8203;lee-treehouse](https://github.com/lee-treehouse), [@&#8203;veeceey](https://github.com/veeceey), [@&#8203;turntrout](https://github.com/turntrout), [@&#8203;Mermaid-Chart](https://github.com/Mermaid-Chart), [@&#8203;BambioGaming](https://github.com/BambioGaming), Claude

### Releases

#### [@&#8203;mermaid-js/examples](https://github.com/mermaid-js/examples)@&#8203;1.2.0

##### Minor Changes

- [#&#8203;7526](mermaid-js/mermaid#7526) [`efe218a`](mermaid-js/mermaid@efe218a) - add new TreeView diagram

#### mermaid\@&#8203;11.14.0

##### Minor Changes

- [#&#8203;7526](mermaid-js/mermaid#7526) [`efe218a`](mermaid-js/mermaid@efe218a) - Add Wardley Maps diagram type (beta)

  Adds Wardley Maps as a new diagram type to Mermaid (available as `wardley-beta`). Wardley Maps are visual representations of business strategy that help map value chains and component evolution.

  Features:

  - Component positioning with \[visibility, evolution] coordinates (OWM format)
  - Anchors for users/customers
  - Multiple link types: dependencies, flows, labeled links
  - Evolution arrows and trend indicators
  - Custom evolution stages with optional dual labels
  - Custom stage widths using [@&#8203;boundary](https://github.com/boundary) notation
  - Pipeline components with visibility inheritance
  - Annotations, notes, and visual elements
  - Source strategy markers: build, buy, outsource, market
  - Inertia indicators
  - Theme integration

  Implementation includes parser, D3.js renderer, unit tests, E2E tests, and comprehensive documentation.

- [#&#8203;7526](mermaid-js/mermaid#7526) [`efe218a`](mermaid-js/mermaid@efe218a)  - feat: implement neo look styling for state diagrams

- [#&#8203;7526](mermaid-js/mermaid#7526) [`efe218a`](mermaid-js/mermaid@efe218a)  - feat: implement neo look support for sequence diagrams with drop shadows, and enhanced styling

- [#&#8203;7526](mermaid-js/mermaid#7526) [`efe218a`](mermaid-js/mermaid@efe218a)  - feat: add `randomize` config option for architecture diagrams, defaulting to `false` for deterministic layout

- [#&#8203;7526](mermaid-js/mermaid#7526) [`efe218a`](mermaid-js/mermaid@efe218a) - feat: Add option to change timeline direction

- [#&#8203;7526](mermaid-js/mermaid#7526) [`efe218a`](mermaid-js/mermaid@efe218a)  - Fix duplicate SVG element IDs when rendering multiple diagrams on the same page. Internal element IDs (nodes, edges, markers, clusters) are now prefixed with the diagram's SVG element ID across all diagram types. Custom CSS or JS using exact ID selectors like `#arrowhead` should use attribute-ending selectors like `[id$="-arrowhead"]` instead.

- [#&#8203;7526](mermaid-js/mermaid#7526) [`efe218a`](mermaid-js/mermaid@efe218a)  - feat: implement neo look styling for ER diagrams

- [#&#8203;7526](mermaid-js/mermaid#7526) [`efe218a`](mermaid-js/mermaid@efe218a)  - feat: implement neo look styling for requirement diagrams

- [#&#8203;7526](mermaid-js/mermaid#7526) [`efe218a`](mermaid-js/mermaid@efe218a) - feat: add theme support for data label colour in xy chart

- [#&#8203;7526](mermaid-js/mermaid#7526) [`efe218a`](mermaid-js/mermaid@efe218a) - feat: implement neo look styling for mindmap diagrams

- [#&#8203;7526](mermaid-js/mermaid#7526) [`efe218a`](mermaid-js/mermaid@efe218a) - feat: implement neo look for mermaid flowchart diagrams

- [#&#8203;7526](mermaid-js/mermaid#7526) [`efe218a`](mermaid-js/mermaid@efe218a) - feat: implement neo look and themes for class diagram

- [#&#8203;7526](mermaid-js/mermaid#7526) [`efe218a`](mermaid-js/mermaid@efe218a) - feat: add showDataLabelOutsideBar option for xy chart

- [#&#8203;7526](mermaid-js/mermaid#7526) [`efe218a`](mermaid-js/mermaid@efe218a)  - feat: implement neo look support for timeline diagram with drop shadows, additoinal redux themes and enhanced styling

- [#&#8203;7526](mermaid-js/mermaid#7526) [`efe218a`](mermaid-js/mermaid@efe218a)  - feat: implement neo look and themes for gitGraph diagram

- [#&#8203;7526](mermaid-js/mermaid#7526) [`efe218a`](mermaid-js/mermaid@efe218a) - add new TreeView diagram

##### Patch Changes

- [#&#8203;7526](mermaid-js/mermaid#7526) [`efe218a`](mermaid-js/mermaid@efe218a)  - add link to ishikawa diagram on mermaid.js.org

- [#&#8203;7526](mermaid-js/mermaid#7526) [`efe218a`](mermaid-js/mermaid@efe218a)  - docs: document valid duration token formats in gantt.md

- [#&#8203;7526](mermaid-js/mermaid#7526) [`efe218a`](mermaid-js/mermaid@efe218a) - fix: ER diagram parsing when using "1" as entity identifier on right side

  The parser was incorrectly tokenizing the second "1" in patterns like `a many to 1 1:` because the lookahead rule only checked for alphabetic characters after whitespace, not digits. Added a new lookahead pattern `"1"(?=\s+[0-9])` to correctly identify the cardinality alias before a numeric entity name.

  Fixes [#&#8203;7472](mermaid-js/mermaid#7472)

- [#&#8203;7526](mermaid-js/mermaid#7526) [`efe218a`](mermaid-js/mermaid@efe218a)  - fix: scope cytoscape label style mapping to edges with labels to prevent console warnings

- [#&#8203;7526](mermaid-js/mermaid#7526) [`efe218a`](mermaid-js/mermaid@efe218a) - fix: support inline annotation syntax in class diagrams (class Shape <<interface>>)

- [#&#8203;7526](mermaid-js/mermaid#7526) [`efe218a`](mermaid-js/mermaid@efe218a)  - fix: Align branch label background with text for multi-line labels in LR GitGraph layout

- [#&#8203;7526](mermaid-js/mermaid#7526) [`efe218a`](mermaid-js/mermaid@efe218a) - fix: preserve cause hierarchy when ishikawa effect is indented more than causes

- [#&#8203;7526](mermaid-js/mermaid#7526) [`efe218a`](mermaid-js/mermaid@efe218a)  - refactor: remove unused createGraphWithElements function and add regression test for open edge arrowheads

- [#&#8203;7526](mermaid-js/mermaid#7526) [`efe218a`](mermaid-js/mermaid@efe218a)  - fix: Prevent long pie chart titles from being clipped by expanding the viewBox

- [#&#8203;7526](mermaid-js/mermaid#7526) [`efe218a`](mermaid-js/mermaid@efe218a) - fix: prevent sequence diagram hang when "as" is used without a trailing space in participant declarations

- [#&#8203;7526](mermaid-js/mermaid#7526) [`efe218a`](mermaid-js/mermaid@efe218a)  - fix: warn when `style` statement targets a non-existent node in flowcharts

- [#&#8203;7526](mermaid-js/mermaid#7526) [`efe218a`](mermaid-js/mermaid@efe218a) - fix: group state diagram SVG children under single root <g> element

- [#&#8203;7526](mermaid-js/mermaid#7526) [`efe218a`](mermaid-js/mermaid@efe218a) - fix: Allow :::className syntax inside composite state blocks

- [#&#8203;7526](mermaid-js/mermaid#7526) [`efe218a`](mermaid-js/mermaid@efe218a) Thanks [@&#8203;aloisklink](https://github.com/aloisklink), [@&#8203;BambioGaming](https://github.com/BambioGaming)! - fix: prevent escaping `<` and `&` when `htmlLabels: false`

- [#&#8203;7526](mermaid-js/mermaid#7526) [`efe218a`](mermaid-js/mermaid@efe218a)  - fix: treemap title and labels use theme-aware colors for dark backgrounds

- Updated dependencies \[[`efe218a`](mermaid-js/mermaid@efe218a)]:
  - [@&#8203;mermaid-js/parser](https://github.com/mermaid-js/parser)@&#8203;1.1.0

#### [@&#8203;mermaid-js/parser](https://github.com/mermaid-js/parser)@&#8203;1.1.0

##### Minor Changes

- [#&#8203;7526](mermaid-js/mermaid#7526) [`efe218a`](mermaid-js/mermaid@efe218a)  - add new TreeView diagram

#### [@&#8203;mermaid-js/tiny](https://github.com/mermaid-js/tiny)@&#8203;11.14.0

##### Minor Changes

- [#&#8203;7526](mermaid-js/mermaid#7526) [`efe218a`](mermaid-js/mermaid@efe218a)  - Add Wardley Maps diagram type (beta)

  Adds Wardley Maps as a new diagram type to Mermaid (available as `wardley-beta`). Wardley Maps are visual representations of business strategy that help map value chains and component evolution.

  Features:

  - Component positioning with \[visibility, evolution] coordinates (OWM format)
  - Anchors for users/customers
  - Multiple link types: dependencies, flows, labeled links
  - Evolution arrows and trend indicators
  - Custom evolution stages with optional dual labels
  - Custom stage widths using [@&#8203;boundary](https://github.com/boundary) notation
  - Pipeline components with visibility inheritance
  - Annotations, notes, and visual elements
  - Source strategy markers: build, buy, outsource, market
  - Inertia indicators
  - Theme integration

  Implementation includes parser, D3.js renderer, unit tests, E2E tests, and comprehensive documentation.

- [#&#8203;7526](mermaid-js/mermaid#7526) [`efe218a`](mermaid-js/mermaid@efe218a) - feat: implement neo look styling for state diagrams

- [#&#8203;7526](mermaid-js/mermaid#7526) [`efe218a`](mermaid-js/mermaid@efe218a)  - feat: implement neo look support for sequence diagrams with drop shadows, and enhanced styling

- [#&#8203;7526](mermaid-js/mermaid#7526) [`efe218a`](mermaid-js/mermaid@efe218a) - feat: add `randomize` config option for architecture diagrams, defaulting to `false` for deterministic layout

- [#&#8203;7526](mermaid-js/mermaid#7526) [`efe218a`](mermaid-js/mermaid@efe218a)  - feat: Add option to change timeline direction

- [#&#8203;7526](mermaid-js/mermaid#7526) [`efe218a`](mermaid-js/mermaid@efe218a) - Fix duplicate SVG element IDs when rendering multiple diagrams on the same page. Internal element IDs (nodes, edges, markers, clusters) are now prefixed with the diagram's SVG element ID across all diagram types. Custom CSS or JS using exact ID selectors like `#arrowhead` should use attribute-ending selectors like `[id$="-arrowhead"]` instead.

- [#&#8203;7526](mermaid-js/mermaid#7526) [`efe218a`](mermaid-js/mermaid@efe218a)  - feat: implement neo look styling for ER diagrams

- [#&#8203;7526](mermaid-js/mermaid#7526) [`efe218a`](mermaid-js/mermaid@efe218a)  - feat: implement neo look styling for requirement diagrams

- [#&#8203;7526](mermaid-js/mermaid#7526) [`efe218a`](mermaid-js/mermaid@efe218a)  - feat: add theme support for data label colour in xy chart

- [#&#8203;7526](mermaid-js/mermaid#7526) [`efe218a`](mermaid-js/mermaid@efe218a)  - feat: implement neo look styling for mindmap diagrams

- [#&#8203;7526](mermaid-js/mermaid#7526) [`efe218a`](mermaid-js/mermaid@efe218a)  - feat: implement neo look for mermaid flowchart diagrams

- [#&#8203;7526](mermaid-js/mermaid#7526) [`efe218a`](mermaid-js/mermaid@efe218a)  - feat: implement neo look and themes for class diagram

- [#&#8203;7526](mermaid-js/mermaid#7526) [`efe218a`](mermaid-js/mermaid@efe218a)  - feat: add showDataLabelOutsideBar option for xy chart

- [#&#8203;7526](mermaid-js/mermaid#7526) [`efe218a`](mermaid-js/mermaid@efe218a)  - feat: implement neo look support for timeline diagram with drop shadows, additoinal redux themes and enhanced styling

- [#&#8203;7526](mermaid-js/mermaid#7526) [`efe218a`](mermaid-js/mermaid@efe218a)  - feat: implement neo look and themes for gitGraph diagram

- [#&#8203;7526](mermaid-js/mermaid#7526) [`efe218a`](mermaid-js/mermaid@efe218a)  - add new TreeView diagram

##### Patch Changes

- [#&#8203;7526](mermaid-js/mermaid#7526) [`efe218a`](mermaid-js/mermaid@efe218a)  - add link to ishikawa diagram on mermaid.js.org

- [#&#8203;7526](mermaid-js/mermaid#7526) [`efe218a`](mermaid-js/mermaid@efe218a)  - docs: document valid duration token formats in gantt.md

- [#&#8203;7526](mermaid-js/mermaid#7526) [`efe218a`](mermaid-js/mermaid@efe218a)  - fix: ER diagram parsing when using "1" as entity identifier on right side

  The parser was incorrectly tokenizing the second "1" in patterns like `a many to 1 1:` because the lookahead rule only checked for alphabetic characters after whitespace, not digits. Added a new lookahead pattern `"1"(?=\s+[0-9])` to correctly identify the cardinality alias before a numeric entity name.

  Fixes [#&#8203;7472](mermaid-js/mermaid#7472)

- [#&#8203;7526](mermaid-js/mermaid#7526) [`efe218a`](mermaid-js/mermaid@efe218a)  - fix: scope cytoscape label style mapping to edges with labels to prevent console warnings

- [#&#8203;7526](mermaid-js/mermaid#7526) [`efe218a`](mermaid-js/mermaid@efe218a)  - fix: support inline annotation syntax in class diagrams (class Shape <<interface>>)

- [#&#8203;7526](mermaid-js/mermaid#7526) [`efe218a`](mermaid-js/mermaid@efe218a)  - fix: Align branch label background with text for multi-line labels in LR GitGraph layout

- [#&#8203;7526](mermaid-js/mermaid#7526) [`efe218a`](mermaid-js/mermaid@efe218a)  - fix: preserve cause hierarchy when ishikawa effect is indented more than causes

- [#&#8203;7526](mermaid-js/mermaid#7526) [`efe218a`](mermaid-js/mermaid@efe218a)  - refactor: remove unused createGraphWithElements function and add regression test for open edge arrowheads

- [#&#8203;7526](mermaid-js/mermaid#7526) [`efe218a`](mermaid-js/mermaid@efe218a)  - fix: Prevent long pie chart titles from being clipped by expanding the viewBox

- [#&#8203;7526](mermaid-js/mermaid#7526) [`efe218a`](mermaid-js/mermaid@efe218a)  - fix: prevent sequence diagram hang when "as" is used without a trailing space in participant declarations

- [#&#8203;7526](mermaid-js/mermaid#7526) [`efe218a`](mermaid-js/mermaid@efe218a)  - fix: warn when `style` statement targets a non-existent node in flowcharts

- [#&#8203;7526](mermaid-js/mermaid#7526) [`efe218a`](mermaid-js/mermaid@efe218a)  - fix: group state diagram SVG children under single root <g> element

- [#&#8203;7526](mermaid-js/mermaid#7526) [`efe218a`](mermaid-js/mermaid@efe218a)  - fix: Allow :::className syntax inside composite state blocks

- [#&#8203;7526](mermaid-js/mermaid#7526) [`efe218a`](mermaid-js/mermaid@efe218a) Thanks [@&#8203;aloisklink](https://github.com/aloisklink), [@&#8203;BambioGaming](https://github.com/BambioGaming)! - fix: prevent escaping `<` and `&` when `htmlLabels: false`

- [#&#8203;7526](mermaid-js/mermaid#7526) [`efe218a`](mermaid-js/mermaid@efe218a)  - fix: treemap title and labels use theme-aware colors for dark backgrounds

- Updated dependencies \[[`efe218a`](mermaid-js/mermaid@efe218a)]:
  - [@&#8203;mermaid-js/parser](https://github.com/mermaid-js/parser)@&#8203;1.1.0

</details>

---

### Configuration

📅 **Schedule**: (UTC)

- Branch creation
  - ""
- Automerge
  - Between 12:00 AM and 03:59 AM (`* 0-3 * * *`)

🚦 **Automerge**: Disabled by config. Please merge this manually once you are satisfied.

♻ **Rebasing**: Whenever PR becomes conflicted, or you tick the rebase/retry checkbox.

🔕 **Ignore**: Close this PR and you won't be reminded about this update again.

---

 - [ ] <!-- rebase-check -->If you want to rebase/retry this PR, check this box

---

This PR has been generated by [Mend Renovate](https://github.com/renovatebot/renovate).
<!--renovate-debug:eyJjcmVhdGVkSW5WZXIiOiI0My4xNzAuMjAiLCJ1cGRhdGVkSW5WZXIiOiI0My4xNzAuMjAiLCJ0YXJnZXRCcmFuY2giOiJ2MTUuMC9mb3JnZWpvIiwibGFiZWxzIjpbImRlcGVuZGVuY3ktdXBncmFkZSIsInRlc3Qvbm90LW5lZWRlZCJdfQ==-->

Reviewed-on: https://codeberg.org/forgejo/forgejo/pulls/12531
Reviewed-by: Mathieu Fenniak <mfenniak@noreply.codeberg.org>
github-actions Bot added a commit to zhongmiao-org/mermaid-markdown-bridge that referenced this pull request May 12, 2026
Upstream release: https://github.com/mermaid-js/mermaid/releases/tag/mermaid%4011.15.0

Release notes:
### Minor Changes

-   [#7174](mermaid-js/mermaid#7174) [`0aca217`](mermaid-js/mermaid@0aca217) Thanks [@milesspencer35](https://github.com/milesspencer35)! - feat(sequence): Add support for decimal start and increment values in the `autonumber` directive

-   [#7512](mermaid-js/mermaid#7512) [`8e17492`](mermaid-js/mermaid@8e17492) Thanks [@aruncveli](https://github.com/aruncveli)! - feat(flowchart): add datastore shape

    In Data flow diagrams, a datastore/warehouse/file/database is used to represent data persistence. It is denoted by a rectangle with only top and bottom borders, and can be used in flowcharts with `A@{ shape: datastore, label: "Datastore" }`.

-   [#6440](mermaid-js/mermaid#6440) [`9ad8dde`](mermaid-js/mermaid@9ad8dde) Thanks [@yordis](https://github.com/yordis), [@lgazo](https://github.com/lgazo)! - feat: add Event Modeling diagram

-   [#7707](mermaid-js/mermaid#7707) [`27db774`](mermaid-js/mermaid@27db774) Thanks [@txmxthy](https://github.com/txmxthy)! - feat(architecture): expose four fcose layout knobs for `architecture-beta` diagrams (`nodeSeparation`, `idealEdgeLengthMultiplier`, `edgeElasticity`, `numIter`) so authors can tune layout density and spread overlapping siblings without changing diagram source

-   [#7604](mermaid-js/mermaid#7604) [`bf9502f`](mermaid-js/mermaid@bf9502f) Thanks [@M-a-c](https://github.com/M-a-c)! - feat(class): add nested namespace support for class diagrams via dot notation and syntactic nesting

    If you have namespaces in class diagrams that use `.`s already and want to render them without nesting (≤v11.14.0 behaviour), you can use set `class.hierarchicalNamespaces=false` in your mermaid config:

    ```yaml
    config:
      class:
        hierarchicalNamespaces: false
    ```

-   [#7272](mermaid-js/mermaid#7272) [`88cdd3d`](mermaid-js/mermaid@88cdd3d) Thanks [@xinbenlv](https://github.com/xinbenlv)! - feat(sankey): add outlined label style, configurable nodeWidth/nodePadding, and custom node colors

### Patch Changes

-   [#7737](mermaid-js/mermaid#7737) [`e9b0f34`](mermaid-js/mermaid@e9b0f34) Thanks [@ashishjain0512](https://github.com/ashishjain0512)! - fix: prevent unbalanced CSS styles in classDefs

-   [#7737](mermaid-js/mermaid#7737) [`37ff937`](mermaid-js/mermaid@37ff937) Thanks [@ashishjain0512](https://github.com/ashishjain0512)! - fix: create CSS styles using the CSSOM

    This removes some invalid CSS and normalizes some CSS formatting.

-   [#7508](mermaid-js/mermaid#7508) [`bfe60cc`](mermaid-js/mermaid@bfe60cc) Thanks [@biiab](https://github.com/biiab)! - fix(stateDiagram): `end note` now only closes a note when used on a new line

-   [#7737](mermaid-js/mermaid#7737) [`faafb5d`](mermaid-js/mermaid@faafb5d) Thanks [@ashishjain0512](https://github.com/ashishjain0512)! - fix(gantt): add iteration limit for `excludes` field

-   [#7737](mermaid-js/mermaid#7737) [`65f8be2`](mermaid-js/mermaid@65f8be2) Thanks [@ashishjain0512](https://github.com/ashishjain0512)! - fix: disallow some CSS at-rules in custom CSS

-   [#7726](mermaid-js/mermaid#7726) [`1502f32`](mermaid-js/mermaid@1502f32) Thanks [@aloisklink](https://github.com/aloisklink)! - fix(wardley): fix unnecessary sanitization of text

-   [#7578](mermaid-js/mermaid#7578) [`1f98db8`](mermaid-js/mermaid@1f98db8) Thanks [@Gaston202](https://github.com/Gaston202)! - fix(class): self-referential class multiplicity labels no longer rendered multiple times

    Fixes #7560. Resolves an issue where cardinality labels on self-referential class relationships were rendered three times due to edge splitting in the dagre layout. The fix ensures that each sub-edge only carries its relevant label positions.

-   [#7592](mermaid-js/mermaid#7592) [`2343e38`](mermaid-js/mermaid@2343e38) Thanks [@knsv-bot](https://github.com/knsv-bot)! - fix(sequence): add background box behind alt/else section title labels in sequence diagrams

-   [#7589](mermaid-js/mermaid#7589) [`7fb9509`](mermaid-js/mermaid@7fb9509) Thanks [@NYCU-Chung](https://github.com/NYCU-Chung)! - fix(block): prevent column widths from shrinking when mixing different column spans

-   [#7632](mermaid-js/mermaid#7632) [`3f9e0f1`](mermaid-js/mermaid@3f9e0f1) Thanks [@ekiauhce](https://github.com/ekiauhce)! - fix(sequence): correct messageAlign label position for right-to-left arrows in sequence diagrams

-   [#7642](mermaid-js/mermaid#7642) [`7a8fb85`](mermaid-js/mermaid@7a8fb85) Thanks [@tractorjuice](https://github.com/tractorjuice)! - fix(wardley): allow hyphens in unquoted component names

    Multi-word names containing hyphens — e.g. `real-time processing`, `end-user`, `on-call engineer` — now parse without quoting, bringing the grammar in line with the OnlineWardleyMaps (OWM) convention. `A->B` (no-space arrow) still tokenises correctly.

-   [#7523](mermaid-js/mermaid#7523) [`5144ed4`](mermaid-js/mermaid@5144ed4) Thanks [@darshanr0107](https://github.com/darshanr0107)! - fix(block): Arrow blocks in block-beta diagrams not spanning the specified number of columns when using `:n` syntax.

-   [#7262](mermaid-js/mermaid#7262) [`13d9bfa`](mermaid-js/mermaid@13d9bfa) Thanks [@darshanr0107](https://github.com/darshanr0107)! - fix(block): Ensure block diagram hexagon blocks respect column spanning syntax

-   [#7684](mermaid-js/mermaid#7684) [`e14bb88`](mermaid-js/mermaid@e14bb88) Thanks [@aloisklink](https://github.com/aloisklink)! - fix: loosen `uuid` dependency range to allow v14

    Mermaid does not use any of the vulnerable code in CVE-2026-41907,
    but this allows users to silence any `npm audit` alerts on it.

-   [#7633](mermaid-js/mermaid#7633) [`9217c0d`](mermaid-js/mermaid@9217c0d) Thanks [@Felix-Garci](https://github.com/Felix-Garci)! - fix(block): add support for all arrow types in block diagrams

-   [#7587](mermaid-js/mermaid#7587) [`5e7eb62`](mermaid-js/mermaid@5e7eb62) Thanks [@MaddyGuthridge](https://github.com/MaddyGuthridge)! - chore: drop lodash-es in favour of es-toolkit

-   [#7693](mermaid-js/mermaid#7693) [`afaf306`](mermaid-js/mermaid@afaf306) Thanks [@dull-bird](https://github.com/dull-bird)! - fix(quadrant-chart): allow CJK, emoji, Latin-1 accented characters, and other non-ASCII text in unquoted axis/quadrant/point labels.

    Previously the lexer only matched ASCII `[A-Za-z]+` for text tokens, even though the grammar referenced `UNICODE_TEXT`. Bare Chinese, Japanese, Korean, emoji, and accented Latin characters in labels caused a parse error. Added a `[^\x00-\x7F]+` lexer rule to emit `UNICODE_TEXT` and included it in the `alphaNumToken` grammar rule.

    Fixes #7120.

-   [#7737](mermaid-js/mermaid#7737) [`4755553`](mermaid-js/mermaid@4755553) Thanks [@ashishjain0512](https://github.com/ashishjain0512)! - fix: improve D3 types for mermaidAPI funcs

-   [#7737](mermaid-js/mermaid#7737) [`6476973`](mermaid-js/mermaid@6476973) Thanks [@ashishjain0512](https://github.com/ashishjain0512)! - fix: handle `&` when namespacing CSS rules

-   [#7520](mermaid-js/mermaid#7520) [`8c1a0c1`](mermaid-js/mermaid@8c1a0c1) Thanks [@RodrigojndSantos](https://github.com/RodrigojndSantos)! - fix(stateDiagram): comments starting with one `%` are no longer treated as comments

    Switch to using two `%%` if you want to write a comment.

-   Updated dependencies \[[`7a8fb85`](mermaid-js/mermaid@7a8fb85), [`675a64c`](mermaid-js/mermaid@675a64c)]:
    -   @mermaid-js/parser@1.1.1

Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
Co-authored-by: give me a 98K <240642031+inhuman-0@users.noreply.github.com>
ark-65 added a commit to zhongmiao-org/mermaid-markdown-bridge that referenced this pull request May 12, 2026
Upstream release: https://github.com/mermaid-js/mermaid/releases/tag/mermaid%4011.15.0

Release notes:
### Minor Changes

-   [#7174](mermaid-js/mermaid#7174) [`0aca217`](mermaid-js/mermaid@0aca217) Thanks [@milesspencer35](https://github.com/milesspencer35)! - feat(sequence): Add support for decimal start and increment values in the `autonumber` directive

-   [#7512](mermaid-js/mermaid#7512) [`8e17492`](mermaid-js/mermaid@8e17492) Thanks [@aruncveli](https://github.com/aruncveli)! - feat(flowchart): add datastore shape

    In Data flow diagrams, a datastore/warehouse/file/database is used to represent data persistence. It is denoted by a rectangle with only top and bottom borders, and can be used in flowcharts with `A@{ shape: datastore, label: "Datastore" }`.

-   [#6440](mermaid-js/mermaid#6440) [`9ad8dde`](mermaid-js/mermaid@9ad8dde) Thanks [@yordis](https://github.com/yordis), [@lgazo](https://github.com/lgazo)! - feat: add Event Modeling diagram

-   [#7707](mermaid-js/mermaid#7707) [`27db774`](mermaid-js/mermaid@27db774) Thanks [@txmxthy](https://github.com/txmxthy)! - feat(architecture): expose four fcose layout knobs for `architecture-beta` diagrams (`nodeSeparation`, `idealEdgeLengthMultiplier`, `edgeElasticity`, `numIter`) so authors can tune layout density and spread overlapping siblings without changing diagram source

-   [#7604](mermaid-js/mermaid#7604) [`bf9502f`](mermaid-js/mermaid@bf9502f) Thanks [@M-a-c](https://github.com/M-a-c)! - feat(class): add nested namespace support for class diagrams via dot notation and syntactic nesting

    If you have namespaces in class diagrams that use `.`s already and want to render them without nesting (≤v11.14.0 behaviour), you can use set `class.hierarchicalNamespaces=false` in your mermaid config:

    ```yaml
    config:
      class:
        hierarchicalNamespaces: false
    ```

-   [#7272](mermaid-js/mermaid#7272) [`88cdd3d`](mermaid-js/mermaid@88cdd3d) Thanks [@xinbenlv](https://github.com/xinbenlv)! - feat(sankey): add outlined label style, configurable nodeWidth/nodePadding, and custom node colors

### Patch Changes

-   [#7737](mermaid-js/mermaid#7737) [`e9b0f34`](mermaid-js/mermaid@e9b0f34) Thanks [@ashishjain0512](https://github.com/ashishjain0512)! - fix: prevent unbalanced CSS styles in classDefs

-   [#7737](mermaid-js/mermaid#7737) [`37ff937`](mermaid-js/mermaid@37ff937) Thanks [@ashishjain0512](https://github.com/ashishjain0512)! - fix: create CSS styles using the CSSOM

    This removes some invalid CSS and normalizes some CSS formatting.

-   [#7508](mermaid-js/mermaid#7508) [`bfe60cc`](mermaid-js/mermaid@bfe60cc) Thanks [@biiab](https://github.com/biiab)! - fix(stateDiagram): `end note` now only closes a note when used on a new line

-   [#7737](mermaid-js/mermaid#7737) [`faafb5d`](mermaid-js/mermaid@faafb5d) Thanks [@ashishjain0512](https://github.com/ashishjain0512)! - fix(gantt): add iteration limit for `excludes` field

-   [#7737](mermaid-js/mermaid#7737) [`65f8be2`](mermaid-js/mermaid@65f8be2) Thanks [@ashishjain0512](https://github.com/ashishjain0512)! - fix: disallow some CSS at-rules in custom CSS

-   [#7726](mermaid-js/mermaid#7726) [`1502f32`](mermaid-js/mermaid@1502f32) Thanks [@aloisklink](https://github.com/aloisklink)! - fix(wardley): fix unnecessary sanitization of text

-   [#7578](mermaid-js/mermaid#7578) [`1f98db8`](mermaid-js/mermaid@1f98db8) Thanks [@Gaston202](https://github.com/Gaston202)! - fix(class): self-referential class multiplicity labels no longer rendered multiple times

    Fixes #7560. Resolves an issue where cardinality labels on self-referential class relationships were rendered three times due to edge splitting in the dagre layout. The fix ensures that each sub-edge only carries its relevant label positions.

-   [#7592](mermaid-js/mermaid#7592) [`2343e38`](mermaid-js/mermaid@2343e38) Thanks [@knsv-bot](https://github.com/knsv-bot)! - fix(sequence): add background box behind alt/else section title labels in sequence diagrams

-   [#7589](mermaid-js/mermaid#7589) [`7fb9509`](mermaid-js/mermaid@7fb9509) Thanks [@NYCU-Chung](https://github.com/NYCU-Chung)! - fix(block): prevent column widths from shrinking when mixing different column spans

-   [#7632](mermaid-js/mermaid#7632) [`3f9e0f1`](mermaid-js/mermaid@3f9e0f1) Thanks [@ekiauhce](https://github.com/ekiauhce)! - fix(sequence): correct messageAlign label position for right-to-left arrows in sequence diagrams

-   [#7642](mermaid-js/mermaid#7642) [`7a8fb85`](mermaid-js/mermaid@7a8fb85) Thanks [@tractorjuice](https://github.com/tractorjuice)! - fix(wardley): allow hyphens in unquoted component names

    Multi-word names containing hyphens — e.g. `real-time processing`, `end-user`, `on-call engineer` — now parse without quoting, bringing the grammar in line with the OnlineWardleyMaps (OWM) convention. `A->B` (no-space arrow) still tokenises correctly.

-   [#7523](mermaid-js/mermaid#7523) [`5144ed4`](mermaid-js/mermaid@5144ed4) Thanks [@darshanr0107](https://github.com/darshanr0107)! - fix(block): Arrow blocks in block-beta diagrams not spanning the specified number of columns when using `:n` syntax.

-   [#7262](mermaid-js/mermaid#7262) [`13d9bfa`](mermaid-js/mermaid@13d9bfa) Thanks [@darshanr0107](https://github.com/darshanr0107)! - fix(block): Ensure block diagram hexagon blocks respect column spanning syntax

-   [#7684](mermaid-js/mermaid#7684) [`e14bb88`](mermaid-js/mermaid@e14bb88) Thanks [@aloisklink](https://github.com/aloisklink)! - fix: loosen `uuid` dependency range to allow v14

    Mermaid does not use any of the vulnerable code in CVE-2026-41907,
    but this allows users to silence any `npm audit` alerts on it.

-   [#7633](mermaid-js/mermaid#7633) [`9217c0d`](mermaid-js/mermaid@9217c0d) Thanks [@Felix-Garci](https://github.com/Felix-Garci)! - fix(block): add support for all arrow types in block diagrams

-   [#7587](mermaid-js/mermaid#7587) [`5e7eb62`](mermaid-js/mermaid@5e7eb62) Thanks [@MaddyGuthridge](https://github.com/MaddyGuthridge)! - chore: drop lodash-es in favour of es-toolkit

-   [#7693](mermaid-js/mermaid#7693) [`afaf306`](mermaid-js/mermaid@afaf306) Thanks [@dull-bird](https://github.com/dull-bird)! - fix(quadrant-chart): allow CJK, emoji, Latin-1 accented characters, and other non-ASCII text in unquoted axis/quadrant/point labels.

    Previously the lexer only matched ASCII `[A-Za-z]+` for text tokens, even though the grammar referenced `UNICODE_TEXT`. Bare Chinese, Japanese, Korean, emoji, and accented Latin characters in labels caused a parse error. Added a `[^\x00-\x7F]+` lexer rule to emit `UNICODE_TEXT` and included it in the `alphaNumToken` grammar rule.

    Fixes #7120.

-   [#7737](mermaid-js/mermaid#7737) [`4755553`](mermaid-js/mermaid@4755553) Thanks [@ashishjain0512](https://github.com/ashishjain0512)! - fix: improve D3 types for mermaidAPI funcs

-   [#7737](mermaid-js/mermaid#7737) [`6476973`](mermaid-js/mermaid@6476973) Thanks [@ashishjain0512](https://github.com/ashishjain0512)! - fix: handle `&` when namespacing CSS rules

-   [#7520](mermaid-js/mermaid#7520) [`8c1a0c1`](mermaid-js/mermaid@8c1a0c1) Thanks [@RodrigojndSantos](https://github.com/RodrigojndSantos)! - fix(stateDiagram): comments starting with one `%` are no longer treated as comments

    Switch to using two `%%` if you want to write a comment.

-   Updated dependencies \[[`7a8fb85`](mermaid-js/mermaid@7a8fb85), [`675a64c`](mermaid-js/mermaid@675a64c)]:
    -   @mermaid-js/parser@1.1.1

Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
Co-authored-by: give me a 98K <240642031+inhuman-0@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Sankey improvements: Let user specify node and path color

3 participants