diff --git a/.changeset/beige-peas-shave.md b/.changeset/beige-peas-shave.md
deleted file mode 100644
index c405f3dcc..000000000
--- a/.changeset/beige-peas-shave.md
+++ /dev/null
@@ -1,5 +0,0 @@
----
-'@mermaid-js/mermaid-zenuml': patch
----
-
-Fixed a critical bug that the ZenUML diagram is not rendered.
diff --git a/.changeset/chatty-lemons-stick.md b/.changeset/chatty-lemons-stick.md
deleted file mode 100644
index 733e374ef..000000000
--- a/.changeset/chatty-lemons-stick.md
+++ /dev/null
@@ -1,5 +0,0 @@
----
-'mermaid': patch
----
-
-chore: Remove the "-beta" suffix from the XYChart, Block, Sankey diagrams to reflect their stable status
diff --git a/.changeset/cold-sites-accept.md b/.changeset/cold-sites-accept.md
deleted file mode 100644
index cba7ae414..000000000
--- a/.changeset/cold-sites-accept.md
+++ /dev/null
@@ -1,5 +0,0 @@
----
-'mermaid': patch
----
-
-fix: Position the edge label in state diagram correctly relative to the edge
diff --git a/.changeset/crazy-loops-matter.md b/.changeset/crazy-loops-matter.md
new file mode 100644
index 000000000..e6377a9e5
--- /dev/null
+++ b/.changeset/crazy-loops-matter.md
@@ -0,0 +1,5 @@
+---
+'mermaid': patch
+---
+
+fix: Handle arrows correctly when auto number is enabled
diff --git a/.changeset/empty-clouds-cry.md b/.changeset/empty-clouds-cry.md
deleted file mode 100644
index c513542f1..000000000
--- a/.changeset/empty-clouds-cry.md
+++ /dev/null
@@ -1,5 +0,0 @@
----
-'mermaid': patch
----
-
-fix: Apply correct dateFormat in Gantt chart to show only day when specified
diff --git a/.changeset/fuzzy-pears-cough.md b/.changeset/fuzzy-pears-cough.md
deleted file mode 100644
index 6ed777506..000000000
--- a/.changeset/fuzzy-pears-cough.md
+++ /dev/null
@@ -1,5 +0,0 @@
----
-'mermaid': patch
----
-
-fix: handle exclude dates properly in Gantt charts when using dateFormat: 'YYYY-MM-DD HH:mm:ss'
diff --git a/.changeset/gold-spiders-join.md b/.changeset/gold-spiders-join.md
deleted file mode 100644
index 56bccc244..000000000
--- a/.changeset/gold-spiders-join.md
+++ /dev/null
@@ -1,5 +0,0 @@
----
-'mermaid': patch
----
-
-fix: fixed connection gaps in flowchart for roundedRect, stadium and diamond shape
diff --git a/.changeset/large-mirrors-cheer.md b/.changeset/large-mirrors-cheer.md
deleted file mode 100644
index 4e3903039..000000000
--- a/.changeset/large-mirrors-cheer.md
+++ /dev/null
@@ -1,5 +0,0 @@
----
-'mermaid': patch
----
-
-fix: Update casing of ID in requirement diagram
diff --git a/.changeset/lemon-masks-unite.md b/.changeset/lemon-masks-unite.md
deleted file mode 100644
index 306ff1cce..000000000
--- a/.changeset/lemon-masks-unite.md
+++ /dev/null
@@ -1,5 +0,0 @@
----
-'mermaid': minor
----
-
-feat: Added support for per link curve styling in flowchart diagram using edge ids
diff --git a/.changeset/light-flowers-judge.md b/.changeset/light-flowers-judge.md
deleted file mode 100644
index 6378a9b0a..000000000
--- a/.changeset/light-flowers-judge.md
+++ /dev/null
@@ -1,5 +0,0 @@
----
-'mermaid': patch
----
-
-fix: Make flowchart elk detector regex match less greedy
diff --git a/.changeset/lovely-queens-own.md b/.changeset/lovely-queens-own.md
deleted file mode 100644
index edc8dda2d..000000000
--- a/.changeset/lovely-queens-own.md
+++ /dev/null
@@ -1,8 +0,0 @@
----
-'mermaid': patch
----
-
-fix(block): overflowing blocks no longer affect later lines
-
-This may change the layout of block diagrams that have overflowing lines
-(i.e. block diagrams that use up more columns that the `columns` specifier).
diff --git a/.changeset/ninety-roses-turn.md b/.changeset/ninety-roses-turn.md
deleted file mode 100644
index a69a6e7a0..000000000
--- a/.changeset/ninety-roses-turn.md
+++ /dev/null
@@ -1,7 +0,0 @@
----
-'mermaid': patch
----
-
-fix: log warning for blocks exceeding column width
-
-This update adds a validation check that logs a warning message when a block's width exceeds the defined column layout.
diff --git a/.changeset/rare-women-fly.md b/.changeset/rare-women-fly.md
deleted file mode 100644
index 46d08dd10..000000000
--- a/.changeset/rare-women-fly.md
+++ /dev/null
@@ -1,5 +0,0 @@
----
-'mermaid': patch
----
-
-fix: Add escaped class literal name on namespace
diff --git a/.changeset/red-zebras-happen.md b/.changeset/red-zebras-happen.md
deleted file mode 100644
index cadf3d0fb..000000000
--- a/.changeset/red-zebras-happen.md
+++ /dev/null
@@ -1,5 +0,0 @@
----
-'mermaid': patch
----
-
-fix: Allow equals sign in sequenceDiagram labels
diff --git a/.changeset/seven-papayas-film.md b/.changeset/seven-papayas-film.md
deleted file mode 100644
index 109743117..000000000
--- a/.changeset/seven-papayas-film.md
+++ /dev/null
@@ -1,9 +0,0 @@
----
-'mermaid': patch
----
-
-Add validation for negative values in pie charts:
-
-Prevents crashes during parsing by validating values post-parsing.
-
-Provides clearer, user-friendly error messages for invalid negative inputs.
diff --git a/.changeset/silver-eyes-build.md b/.changeset/silver-eyes-build.md
deleted file mode 100644
index 76f0a0125..000000000
--- a/.changeset/silver-eyes-build.md
+++ /dev/null
@@ -1,5 +0,0 @@
----
-'mermaid': patch
----
-
-chore: migrate to class-based ArchitectureDB implementation
diff --git a/.changeset/six-planets-rescue.md b/.changeset/six-planets-rescue.md
deleted file mode 100644
index 8b04a69ed..000000000
--- a/.changeset/six-planets-rescue.md
+++ /dev/null
@@ -1,5 +0,0 @@
----
-'mermaid': patch
----
-
-fix: node border style for handdrawn shapes
diff --git a/.changeset/smart-humans-cover.md b/.changeset/smart-humans-cover.md
deleted file mode 100644
index 4408e0a9c..000000000
--- a/.changeset/smart-humans-cover.md
+++ /dev/null
@@ -1,5 +0,0 @@
----
-'mermaid': patch
----
-
-fix: Update flowchart direction TD's behavior to be the same as TB
diff --git a/.changeset/strong-dryers-pay.md b/.changeset/strong-dryers-pay.md
deleted file mode 100644
index 495cde202..000000000
--- a/.changeset/strong-dryers-pay.md
+++ /dev/null
@@ -1,5 +0,0 @@
----
-'mermaid': patch
----
-
-fix: correctly render non-directional lines for '---' in block diagrams
diff --git a/.changeset/vast-buses-see.md b/.changeset/vast-buses-see.md
deleted file mode 100644
index fc2a0e6c6..000000000
--- a/.changeset/vast-buses-see.md
+++ /dev/null
@@ -1,5 +0,0 @@
----
-'mermaid': patch
----
-
-chore: Update packet diagram to use new class-based database structure
diff --git a/.cspell/contributors.txt b/.cspell/contributors.txt
index 80f4df22a..a95f8654e 100644
--- a/.cspell/contributors.txt
+++ b/.cspell/contributors.txt
@@ -2,6 +2,7 @@
Ashish Jain
cpettitt
Dong Cai
+fourcube
knsv
Knut Sveidqvist
Nikolay Rozhkov
diff --git a/.github/lychee.toml b/.github/lychee.toml
index fbe7a71a2..06b3aa707 100644
--- a/.github/lychee.toml
+++ b/.github/lychee.toml
@@ -59,6 +59,7 @@ exclude = [
"https://huehive.co",
"https://foswiki.org",
"https://www.gnu.org",
+"https://redmine.org",
"https://mermaid-preview.com"
]
diff --git a/.github/workflows/e2e-timings.yml b/.github/workflows/e2e-timings.yml
index f4c28acad..2bbfa8412 100644
--- a/.github/workflows/e2e-timings.yml
+++ b/.github/workflows/e2e-timings.yml
@@ -58,7 +58,7 @@ jobs:
echo "EOF" >> $GITHUB_OUTPUT
- name: Commit and create pull request
- uses: peter-evans/create-pull-request@1310d7dab503600742045e6fd4b84dda64352858
+ uses: peter-evans/create-pull-request@cb4d3bfce175d44325c6b7697f81e0afe8a79bdf
with:
add-paths: |
cypress/timings.json
diff --git a/cypress/helpers/util.ts b/cypress/helpers/util.ts
index 81b7036af..ab4bbef64 100644
--- a/cypress/helpers/util.ts
+++ b/cypress/helpers/util.ts
@@ -14,7 +14,7 @@ interface CodeObject {
mermaid: CypressMermaidConfig;
}
-const utf8ToB64 = (str: string): string => {
+export const utf8ToB64 = (str: string): string => {
return Buffer.from(decodeURIComponent(encodeURIComponent(str))).toString('base64');
};
@@ -22,7 +22,7 @@ const batchId: string =
'mermaid-batch-' +
(Cypress.env('useAppli')
? Date.now().toString()
- : Cypress.env('CYPRESS_COMMIT') || Date.now().toString());
+ : (Cypress.env('CYPRESS_COMMIT') ?? Date.now().toString()));
export const mermaidUrl = (
graphStr: string | string[],
@@ -61,9 +61,7 @@ export const imgSnapshotTest = (
sequence: {
...(_options.sequence ?? {}),
actorFontFamily: 'courier',
- noteFontFamily: _options.sequence?.noteFontFamily
- ? _options.sequence.noteFontFamily
- : 'courier',
+ noteFontFamily: _options.sequence?.noteFontFamily ?? 'courier',
messageFontFamily: 'courier',
},
};
diff --git a/cypress/integration/other/xss.spec.js b/cypress/integration/other/xss.spec.js
index 1e51d2f23..35a493850 100644
--- a/cypress/integration/other/xss.spec.js
+++ b/cypress/integration/other/xss.spec.js
@@ -1,4 +1,4 @@
-import { mermaidUrl } from '../../helpers/util.ts';
+import { imgSnapshotTest, mermaidUrl, utf8ToB64 } from '../../helpers/util.ts';
describe('XSS', () => {
it('should handle xss in tags', () => {
const str =
@@ -141,4 +141,37 @@ describe('XSS', () => {
cy.wait(1000);
cy.get('#the-malware').should('not.exist');
});
+
+ it('should sanitize icon labels in architecture diagrams', () => {
+ const str = JSON.stringify({
+ code: `architecture-beta
+ group api(cloud)[API]
+ service db "" [Database] in api`,
+ });
+ imgSnapshotTest(utf8ToB64(str), {}, true);
+ cy.wait(1000);
+ cy.get('#the-malware').should('not.exist');
+ });
+
+ it('should sanitize katex blocks', () => {
+ const str = JSON.stringify({
+ code: `sequenceDiagram
+ participant A as Alice
$$\\text{Alice}$$
+ A->>John: Hello John, how are you?`,
+ });
+ imgSnapshotTest(utf8ToB64(str), {}, true);
+ cy.wait(1000);
+ cy.get('#the-malware').should('not.exist');
+ });
+
+ it('should sanitize labels', () => {
+ const str = JSON.stringify({
+ code: `erDiagram
+ "
" ||--|| ENTITY2 : "
"
+ `,
+ });
+ imgSnapshotTest(utf8ToB64(str), {}, true);
+ cy.wait(1000);
+ cy.get('#the-malware').should('not.exist');
+ });
});
diff --git a/cypress/integration/rendering/flowchart-elk.spec.js b/cypress/integration/rendering/flowchart-elk.spec.js
index 27af2c40c..312e1d5b4 100644
--- a/cypress/integration/rendering/flowchart-elk.spec.js
+++ b/cypress/integration/rendering/flowchart-elk.spec.js
@@ -1053,6 +1053,21 @@ flowchart LR
});
});
});
+
+ it('6647-elk: should keep node order when using elk layout unless it would add crossings', () => {
+ imgSnapshotTest(
+ `---
+config:
+ layout: elk
+---
+ flowchart TB
+ a --> a1 & a2 & a3 & a4
+ b --> b1 & b2
+ b2 --> b3
+ b1 --> b4
+ `
+ );
+ });
});
describe('Title and arrow styling #4813', () => {
diff --git a/cypress/integration/rendering/flowchart-v2.spec.js b/cypress/integration/rendering/flowchart-v2.spec.js
index 69ff10b00..8c6cde57a 100644
--- a/cypress/integration/rendering/flowchart-v2.spec.js
+++ b/cypress/integration/rendering/flowchart-v2.spec.js
@@ -1118,7 +1118,7 @@ end
imgSnapshotTest(
`flowchart TB
A(["Start"]) --> n1["Untitled Node"]
- A --> n2["Untitled Node"]
+ A --> n2["Untitled Node"]
`,
{}
);
@@ -1127,7 +1127,7 @@ end
imgSnapshotTest(
`flowchart BT
n2["Untitled Node"] --> n1["Diamond"]
- n1@{ shape: diam}
+ n1@{ shape: diam}
`,
{}
);
@@ -1138,7 +1138,7 @@ end
n2["Untitled Node"] --> n1["Rounded Rectangle"]
n3["Untitled Node"] --> n1
n1@{ shape: rounded}
- n3@{ shape: rect}
+ n3@{ shape: rect}
`,
{}
);
@@ -1164,4 +1164,26 @@ end
`
);
});
+
+ describe('when rendering unsuported markdown', () => {
+ const graph = `flowchart TB
+ mermaid{"What is\nyourmermaid version?"} --> v10["<11"] --"\`<**1**1\`"--> fine["No bug"]
+ mermaid --> v11[">= v11"] -- ">= v11" --> broken["Affected by https://github.com/mermaid-js/mermaid/issues/5824"]
+ subgraph subgraph1["\`How to fix **fix**\`"]
+ broken --> B["B"]
+ end
+ githost["Github, Gitlab, BitBucket, etc."]
+ githost2["\`Github, Gitlab, BitBucket, etc.\`"]
+ a["1."]
+ b["- x"]
+ `;
+
+ it('should render raw strings', () => {
+ imgSnapshotTest(graph);
+ });
+
+ it('should render raw strings with htmlLabels: false', () => {
+ imgSnapshotTest(graph, { htmlLabels: false });
+ });
+ });
});
diff --git a/cypress/integration/rendering/sequencediagram.spec.js b/cypress/integration/rendering/sequencediagram.spec.js
index f18e99abf..6709b557c 100644
--- a/cypress/integration/rendering/sequencediagram.spec.js
+++ b/cypress/integration/rendering/sequencediagram.spec.js
@@ -893,6 +893,17 @@ describe('Sequence diagram', () => {
}
);
});
+
+ it('should handle bidirectional arrows with autonumber', () => {
+ imgSnapshotTest(`
+ sequenceDiagram
+ autonumber
+ participant A
+ participant B
+ A<<->>B: This is a bidirectional message
+ A->B: This is a normal message`);
+ });
+
it('should support actor links and properties when not mirrored EXPERIMENTAL: USE WITH CAUTION', () => {
//Be aware that the syntax for "properties" is likely to be changed.
imgSnapshotTest(
diff --git a/cypress/platform/knsv2.html b/cypress/platform/knsv2.html
index ab7ded0c2..eb5528844 100644
--- a/cypress/platform/knsv2.html
+++ b/cypress/platform/knsv2.html
@@ -131,6 +131,22 @@
+--- +config: + layout: elk + elk: + mergeEdges: false + forceNodeModelOrder: false + considerModelOrder: NONE + +--- + flowchart TB + a --> a1 & a2 & a3 & a4 + b --> b1 & b2 + b2 --> b3 + b1 --> b4+
treemap "Section 1" "Leaf 1.1": 12 diff --git a/cypress/platform/sidv.html b/cypress/platform/sidv.html index b0a1699da..1651b0737 100644 --- a/cypress/platform/sidv.html +++ b/cypress/platform/sidv.html @@ -41,10 +41,6 @@ graph TB const { svg } = await mermaid.render('d22', value); console.log(svg); el.innerHTML = svg; - // mermaid.test1('first_slow', 1200).then((r) => console.info(r)); - // mermaid.test1('second_fast', 200).then((r) => console.info(r)); - // mermaid.test1('third_fast', 200).then((r) => console.info(r)); - // mermaid.test1('forth_slow', 1200).then((r) => console.info(r));