diff --git a/.github/workflows/link-checker.yml b/.github/workflows/link-checker.yml
index 3a9af99c1..a2dc989e7 100644
--- a/.github/workflows/link-checker.yml
+++ b/.github/workflows/link-checker.yml
@@ -36,7 +36,7 @@ jobs:
restore-keys: cache-lychee-
- name: Link Checker
- uses: lycheeverse/lychee-action@v1.7.0
+ uses: lycheeverse/lychee-action@v1.8.0
with:
args: >-
--verbose
diff --git a/.github/workflows/lint.yml b/.github/workflows/lint.yml
index a21fbc005..d4bf4afe8 100644
--- a/.github/workflows/lint.yml
+++ b/.github/workflows/lint.yml
@@ -42,7 +42,7 @@ jobs:
if ! pnpm run lint; then
# print a nice error message on lint failure
ERROR_MESSAGE='Running `pnpm run lint` failed.'
- ERROR_MESSAGE+=' Running `pnpm run lint:fix` may fix this issue. '
+ ERROR_MESSAGE+=' Running `pnpm -w run lint:fix` may fix this issue. '
ERROR_MESSAGE+=" If this error doesn't occur on your local machine,"
ERROR_MESSAGE+=' make sure your packages are up-to-date by running `pnpm install`.'
ERROR_MESSAGE+=' You may also need to delete your prettier cache by running'
diff --git a/.gitignore b/.gitignore
index f29286825..efbfc8b36 100644
--- a/.gitignore
+++ b/.gitignore
@@ -36,3 +36,6 @@ tsconfig.tsbuildinfo
knsv*.html
local*.html
stats/
+
+**/user-avatars/*
+**/contributor-names.json
diff --git a/.lintstagedrc.mjs b/.lintstagedrc.mjs
index ac2623093..3ae66bba2 100644
--- a/.lintstagedrc.mjs
+++ b/.lintstagedrc.mjs
@@ -1,5 +1,5 @@
export default {
- '!(docs/**/*)*.{ts,js,json,html,md,mts}': [
+ '!(docs/**/*)*.{ts,js,html,md,mts}': [
'eslint --cache --cache-strategy content --fix',
// don't cache prettier yet, since we use `prettier-plugin-jsdoc`,
// and prettier doesn't invalidate cache on plugin updates"
diff --git a/.prettierignore b/.prettierignore
index b66f97d1c..2ab91f93e 100644
--- a/.prettierignore
+++ b/.prettierignore
@@ -4,4 +4,5 @@ cypress/platform/xss3.html
coverage
# Autogenerated by PNPM
pnpm-lock.yaml
-stats
\ No newline at end of file
+stats
+packages/mermaid/src/docs/.vitepress/components.d.ts
diff --git a/README.md b/README.md
index 31c6d62c6..941e1fd18 100644
--- a/README.md
+++ b/README.md
@@ -165,6 +165,13 @@ class Class10 {
int id
size()
}
+namespace Namespace01 {
+ class Class11
+ class Class12 {
+ int id
+ size()
+ }
+}
```
```mermaid
@@ -184,6 +191,13 @@ class Class10 {
int id
size()
}
+namespace Namespace01 {
+ class Class11
+ class Class12 {
+ int id
+ size()
+ }
+}
```
### State diagram [docs - live editor]
diff --git a/cSpell.json b/cSpell.json
index 94276b683..154d01a99 100644
--- a/cSpell.json
+++ b/cSpell.json
@@ -5,11 +5,13 @@
"acyclicer",
"adamiecki",
"alois",
+ "aloisklink",
"antiscript",
"appli",
"applitools",
"asciidoctor",
"ashish",
+ "ashishjain",
"astah",
"bbox",
"bilkent",
@@ -23,6 +25,7 @@
"classdef",
"codedoc",
"colour",
+ "commitlint",
"cpettitt",
"customizability",
"cuzon",
@@ -48,30 +51,41 @@
"grav",
"greywolf",
"huynh",
+ "huynhicode",
"inkdrop",
"jaoude",
+ "jgreywolf",
"jison",
+ "jiti",
"kaufmann",
"khroma",
"klemm",
"klink",
"knsv",
"knut",
+ "knutsveidqvist",
"laganeckas",
+ "linetype",
"lintstagedrc",
"logmsg",
"lucida",
+ "markdownish",
"matthieu",
+ "matthieumorel",
"mdast",
"mdbook",
+ "mermaidjs",
"mermerd",
"mindaugas",
"mindmap",
"mindmaps",
"mitigations",
"mkdocs",
+ "mmorel",
"mult",
"orlandoni",
+ "pathe",
+ "pbrolin",
"phpbb",
"plantuml",
"playfair",
@@ -83,6 +97,7 @@
"rect",
"rects",
"redmine",
+ "rehype",
"roledescription",
"sandboxed",
"setupgraphviewbox",
@@ -90,8 +105,12 @@
"sidharth",
"sidharthv",
"sphinxcontrib",
+ "startx",
+ "starty",
"statediagram",
"steph",
+ "stopx",
+ "stopy",
"stylis",
"substate",
"sveidqvist",
@@ -101,14 +120,19 @@
"textlength",
"treemap",
"ts-nocheck",
+ "tsdoc",
"tuleap",
+ "tylerlong",
"ugge",
"unist",
+ "unocss",
+ "valign",
"verdana",
"viewports",
"vinod",
"visio",
"vitepress",
+ "vueuse",
"xlink",
"yash"
],
@@ -150,6 +174,7 @@
],
"ignorePaths": [
"packages/mermaid/src/docs/CHANGELOG.md",
- "packages/mermaid/src/docs/.vitepress/redirect.ts"
+ "packages/mermaid/src/docs/.vitepress/redirect.ts",
+ "packages/mermaid/src/docs/.vitepress/contributor-names.json"
]
}
diff --git a/cypress/integration/rendering/classDiagram-v2.spec.js b/cypress/integration/rendering/classDiagram-v2.spec.js
index a11571814..2e7a1cbd7 100644
--- a/cypress/integration/rendering/classDiagram-v2.spec.js
+++ b/cypress/integration/rendering/classDiagram-v2.spec.js
@@ -548,4 +548,18 @@ class C13["With Città foreign language"]
`
);
});
+ it('should add classes namespaces', function () {
+ imgSnapshotTest(
+ `
+ classDiagram
+ namespace Namespace1 {
+ class C1
+ class C2
+ }
+ C1 --> C2
+ class C3
+ class C4
+ `
+ );
+ });
});
diff --git a/cypress/integration/rendering/quadrantChart.spec.js b/cypress/integration/rendering/quadrantChart.spec.js
new file mode 100644
index 000000000..4bcf58b60
--- /dev/null
+++ b/cypress/integration/rendering/quadrantChart.spec.js
@@ -0,0 +1,163 @@
+import { imgSnapshotTest, renderGraph } from '../../helpers/util.js';
+
+describe('Quadrant Chart', () => {
+ it('should render if only chart type is provided', () => {
+ imgSnapshotTest(
+ `
+ quadrantChart
+ `,
+ {}
+ );
+ cy.get('svg');
+ });
+ it('should render a complete quadrant chart', () => {
+ imgSnapshotTest(
+ `
+ quadrantChart
+ title Reach and engagement of campaigns
+ x-axis Low Reach --> High Reach
+ y-axis Low Engagement --> High Engagement
+ quadrant-1 We should expand
+ quadrant-2 Need to promote
+ quadrant-3 Re-evaluate
+ quadrant-4 May be improved
+ Campaign A: [0.3, 0.6]
+ Campaign B: [0.45, 0.23]
+ Campaign C: [0.57, 0.69]
+ Campaign D: [0.78, 0.34]
+ Campaign E: [0.40, 0.34]
+ Campaign F: [0.35, 0.78]
+ `,
+ {}
+ );
+ cy.get('svg');
+ });
+ it('should render without points', () => {
+ imgSnapshotTest(
+ `
+ quadrantChart
+ title Reach and engagement of campaigns
+ x-axis Low Reach --> High Reach
+ y-axis Low Engagement --> High Engagement
+ quadrant-1 We should expand
+ quadrant-2 Need to promote
+ quadrant-3 Re-evaluate
+ quadrant-4 May be improved
+ `,
+ {}
+ );
+ cy.get('svg');
+ });
+ it('should able to render y-axix on right side', () => {
+ imgSnapshotTest(
+ `
+ %%{init: {"quadrantChart": {"yAxisPosition": "right"}}}%%
+ quadrantChart
+ title Reach and engagement of campaigns
+ x-axis Low Reach --> High Reach
+ y-axis Low Engagement --> High Engagement
+ quadrant-1 We should expand
+ quadrant-2 Need to promote
+ quadrant-3 Re-evaluate
+ quadrant-4 May be improved
+ `,
+ {}
+ );
+ cy.get('svg');
+ });
+ it('should able to render x-axix on bottom', () => {
+ imgSnapshotTest(
+ `
+ %%{init: {"quadrantChart": {"xAxisPosition": "bottom"}}}%%
+ quadrantChart
+ title Reach and engagement of campaigns
+ x-axis Low Reach --> High Reach
+ y-axis Low Engagement --> High Engagement
+ quadrant-1 We should expand
+ quadrant-2 Need to promote
+ quadrant-3 Re-evaluate
+ quadrant-4 May be improved
+ `,
+ {}
+ );
+ cy.get('svg');
+ });
+ it('should able to render x-axix on bottom and y-axis on right', () => {
+ imgSnapshotTest(
+ `
+ %%{init: {"quadrantChart": {"xAxisPosition": "bottom", "yAxisPosition": "right"}}}%%
+ quadrantChart
+ title Reach and engagement of campaigns
+ x-axis Low Reach --> High Reach
+ y-axis Low Engagement --> High Engagement
+ quadrant-1 We should expand
+ quadrant-2 Need to promote
+ quadrant-3 Re-evaluate
+ quadrant-4 May be improved
+ `,
+ {}
+ );
+ cy.get('svg');
+ });
+ it('should render without title', () => {
+ imgSnapshotTest(
+ `
+ quadrantChart
+ x-axis Low Reach --> High Reach
+ y-axis Low Engagement --> High Engagement
+ quadrant-1 We should expand
+ quadrant-2 Need to promote
+ quadrant-3 Re-evaluate
+ quadrant-4 May be improved
+ `,
+ {}
+ );
+ cy.get('svg');
+ });
+ it('should use all the config', () => {
+ imgSnapshotTest(
+ `
+ %%{init: {"quadrantChart": {"chartWidth": 600, "chartHeight": 600, "titlePadding": 20, "titleFontSize": 10, "quadrantPadding": 20, "quadrantTextTopPadding": 40, "quadrantLabelFontSize": 20, "quadrantInternalBorderStrokeWidth": 3, "quadrantExternalBorderStrokeWidth": 5, "xAxisLabelPadding": 20, "xAxisLabelFontSize": 20, "yAxisLabelPadding": 20, "yAxisLabelFontSize": 20, "pointTextPadding": 20, "pointLabelFontSize": 20, "pointRadius": 10 }}}%%
+ quadrantChart
+ title Reach and engagement of campaigns
+ x-axis Low Reach --> High Reach
+ y-axis Low Engagement --> High Engagement
+ quadrant-1 We should expand
+ quadrant-2 Need to promote
+ quadrant-3 Re-evaluate
+ quadrant-4 May be improved
+ Campaign A: [0.3, 0.6]
+ Campaign B: [0.45, 0.23]
+ Campaign C: [0.57, 0.69]
+ Campaign D: [0.78, 0.34]
+ Campaign E: [0.40, 0.34]
+ Campaign F: [0.35, 0.78]
+ `,
+ {}
+ );
+ cy.get('svg');
+ });
+ it('should use all the theme variable', () => {
+ imgSnapshotTest(
+ `
+ %%{init: {"themeVariables": {"quadrant1Fill": "#b4dcff","quadrant2Fill": "#fef0ff", "quadrant3Fill": "#fffaf0", "quadrant4Fill": "#f0fff2", "quadrant1TextFill": "#ff0000", "quadrant2TextFill": "#2d00df", "quadrant3TextFill": "#00ffda", "quadrant4TextFill": "#e68300", "quadrantPointFill": "#0149ff", "quadrantPointTextFill": "#dc00ff", "quadrantXAxisTextFill": "#ffb500", "quadrantYAxisTextFill": "#fae604", "quadrantInternalBorderStrokeFill": "#3636f2", "quadrantExternalBorderStrokeFill": "#ff1010", "quadrantTitleFill": "#00ea19"} }}%%
+ quadrantChart
+ title Reach and engagement of campaigns
+ x-axis Low Reach --> High Reach
+ y-axis Low Engagement --> High Engagement
+ quadrant-1 We should expand
+ quadrant-2 Need to promote
+ quadrant-3 Re-evaluate
+ quadrant-4 May be improved
+ Campaign A: [0.3, 0.6]
+ Campaign B: [0.45, 0.23]
+ Campaign C: [0.57, 0.69]
+ Campaign D: [0.78, 0.34]
+ Campaign E: [0.40, 0.34]
+ Campaign F: [0.35, 0.78]
+ `,
+ {}
+ );
+ cy.get('svg');
+ });
+});
diff --git a/cypress/integration/rendering/sequencediagram.spec.js b/cypress/integration/rendering/sequencediagram.spec.js
index 687fc245b..e5459637b 100644
--- a/cypress/integration/rendering/sequencediagram.spec.js
+++ b/cypress/integration/rendering/sequencediagram.spec.js
@@ -123,6 +123,29 @@ context('Sequence diagram', () => {
}
);
});
+ it('should render a sequence diagram with par_over', () => {
+ imgSnapshotTest(
+ `
+ sequenceDiagram
+ participant Alice
+ participant Bob
+ participant John
+ par_over Section title
+ Alice ->> Bob: Message 1
Second line
+ Bob ->> John: Message 2
+ end
+ par_over Two line
section title
+ Note over Alice: Alice note
+ Note over Bob: Bob note
Second line
+ Note over John: John note
+ end
+ par_over Mixed section
+ Alice ->> Bob: Message 1
+ Note left of Bob: Alice/Bob Note
+ end
+ `
+ );
+ });
context('font settings', () => {
it('should render different note fonts when configured', () => {
imgSnapshotTest(
diff --git a/cypress/platform/knsv.html b/cypress/platform/knsv.html
index f6ee1ef03..512333c01 100644
--- a/cypress/platform/knsv.html
+++ b/cypress/platform/knsv.html
@@ -42,368 +42,86 @@
-flowchart LR - subgraph one - direction LR - A[myClass1] --> B[default] - subgraph two - direction BT - C[myClass2] --> D[default] - end - end ++ %%{init: {"flowchart": {"htmlLabels": true}} }%% + flowchart LR + b("`The dog in **the** hog.(1).. a a a a *very long text* about it + Word! + + Another line with many, many words. Another line with many, many words. Another line with many, many words. Another line with many, many words. Another line with many, many words. Another line with many, many words. Another line with many, many words. Another line with many, many words.`") --apa--> c + +++ classDiagram-v2 + classA -- classB : Inheritance + classA -- classC : link + classC -- classD : link + classB -- classD--flowchart LR - classDef aPID stroke:#4e4403,fill:#fdde29,color:#4e4403,rx:5px,ry:5px; - classDef crm stroke:#333333,fill:#DCDCDC,color:#333333,rx:5px,ry:5px; - classDef type stroke:#502604,fill:#FAB565,color:#502604,rx:20px,ry:20px;; - - O0("Joe") - class O0 aPID; - - O1("Person") - class O1 crm; - O0 -- has type -->O1["Person"] - - O2("aat:300411314") - class O2 type; - click O2 function "Sorry the newline html tags are not being processed correctly
So all of this appears on the
same line." - O0 -- has type -->O2["Bug"] - click O0 function "Lots of great info about Joe
Lots of great info about Joe
burt
fred"; ++ sequenceDiagram + Alice->>Bob: Extremely utterly long line of longness which had previously overflown the actor box as it is much longer than what it should be + loop Loopy + Bob->>Alice: Pasten + end--flowchart TD - subgraph test - direction TB - subgraph test2 - direction LR - F --> D - end - subgraph test3 - direction TB - G --> H - end - end ++ %%{init: {"flowchart": {"htmlLabels": false}} }%% + flowchart LR + b("`The dog in **the** hog.(1) + NL`") --"`1o **bold**`"--> c[new strings svg labels]--flowchart TD - - release-branch[Create Release Branch]:::relClass - develop-branch[Update Develop Branch]:::relClass - github-release-draft[GitHub Release Draft]:::relClass - trigger-pipeline[Trigger Jenkins pipeline]:::fixClass - github-release[GitHub Release]:::postClass - - build-ready --> release-branch - build-ready --> develop-branch - release-branch --> jenkins-release-build - jenkins-release-build --> github-release-draft - jenkins-release-build --> install-release - install-release --> verify-release - jenkins-release-build --> announce - github-release-draft --> github-release - verify-release --> verify-check - verify-check -- Yes --> github-release - verify-check -- No --> release-fix - release-fix --> release-branch-pr - verify-check -- No --> delete-artifacts - release-branch-pr --> trigger-pipeline - delete-artifacts --> trigger-pipeline - trigger-pipeline --> jenkins-release-build - - ++ %%{init: {"flowchart": {"htmlLabels": true}} }%% + flowchart LR + b("`The dog in **the** hog.(1) + NL`") --"`1o **bold**`"--> c[new strings html labels]--flowchart LR - a["Haiya"]===>b ++ %%{init: {"flowchart": {"htmlLabels": true}} }%% + flowchart LR + b("The dog in the hog.(1)\nNL") --"1o bold"--> c[old strings svg labels]--flowchart TD - A --> B - A --> C - B --> C ---flowchart TD - A([stadium shape test]) - A -->|Get money| B([Go shopping]) - B --> C([Let me think...-
Do I want something for work,
something to spend every free second with,
or something to get around?]) - C -->|One| D([Laptop]) - C -->|Two| E([iPhone]) - C -->|Three| F([Car
wroom wroom]) - click A "index.html#link-clicked" "link test" - click B testClick "click test" - classDef someclass fill:#f96; - class A someclass; - class C someclass; -- sequenceDiagram - title: My Sequence Diagram Title - accTitle: My Acc Sequence Diagram - accDescr: My Sequence Diagram Description - - Alice->>John: Hello John, how are you? - John-->>Alice: Great! - Alice-)John: See you later! ---graph TD - A -->|000| B - B -->|111| C - - linkStyle 1 stroke:#ff3,stroke-width:4px,color:red; --- journey - accTitle: My User Journey Diagram - accDescr: My User Journey Diagram Description - - title My working day - section Go to work - Make tea: 5: Me - Go upstairs: 3: Me - Do work: 1: Me, Cat - section Go home - Go downstairs: 5: Me - Sit down: 5: Me --- info ---requirementDiagram - accTitle: My req Diagram - accDescr: My req Diagram Description - - requirement test_req { - id: 1 - text: the test text. - risk: high - verifymethod: test - } - - functionalRequirement test_req2 { - id: 1.1 - text: the second test text. - risk: low - verifymethod: inspection - } - - performanceRequirement test_req3 { - id: 1.2 - text: the third test text. - risk: medium - verifymethod: demonstration - } - - element test_entity { - type: simulation - } - - element test_entity2 { - type: word doc - docRef: reqs/test_entity - } - - - test_entity - satisfies -> test_req2 - test_req - traces -> test_req2 - test_req - contains -> test_req3 - test_req <- copies - test_entity2 ---gantt - dateFormat YYYY-MM-DD - title Adding GANTT diagram functionality to mermaid - excludes weekends - %% (`excludes` accepts specific dates in YYYY-MM-DD format, days of the week ("sunday") or "weekends", but not the word "weekdays".) - - section A section - Completed task :done, des1, 2014-01-06,2014-01-08 - Active task :active, des2, 2014-01-09, 3d - Future task : des3, after des2, 5d - Future task2 : des4, after des3, 5d - - section Critical tasks - Completed task in the critical line :crit, done, 2014-01-06,24h - Implement parser and jison :crit, done, after des1, 2d - Create tests for parser :crit, active, 3d - Future task in critical line :crit, 5d - Create tests for renderer :2d - Add to mermaid :1d - Functionality added :milestone, 2014-01-25, 0d - - section Documentation - Describe gantt syntax :active, a1, after des1, 3d - Add gantt diagram to demo page :after a1 , 20h - Add another diagram to demo page :doc1, after a1 , 48h - - section Last section - Describe gantt syntax :after doc1, 3d - Add gantt diagram to demo page :20h - Add another diagram to demo page :48h ---stateDiagram - state Active { - Idle - } - Inactive --> Idle: ACT - Active --> Active: LOG --- flowchart TB - accTitle: My flowchart - accDescr: My flowchart Description - subgraph One - a1-->a2-->a3 - end --- sequenceDiagram - A ->> B: 1 - rect rgb(204, 0, 102) - break yes - rect rgb(0, 204, 204) - C ->> C: 0 - end - end - end - B ->> A: Return ---classDiagram -accTitle: My class diagram -accDescr: My class diagram Description -Class01 <|-- AveryLongClass : Cool -Class09 --> C2 : Where am i? -Class09 --* C3 -Class09 --|> Class07 -Class07 : equals() -Class07 : Object[] elementData -Class01 : size() -Class01 : int chimp -Class01 : int gorilla -class Class10 { - int id - size() -} ---%%{init: {'config': {'wrap': true }}}%% - sequenceDiagram - participant A as Extremely utterly long line of longness which had previously overflown the actor box as it is much longer than what it should be - A->>Bob: Hola - Bob-->A: Pasten ! --- gitGraph - commit id: "ZERO" - branch develop - commit id:"A" - checkout main - commit id:"ONE" - checkout develop - commit id:"B" - branch featureA - commit id:"FIX" - commit id: "FIX-2" - checkout main - commit id:"TWO" - cherry-pick id:"A" - commit id:"THREE" - cherry-pick id:"FIX" - checkout develop - commit id:"C" - merge featureA ---flowchart TD - A[Christmas] -->|Get money| B(Go shopping) - B --> C{Let me think} - C -->|One| D[Laptop] - C -->|Two| E[iPhone] - C -->|Three| F[fa:fa-car Car] --- classDiagram - Animal "1" <|-- Duck - Animal <|-- Fish - Animal <--o Zebra - Animal : +int age - Animal : +String gender - Animal: +isMammal() - Animal: +mate() - class Duck{ - +String beakColor - +swim() - +quack() - } - class Fish{ - -int sizeInFeet - -canEat() - } - class Zebra{ - +bool is_wild - +run() - } --- erDiagram - CAR ||--o{ NAMED-DRIVER : allows - CAR { - string registrationNumber - string make - string model - } - PERSON ||--o{ NAMED-DRIVER : is - PERSON { - string firstName - string lastName - int age - } -- - - -