",
- "description": ""
- },
- {
- "name": "Snippet references",
- "pattern": "-- snippet:(.*)",
- "description": ""
- },
- {
- "name": "Snippet references 2",
- "pattern": "\\<\\[sample:(.*)",
- "description": "another kind of snippet reference"
- },
- {
- "name": "Multi-line code blocks",
- "pattern": "/^\\s*```[\\s\\S]*?^\\s*```/gm"
- },
- {
- "name": "HTML Tags",
- "pattern": "<[^>]*>",
- "description": "Reference: https://stackoverflow.com/questions/11229831/regular-expression-to-remove-html-tags-from-a-string"
- }
- ],
- "ignoreRegExpList": [
- "Markdown links",
- "Markdown code blocks",
- "Inline code blocks",
- "Link contents",
- "Snippet references",
- "Snippet references 2",
- "Multi-line code blocks",
- "HTML Tags"
- ],
- "ignorePaths": [
- "packages/mermaid/src/docs/CHANGELOG.md",
- "packages/mermaid/src/docs/.vitepress/redirect.ts",
- "packages/mermaid/src/docs/.vitepress/contributor-names.json"
- ]
-}
diff --git a/cspell.config.yaml b/cspell.config.yaml
new file mode 100644
index 000000000..885a41afd
--- /dev/null
+++ b/cspell.config.yaml
@@ -0,0 +1,45 @@
+# yaml-language-server: $schema=https://raw.githubusercontent.com/streetsidesoftware/cspell/main/cspell.schema.json
+
+$schema: https://raw.githubusercontent.com/streetsidesoftware/cspell/main/cspell.schema.json
+version: '0.2'
+language: en-US,en-GB
+
+import:
+ - ./.cspell/cspell.config.yaml
+
+ignoreRegExpList:
+ - character-set-cyrillic
+ - svg-block
+ignorePaths:
+ - '*lock.{yaml,json}'
+ - dist
+ - CHANGELOG.md
+ - packages/mermaid/src/docs/.vitepress/redirect.ts
+ - packages/mermaid/src/docs/.vitepress/contributor-names.json
+ - backup
+ - '**/*.spec.{js,ts}' # checked by eslint
+ - 'tests/webpack/src/index.js' # checked by eslint
+ - 'cypress/**/*.js' # checked by eslint
+ - '*.csv'
+ - '*.patch'
+ - 'docs/**/*.html'
+ - 'cypress/platform/**'
+dictionaries:
+ - misc-terms
+overrides:
+ - filename:
+ - '**/*.{jison,ts,mts,cjs,mjs,js,json,yaml,yml,md,html}'
+ - 'run'
+ - Dockerfile
+ ignoreRegExpList:
+ - js-unicode-escape
+ dictionaries:
+ - code-terms
+ - 3rd-party-terms
+ - fonts
+ - html
+ - lorem-ipsum
+ - filename: '**/package.json'
+ ignoreRegExpList:
+ - json-property
+# cspell:dictionaries code-terms
diff --git a/cypress/integration/other/configuration.spec.js b/cypress/integration/other/configuration.spec.js
index 23338271f..544eab40f 100644
--- a/cypress/integration/other/configuration.spec.js
+++ b/cypress/integration/other/configuration.spec.js
@@ -118,11 +118,53 @@ describe('Configuration', () => {
it('should not taint the initial configuration when using multiple directives', () => {
const url = 'http://localhost:9000/regression/issue-1874.html';
cy.visit(url);
-
- cy.get('svg');
+ cy.window().should('have.property', 'rendered', true);
+ cy.get('svg').should('be.visible');
cy.matchImageSnapshot(
'configuration.spec-should-not-taint-initial-configuration-when-using-multiple-directives'
);
});
});
+
+ describe('suppressErrorRendering', () => {
+ beforeEach(() => {
+ cy.on('uncaught:exception', (err, runnable) => {
+ return !err.message.includes('Parse error on line');
+ });
+ });
+
+ it('should not render error diagram if suppressErrorRendering is set', () => {
+ const url = 'http://localhost:9000/suppressError.html?suppressErrorRendering=true';
+ cy.visit(url);
+ cy.window().should('have.property', 'rendered', true);
+ cy.get('#test')
+ .find('svg')
+ .should(($svg) => {
+ // all failing diagrams should not appear!
+ expect($svg).to.have.length(2);
+ // none of the diagrams should be error diagrams
+ expect($svg).to.not.contain('Syntax error');
+ });
+ cy.matchImageSnapshot(
+ 'configuration.spec-should-not-render-error-diagram-if-suppressErrorRendering-is-set'
+ );
+ });
+
+ it('should render error diagram if suppressErrorRendering is not set', () => {
+ const url = 'http://localhost:9000/suppressError.html';
+ cy.visit(url);
+ cy.window().should('have.property', 'rendered', true);
+ cy.get('#test')
+ .find('svg')
+ .should(($svg) => {
+ // all five diagrams should be rendered
+ expect($svg).to.have.length(5);
+ // some of the diagrams should be error diagrams
+ expect($svg).to.contain('Syntax error');
+ });
+ cy.matchImageSnapshot(
+ 'configuration.spec-should-render-error-diagram-if-suppressErrorRendering-is-not-set'
+ );
+ });
+ });
});
diff --git a/cypress/integration/rendering/block.spec.js b/cypress/integration/rendering/block.spec.js
new file mode 100644
index 000000000..9d62c642d
--- /dev/null
+++ b/cypress/integration/rendering/block.spec.js
@@ -0,0 +1,386 @@
+import { imgSnapshotTest } from '../../helpers/util';
+/* eslint-disable no-useless-escape */
+describe('Block diagram', () => {
+ it('BL1: should calculate the block widths', () => {
+ imgSnapshotTest(
+ `block-beta
+ columns 2
+ block
+ id2["I am a wide one"]
+ id1
+ end
+ id["Next row"]
+ `
+ );
+ });
+
+ it('BL2: should handle colums statement in sub-blocks', () => {
+ imgSnapshotTest(
+ `block-beta
+ id1["Hello"]
+ block
+ columns 3
+ id2["to"]
+ id3["the"]
+ id4["World"]
+ id5["World"]
+ end
+ `,
+ {}
+ );
+ });
+
+ it('BL3: should align block widths and handle colums statement in sub-blocks', () => {
+ imgSnapshotTest(
+ `block-beta
+ block
+ columns 1
+ id1
+ id2
+ id2.1
+ end
+ id3
+ id4
+ `,
+ {}
+ );
+ });
+
+ it('BL4: should align block widths and handle colums statements in deeper sub-blocks then 1 level', () => {
+ imgSnapshotTest(
+ `block-beta
+ columns 1
+ block
+ columns 1
+ block
+ columns 3
+ id1
+ id2
+ id2.1(("XYZ"))
+ end
+ id48
+ end
+ id3
+ `,
+ {}
+ );
+ });
+
+ it('BL5: should align block widths and handle colums statements in deeper sub-blocks then 1 level (alt)', () => {
+ imgSnapshotTest(
+ `block-beta
+ columns 1
+ block
+ id1
+ id2
+ block
+ columns 1
+ id3("Wider then")
+ id5(("id5"))
+ end
+ end
+ id4
+ `,
+ {}
+ );
+ });
+
+ it('BL6: should handle block arrows and spece statements', () => {
+ imgSnapshotTest(
+ `block-beta
+ columns 3
+ space:3
+ ida idb idc
+ id1 id2
+ blockArrowId<["Label"]>(right)
+ blockArrowId2<["Label"]>(left)
+ blockArrowId3<["Label"]>(up)
+ blockArrowId4<["Label"]>(down)
+ blockArrowId5<["Label"]>(x)
+ blockArrowId6<["Label"]>(y)
+ blockArrowId6<["Label"]>(x, down)
+ `,
+ {}
+ );
+ });
+
+ it('BL7: should handle different types of edges', () => {
+ imgSnapshotTest(
+ `block-beta
+ columns 3
+ A space:5
+ A --o B
+ A --> C
+ A --x D
+ `,
+ {}
+ );
+ });
+
+ it('BL8: should handle sub-blocks without columns statements', () => {
+ imgSnapshotTest(
+ `block-beta
+ columns 2
+ C A B
+ block
+ D
+ E
+ end
+ `,
+ {}
+ );
+ });
+
+ it('BL9: should handle edges from blocks in sub blocks to other blocks', () => {
+ imgSnapshotTest(
+ `block-beta
+ columns 3
+ B space
+ block
+ D
+ end
+ D --> B
+ `,
+ {}
+ );
+ });
+
+ it('BL10: should handle edges from composite blocks', () => {
+ imgSnapshotTest(
+ `block-beta
+ columns 3
+ B space
+ block BL
+ D
+ end
+ BL --> B
+ `,
+ {}
+ );
+ });
+
+ it('BL11: should handle edges to composite blocks', () => {
+ imgSnapshotTest(
+ `block-beta
+ columns 3
+ B space
+ block BL
+ D
+ end
+ B --> BL
+ `,
+ {}
+ );
+ });
+
+ it('BL12: edges should handle labels', () => {
+ imgSnapshotTest(
+ `block-beta
+ A
+ space
+ A -- "apa" --> E
+ `,
+ {}
+ );
+ });
+
+ it('BL13: should handle block arrows in different directions', () => {
+ imgSnapshotTest(
+ `block-beta
+ columns 3
+ space blockArrowId1<["down"]>(down) space
+ blockArrowId2<["right"]>(right) blockArrowId3<["Sync"]>(x, y) blockArrowId4<["left"]>(left)
+ space blockArrowId5<["up"]>(up) space
+ blockArrowId6<["x"]>(x) space blockArrowId7<["y"]>(y)
+ `,
+ {}
+ );
+ });
+
+ it('BL14: should style statements and class statements', () => {
+ imgSnapshotTest(
+ `block-beta
+ A
+ B
+ classDef blue fill:#66f,stroke:#333,stroke-width:2px;
+ class A blue
+ style B fill:#f9F,stroke:#333,stroke-width:4px
+ `,
+ {}
+ );
+ });
+
+ it('BL15: width alignment - D and E should share available space', () => {
+ imgSnapshotTest(
+ `block-beta
+ block
+ D
+ E
+ end
+ db("This is the text in the box")
+ `,
+ {}
+ );
+ });
+
+ it('BL16: width alignment - C should be as wide as the composite block', () => {
+ imgSnapshotTest(
+ `block-beta
+ block
+ A("This is the text")
+ B
+ end
+ C
+ `,
+ {}
+ );
+ });
+
+ it('BL16: width alignment - blocks shold be equal in width', () => {
+ imgSnapshotTest(
+ `block-beta
+ A("This is the text")
+ B
+ C
+ `,
+ {}
+ );
+ });
+
+ it('BL17: block types 1 - square, rounded and circle', () => {
+ imgSnapshotTest(
+ `block-beta
+ A["square"]
+ B("rounded")
+ C(("circle"))
+ `,
+ {}
+ );
+ });
+
+ it('BL18: block types 2 - odd, diamond and hexagon', () => {
+ imgSnapshotTest(
+ `block-beta
+ A>"rect_left_inv_arrow"]
+ B{"diamond"}
+ C{{"hexagon"}}
+ `,
+ {}
+ );
+ });
+
+ it('BL19: block types 3 - stadium', () => {
+ imgSnapshotTest(
+ `block-beta
+ A(["stadium"])
+ `,
+ {}
+ );
+ });
+
+ it('BL20: block types 4 - lean right, lean left, trapezoid and inv trapezoid', () => {
+ imgSnapshotTest(
+ `block-beta
+ A[/"lean right"/]
+ B[\"lean left"\]
+ C[/"trapezoid"\]
+ D[\"trapezoid alt"/]
+ `,
+ {}
+ );
+ });
+
+ it('BL21: block types 1 - square, rounded and circle', () => {
+ imgSnapshotTest(
+ `block-beta
+ A["square"]
+ B("rounded")
+ C(("circle"))
+ `,
+ {}
+ );
+ });
+
+ it('BL22: sizing - it should be possible to make a block wider', () => {
+ imgSnapshotTest(
+ `block-beta
+ A("rounded"):2
+ B:2
+ C
+ `,
+ {}
+ );
+ });
+
+ it('BL23: sizing - it should be possible to make a composite block wider', () => {
+ imgSnapshotTest(
+ `block-beta
+ block:2
+ A
+ end
+ B
+ `,
+ {}
+ );
+ });
+
+ it('BL24: block in the middle with space on each side', () => {
+ imgSnapshotTest(
+ `block-beta
+ columns 3
+ space
+ middle["In the middle"]
+ space
+ `,
+ {}
+ );
+ });
+ it('BL25: space and an edge', () => {
+ imgSnapshotTest(
+ `block-beta
+ columns 5
+ A space B
+ A --x B
+ `,
+ {}
+ );
+ });
+ it('BL26: block sizes for regular blocks', () => {
+ imgSnapshotTest(
+ `block-beta
+ columns 3
+ a["A wide one"] b:2 c:2 d
+ `,
+ {}
+ );
+ });
+ it('BL27: composite block with a set width - f should use the available space', () => {
+ imgSnapshotTest(
+ `block-beta
+ columns 3
+ a:3
+ block:e:3
+ f
+ end
+ g
+ `,
+ {}
+ );
+ });
+ it('BL23: composite block with a set width - f and g should split the available space', () => {
+ imgSnapshotTest(
+ `block-beta
+ columns 3
+ a:3
+ block:e:3
+ f
+ g
+ end
+ h
+ i
+ j
+ `,
+ {}
+ );
+ });
+});
diff --git a/cypress/integration/rendering/flowchart-elk.spec.js b/cypress/integration/rendering/flowchart-elk.spec.js
index 221806b07..e931025e9 100644
--- a/cypress/integration/rendering/flowchart-elk.spec.js
+++ b/cypress/integration/rendering/flowchart-elk.spec.js
@@ -844,3 +844,42 @@ end
});
});
});
+
+describe('Title and arrow styling #4813', () => {
+ it('should render a flowchart with title', () => {
+ const titleString = 'Test Title';
+ renderGraph(
+ `---
+ title: ${titleString}
+ ---
+ flowchart LR
+ A-->B
+ A-->C`,
+ { flowchart: { defaultRenderer: 'elk' } }
+ );
+ cy.get('svg').should((svg) => {
+ const title = svg[0].querySelector('text');
+ expect(title.textContent).to.contain(titleString);
+ });
+ });
+
+ it('Render with stylized arrows', () => {
+ renderGraph(
+ `
+ flowchart LR
+ A-->B
+ B-.-oC
+ C==xD
+ D ~~~ A`,
+ { flowchart: { defaultRenderer: 'elk' } }
+ );
+ cy.get('svg').should((svg) => {
+ const edges = svg[0].querySelectorAll('.edges path');
+ console.log(edges);
+ expect(edges[0]).to.have.attr('pattern', 'solid');
+ expect(edges[1]).to.have.attr('pattern', 'dotted');
+ expect(edges[2]).to.have.css('stroke-width', '3.5px');
+ expect(edges[3]).to.have.css('stroke-width', '1.5px');
+ });
+ });
+});
diff --git a/cypress/integration/rendering/flowchart-v2.spec.js b/cypress/integration/rendering/flowchart-v2.spec.js
index 857d395be..3eb2a0432 100644
--- a/cypress/integration/rendering/flowchart-v2.spec.js
+++ b/cypress/integration/rendering/flowchart-v2.spec.js
@@ -760,6 +760,51 @@ A ~~~ B
);
});
+ it('3258: Should render subgraphs with main graph nodeSpacing and rankSpacing', () => {
+ imgSnapshotTest(
+ `---
+ title: Subgraph nodeSpacing and rankSpacing example
+ ---
+ flowchart LR
+ X --> Y
+ subgraph X
+ direction LR
+ A
+ C
+ end
+ subgraph Y
+ B
+ D
+ end
+ `,
+ { flowchart: { nodeSpacing: 1, rankSpacing: 1 } }
+ );
+ });
+
+ it('3258: Should render subgraphs with large nodeSpacing and rankSpacing', () => {
+ imgSnapshotTest(
+ `---
+ title: Subgraph nodeSpacing and rankSpacing example
+ config:
+ flowchart:
+ nodeSpacing: 250
+ rankSpacing: 250
+ ---
+ flowchart LR
+ X --> Y
+ subgraph X
+ direction LR
+ A
+ C
+ end
+ subgraph Y
+ B
+ D
+ end
+ `
+ );
+ });
+
describe('Markdown strings flowchart (#4220)', () => {
describe('html labels', () => {
it('With styling and classes', () => {
@@ -904,6 +949,18 @@ end
);
});
});
+
+ it('should not auto wrap when markdownAutoWrap is false', () => {
+ imgSnapshotTest(
+ `flowchart TD
+ angular_velocity["\`**angular_velocity**
+ *angular_displacement / duration*
+ [rad/s, 1/s]
+ {vector}\`"]
+ frequency["frequency\n(1 / period_duration)\n[Hz, 1/s]"]`,
+ { markdownAutoWrap: false }
+ );
+ });
});
describe('Subgraph title margins', () => {
it('Should render subgraphs with title margins set (LR)', () => {
diff --git a/cypress/integration/rendering/gantt.spec.js b/cypress/integration/rendering/gantt.spec.js
index 73ff4ee00..a0c2dbcb9 100644
--- a/cypress/integration/rendering/gantt.spec.js
+++ b/cypress/integration/rendering/gantt.spec.js
@@ -92,6 +92,31 @@ describe('Gantt diagram', () => {
{}
);
});
+ it('should handle multiple dependencies syntax with after and until', () => {
+ imgSnapshotTest(
+ `
+ gantt
+ dateFormat YYYY-MM-DD
+ axisFormat %d/%m
+ title Adding GANTT diagram to mermaid
+ excludes weekdays 2014-01-10
+ todayMarker off
+
+ section team's critical event
+ deadline A :milestone, crit, deadlineA, 2024-02-01, 0
+ deadline B :milestone, crit, deadlineB, 2024-02-15, 0
+ boss on leave :bossaway, 2024-01-28, 2024-02-11
+
+ section new intern
+ onboarding :onboarding, 2024-01-02, 1w
+ literature review :litreview, 2024-01-02, 10d
+ project A :projectA, after onboarding litreview, until deadlineA bossaway
+ chilling :chilling, after projectA, until deadlineA
+ project B :projectB, after deadlineA, until deadlineB
+ `,
+ {}
+ );
+ });
it('should FAIL redering a gantt chart for issue #1060 with invalid date', () => {
imgSnapshotTest(
`
@@ -548,7 +573,28 @@ describe('Gantt diagram', () => {
`
);
});
-
+ it('should render a gantt diagram exculding friday and saturday', () => {
+ imgSnapshotTest(
+ `gantt
+ title A Gantt Diagram
+ dateFormat YYYY-MM-DD
+ excludes weekends
+ weekend friday
+ section Section1
+ A task :a1, 2024-02-28, 10d`
+ );
+ });
+ it('should render a gantt diagram exculding saturday and sunday', () => {
+ imgSnapshotTest(
+ `gantt
+ title A Gantt Diagram
+ dateFormat YYYY-MM-DD
+ excludes weekends
+ weekend saturday
+ section Section1
+ A task :a1, 2024-02-28, 10d`
+ );
+ });
it('should render when compact is true', () => {
imgSnapshotTest(
`
@@ -583,4 +629,106 @@ describe('Gantt diagram', () => {
{}
);
});
+
+ it("should render when there's a semicolon in the title", () => {
+ imgSnapshotTest(
+ `
+ gantt
+ title ;Gantt With a Semicolon in the Title
+ dateFormat YYYY-MM-DD
+ section Section
+ A task :a1, 2014-01-01, 30d
+ Another task :after a1 , 20d
+ section Another
+ Task in sec :2014-01-12 , 12d
+ another task : 24d
+ `,
+ {}
+ );
+ });
+
+ it("should render when there's a semicolon in a section is true", () => {
+ imgSnapshotTest(
+ `
+ gantt
+ title Gantt Digram
+ dateFormat YYYY-MM-DD
+ section ;Section With a Semicolon
+ A task :a1, 2014-01-01, 30d
+ Another task :after a1 , 20d
+ section Another
+ Task in sec :2014-01-12 , 12d
+ another task : 24d
+ `,
+ {}
+ );
+ });
+
+ it("should render when there's a semicolon in the task data", () => {
+ imgSnapshotTest(
+ `
+ gantt
+ title Gantt Digram
+ dateFormat YYYY-MM-DD
+ section Section
+ ;A task with a semiclon :a1, 2014-01-01, 30d
+ Another task :after a1 , 20d
+ section Another
+ Task in sec :2014-01-12 , 12d
+ another task : 24d
+ `,
+ {}
+ );
+ });
+
+ it("should render when there's a hashtag in the title", () => {
+ imgSnapshotTest(
+ `
+ gantt
+ title #Gantt With a Hashtag in the Title
+ dateFormat YYYY-MM-DD
+ section Section
+ A task :a1, 2014-01-01, 30d
+ Another task :after a1 , 20d
+ section Another
+ Task in sec :2014-01-12 , 12d
+ another task : 24d
+ `,
+ {}
+ );
+ });
+
+ it("should render when there's a hashtag in a section is true", () => {
+ imgSnapshotTest(
+ `
+ gantt
+ title Gantt Digram
+ dateFormat YYYY-MM-DD
+ section #Section With a Hashtag
+ A task :a1, 2014-01-01, 30d
+ Another task :after a1 , 20d
+ section Another
+ Task in sec :2014-01-12 , 12d
+ another task : 24d
+ `,
+ {}
+ );
+ });
+
+ it("should render when there's a hashtag in the task data", () => {
+ imgSnapshotTest(
+ `
+ gantt
+ title Gantt Digram
+ dateFormat YYYY-MM-DD
+ section Section
+ #A task with a hashtag :a1, 2014-01-01, 30d
+ Another task :after a1 , 20d
+ section Another
+ Task in sec :2014-01-12 , 12d
+ another task : 24d
+ `,
+ {}
+ );
+ });
});
diff --git a/cypress/integration/rendering/gitGraph.spec.js b/cypress/integration/rendering/gitGraph.spec.js
index 19ddde31d..68b63de46 100644
--- a/cypress/integration/rendering/gitGraph.spec.js
+++ b/cypress/integration/rendering/gitGraph.spec.js
@@ -943,4 +943,594 @@ gitGraph TB:
{ gitGraph: { parallelCommits: true } }
);
});
+ it('46: should render GitGraph with merge back and merge forward', () => {
+ imgSnapshotTest(
+ `gitGraph LR:
+ commit id:"1-abcdefg"
+
+ branch branch-A
+ branch branch-B
+ commit id:"2-abcdefg"
+
+ checkout branch-A
+ merge branch-B
+
+ checkout branch-B
+ merge branch-A
+ `,
+ { gitGraph: { parallelCommits: true } }
+ );
+ });
+ it('47: should render GitGraph with merge back and merge forward | Vertical Branch', () => {
+ imgSnapshotTest(
+ `gitGraph TB:
+ commit id:"1-abcdefg"
+
+ branch branch-A
+ branch branch-B
+ commit id:"2-abcdefg"
+
+ checkout branch-A
+ merge branch-B
+
+ checkout branch-B
+ merge branch-A
+ `,
+ { gitGraph: { parallelCommits: true } }
+ );
+ });
+ it('48: should render GitGraph with merge on a new branch | Vertical Branch', () => {
+ imgSnapshotTest(
+ `gitGraph LR:
+ commit id:"1-abcdefg"
+
+ branch branch-B order: 2
+ commit id:"2-abcdefg"
+
+ branch branch-A
+ merge main
+
+ checkout branch-B
+ merge branch-A
+ `,
+ { gitGraph: { parallelCommits: true } }
+ );
+ });
+ it('49: should render GitGraph with merge on a new branch | Vertical Branch', () => {
+ imgSnapshotTest(
+ `gitGraph TB:
+ commit id:"1-abcdefg"
+
+ branch branch-B order: 2
+ commit id:"2-abcdefg"
+
+ branch branch-A
+ merge main
+
+ checkout branch-B
+ merge branch-A
+ `,
+ { gitGraph: { parallelCommits: true } }
+ );
+ });
+ describe('Git-Graph Bottom-to-Top Orientation Tests', () => {
+ it('50: should render a simple gitgraph with commit on main branch | Vertical Branch - Bottom-to-top', () => {
+ imgSnapshotTest(
+ `gitGraph BT:
+ commit id: "1"
+ commit id: "2"
+ commit id: "3"
+ `,
+ {}
+ );
+ });
+ it('51: should render a simple gitgraph with commit on main branch with Id | Vertical Branch - Bottom-to-top', () => {
+ imgSnapshotTest(
+ `gitGraph BT:
+ commit id: "One"
+ commit id: "Two"
+ commit id: "Three"
+ `,
+ {}
+ );
+ });
+ it('52: should render a simple gitgraph with different commitTypes on main branch | Vertical Branch - Bottom-to-top', () => {
+ imgSnapshotTest(
+ `gitGraph BT:
+ commit id: "Normal Commit"
+ commit id: "Reverse Commit" type: REVERSE
+ commit id: "Highlight Commit" type: HIGHLIGHT
+ `,
+ {}
+ );
+ });
+ it('53: should render a simple gitgraph with tags commitTypes on main branch | Vertical Branch - Bottom-to-top', () => {
+ imgSnapshotTest(
+ `gitGraph BT:
+ commit id: "Normal Commit with tag" tag: "v1.0.0"
+ commit id: "Reverse Commit with tag" type: REVERSE tag: "RC_1"
+ commit id: "Highlight Commit" type: HIGHLIGHT tag: "8.8.4"
+ `,
+ {}
+ );
+ });
+ it('54: should render a simple gitgraph with two branches | Vertical Branch - Bottom-to-top', () => {
+ imgSnapshotTest(
+ `gitGraph BT:
+ commit id: "1"
+ commit id: "2"
+ branch develop
+ checkout develop
+ commit id: "3"
+ commit id: "4"
+ checkout main
+ commit id: "5"
+ commit id: "6"
+ `,
+ {}
+ );
+ });
+ it('55: should render a simple gitgraph with two branches and merge commit | Vertical Branch - Bottom-to-top', () => {
+ imgSnapshotTest(
+ `gitGraph BT:
+ commit id: "1"
+ commit id: "2"
+ branch develop
+ checkout develop
+ commit id: "3"
+ commit id: "4"
+ checkout main
+ merge develop
+ commit id: "5"
+ commit id: "6"
+ `,
+ {}
+ );
+ });
+ it('56: should render a simple gitgraph with three branches and tagged merge commit | Vertical Branch - Bottom-to-top', () => {
+ imgSnapshotTest(
+ `gitGraph BT:
+ commit id: "1"
+ commit id: "2"
+ branch nice_feature
+ checkout nice_feature
+ commit id: "3"
+ checkout main
+ commit id: "4"
+ checkout nice_feature
+ branch very_nice_feature
+ checkout very_nice_feature
+ commit id: "5"
+ checkout main
+ commit id: "6"
+ checkout nice_feature
+ commit id: "7"
+ checkout main
+ merge nice_feature id: "12345" tag: "my merge commit"
+ checkout very_nice_feature
+ commit id: "8"
+ checkout main
+ commit id: "9"
+ `,
+ {}
+ );
+ });
+ it('57: should render a simple gitgraph with more than 8 branches & overriding variables | Vertical Branch - Bottom-to-top', () => {
+ imgSnapshotTest(
+ `%%{init: { 'logLevel': 'debug', 'theme': 'default' , 'themeVariables': {
+ 'gitBranchLabel0': '#ffffff',
+ 'gitBranchLabel1': '#ffffff',
+ 'gitBranchLabel2': '#ffffff',
+ 'gitBranchLabel3': '#ffffff',
+ 'gitBranchLabel4': '#ffffff',
+ 'gitBranchLabel5': '#ffffff',
+ 'gitBranchLabel6': '#ffffff',
+ 'gitBranchLabel7': '#ffffff',
+ } } }%%
+ gitGraph BT:
+ checkout main
+ branch branch1
+ branch branch2
+ branch branch3
+ branch branch4
+ branch branch5
+ branch branch6
+ branch branch7
+ branch branch8
+ branch branch9
+ checkout branch1
+ commit id: "1"
+ `,
+ {}
+ );
+ });
+ it('58: should render a simple gitgraph with rotated labels | Vertical Branch - Bottom-to-top', () => {
+ imgSnapshotTest(
+ `%%{init: { 'logLevel': 'debug', 'theme': 'default' , 'gitGraph': {
+ 'rotateCommitLabel': true
+ } } }%%
+ gitGraph BT:
+ commit id: "75f7219e83b321cd3fdde7dcf83bc7c1000a6828"
+ commit id: "0db4784daf82736dec4569e0dc92980d328c1f2e"
+ commit id: "7067e9973f9eaa6cd4a4b723c506d1eab598e83e"
+ commit id: "66972321ad6c199013b5b31f03b3a86fa3f9817d"
+ `,
+ {}
+ );
+ });
+ it('59: should render a simple gitgraph with horizontal labels | Vertical Branch - Bottom-to-top', () => {
+ imgSnapshotTest(
+ `%%{init: { 'logLevel': 'debug', 'theme': 'default' , 'gitGraph': {
+ 'rotateCommitLabel': false
+ } } }%%
+ gitGraph BT:
+ commit id: "Alpha"
+ commit id: "Beta"
+ commit id: "Gamma"
+ commit id: "Delta"
+ `,
+ {}
+ );
+ });
+ it('60: should render a simple gitgraph with cherry pick commit | Vertical Branch - Bottom-to-top', () => {
+ imgSnapshotTest(
+ `
+ gitGraph BT:
+ commit id: "ZERO"
+ branch develop
+ commit id:"A"
+ checkout main
+ commit id:"ONE"
+ checkout develop
+ commit id:"B"
+ checkout main
+ commit id:"TWO"
+ cherry-pick id:"A"
+ commit id:"THREE"
+ checkout develop
+ commit id:"C"
+ `,
+ {}
+ );
+ });
+ it('61: should render a gitgraph with cherry pick commit with custom tag | Vertical Branch - Bottom-to-top', () => {
+ imgSnapshotTest(
+ `
+ gitGraph BT:
+ commit id: "ZERO"
+ branch develop
+ commit id:"A"
+ checkout main
+ commit id:"ONE"
+ checkout develop
+ commit id:"B"
+ checkout main
+ commit id:"TWO"
+ cherry-pick id:"A" tag: "snapshot"
+ commit id:"THREE"
+ checkout develop
+ commit id:"C"
+ `,
+ {}
+ );
+ });
+ it('62: should render a gitgraph with cherry pick commit with no tag | Vertical Branch - Bottom-to-top', () => {
+ imgSnapshotTest(
+ `
+ gitGraph BT:
+ commit id: "ZERO"
+ branch develop
+ commit id:"A"
+ checkout main
+ commit id:"ONE"
+ checkout develop
+ commit id:"B"
+ checkout main
+ commit id:"TWO"
+ cherry-pick id:"A" tag: ""
+ commit id:"THREE"
+ checkout develop
+ commit id:"C"
+ `,
+ {}
+ );
+ });
+ it('63: should render a simple gitgraph with two cherry pick commit | Vertical Branch - Bottom-to-top', () => {
+ imgSnapshotTest(
+ `
+ gitGraph BT:
+ 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
+ `,
+ {}
+ );
+ });
+ it('64: should render commits for more than 8 branches | Vertical Branch - Bottom-to-top', () => {
+ imgSnapshotTest(
+ `
+ gitGraph BT:
+ checkout main
+ %% Make sure to manually set the ID of all commits, for consistent visual tests
+ commit id: "1-abcdefg"
+ checkout main
+ branch branch1
+ commit id: "2-abcdefg"
+ checkout main
+ merge branch1
+ branch branch2
+ commit id: "3-abcdefg"
+ checkout main
+ merge branch2
+ branch branch3
+ commit id: "4-abcdefg"
+ checkout main
+ merge branch3
+ branch branch4
+ commit id: "5-abcdefg"
+ checkout main
+ merge branch4
+ branch branch5
+ commit id: "6-abcdefg"
+ checkout main
+ merge branch5
+ branch branch6
+ commit id: "7-abcdefg"
+ checkout main
+ merge branch6
+ branch branch7
+ commit id: "8-abcdefg"
+ checkout main
+ merge branch7
+ branch branch8
+ commit id: "9-abcdefg"
+ checkout main
+ merge branch8
+ branch branch9
+ commit id: "10-abcdefg"
+ `,
+ {}
+ );
+ });
+ it('65: should render a simple gitgraph with three branches,custom merge commit id,tag,type | Vertical Branch - Bottom-to-top', () => {
+ imgSnapshotTest(
+ `gitGraph BT:
+ commit id: "1"
+ commit id: "2"
+ branch nice_feature
+ checkout nice_feature
+ commit id: "3"
+ checkout main
+ commit id: "4"
+ checkout nice_feature
+ branch very_nice_feature
+ checkout very_nice_feature
+ commit id: "5"
+ checkout main
+ commit id: "6"
+ checkout nice_feature
+ commit id: "7"
+ checkout main
+ merge nice_feature id: "customID" tag: "customTag" type: REVERSE
+ checkout very_nice_feature
+ commit id: "8"
+ checkout main
+ commit id: "9"
+ `,
+ {}
+ );
+ });
+ it('66: should render a simple gitgraph with a title | Vertical Branch - Bottom-to-top', () => {
+ imgSnapshotTest(
+ `---
+ title: simple gitGraph
+ ---
+ gitGraph BT:
+ commit id: "1-abcdefg"
+ `,
+ {}
+ );
+ });
+ it('67: should render a simple gitgraph overlapping commits | Vertical Branch - Bottom-to-top', () => {
+ imgSnapshotTest(
+ `gitGraph BT:
+ commit id:"s1"
+ commit id:"s2"
+ branch branch1
+ commit id:"s3"
+ commit id:"s4"
+ checkout main
+ commit id:"s5"
+ checkout branch1
+ commit id:"s6"
+ commit id:"s7"
+ merge main
+ `,
+ {}
+ );
+ });
+ it('68: should render a simple gitgraph with two branches from same commit | Vertical Branch - Bottom-to-top', () => {
+ imgSnapshotTest(
+ `gitGraph BT:
+ commit id:"1-abcdefg"
+ commit id:"2-abcdefg"
+ branch feature-001
+ commit id:"3-abcdefg"
+ commit id:"4-abcdefg"
+ checkout main
+ branch feature-002
+ commit id:"5-abcdefg"
+ checkout feature-001
+ merge feature-002
+ `,
+ {}
+ );
+ });
+ it('69: should render GitGraph with branch that is not used immediately | Vertical Branch - Bottom-to-top', () => {
+ imgSnapshotTest(
+ `gitGraph BT:
+ commit id:"1-abcdefg"
+ branch x
+ checkout main
+ commit id:"2-abcdefg"
+ checkout x
+ commit id:"3-abcdefg"
+ checkout main
+ merge x
+ `,
+ {}
+ );
+ });
+ it('70: should render GitGraph with branch and sub-branch neither of which used immediately | Vertical Branch - Bottom-to-top', () => {
+ imgSnapshotTest(
+ `gitGraph BT:
+ commit id:"1-abcdefg"
+ branch x
+ checkout main
+ commit id:"2-abcdefg"
+ checkout x
+ commit id:"3-abcdefg"
+ checkout main
+ merge x
+ checkout x
+ branch y
+ checkout x
+ commit id:"4-abcdefg"
+ checkout y
+ commit id:"5-abcdefg"
+ checkout x
+ merge y
+ `,
+ {}
+ );
+ });
+ it('71: should render GitGraph with parallel commits | Vertical Branch - Bottom-to-top', () => {
+ imgSnapshotTest(
+ `gitGraph BT:
+ commit id:"1-abcdefg"
+ commit id:"2-abcdefg"
+ branch develop
+ commit id:"3-abcdefg"
+ commit id:"4-abcdefg"
+ checkout main
+ branch feature
+ commit id:"5-abcdefg"
+ commit id:"6-abcdefg"
+ checkout main
+ commit id:"7-abcdefg"
+ commit id:"8-abcdefg"
+ `,
+ { gitGraph: { parallelCommits: true } }
+ );
+ });
+ it('72: should render GitGraph with unconnected branches and parallel commits | Vertical Branch - Bottom-to-top', () => {
+ imgSnapshotTest(
+ `gitGraph BT:
+ branch dev
+ branch v2
+ branch feat
+ commit id:"1-abcdefg"
+ commit id:"2-abcdefg"
+ checkout main
+ commit id:"3-abcdefg"
+ checkout dev
+ commit id:"4-abcdefg"
+ checkout v2
+ commit id:"5-abcdefg"
+ checkout main
+ commit id:"6-abcdefg"
+ `,
+ { gitGraph: { parallelCommits: true } }
+ );
+ });
+ it('73: should render a simple gitgraph with three branches and tagged merge commit using switch instead of checkout', () => {
+ imgSnapshotTest(
+ `gitGraph
+ commit id: "1"
+ commit id: "2"
+ branch nice_feature
+ switch nice_feature
+ commit id: "3"
+ switch main
+ commit id: "4"
+ switch nice_feature
+ branch very_nice_feature
+ switch very_nice_feature
+ commit id: "5"
+ switch main
+ commit id: "6"
+ switch nice_feature
+ commit id: "7"
+ switch main
+ merge nice_feature id: "12345" tag: "my merge commit"
+ switch very_nice_feature
+ commit id: "8"
+ switch main
+ commit id: "9"
+ `,
+ {}
+ );
+ });
+ it('74: should render commits for more than 8 branches using switch instead of checkout', () => {
+ imgSnapshotTest(
+ `
+ gitGraph
+ switch main
+ %% Make sure to manually set the ID of all commits, for consistent visual tests
+ commit id: "1-abcdefg"
+ switch main
+ branch branch1
+ commit id: "2-abcdefg"
+ switch main
+ merge branch1
+ branch branch2
+ commit id: "3-abcdefg"
+ switch main
+ merge branch2
+ branch branch3
+ commit id: "4-abcdefg"
+ switch main
+ merge branch3
+ branch branch4
+ commit id: "5-abcdefg"
+ switch main
+ merge branch4
+ branch branch5
+ commit id: "6-abcdefg"
+ switch main
+ merge branch5
+ branch branch6
+ commit id: "7-abcdefg"
+ switch main
+ merge branch6
+ branch branch7
+ commit id: "8-abcdefg"
+ switch main
+ merge branch7
+ branch branch8
+ commit id: "9-abcdefg"
+ switch main
+ merge branch8
+ branch branch9
+ commit id: "10-abcdefg"
+ `,
+ {}
+ );
+ });
+ });
});
diff --git a/cypress/integration/rendering/katex.spec.js b/cypress/integration/rendering/katex.spec.js
new file mode 100644
index 000000000..fb1d13392
--- /dev/null
+++ b/cypress/integration/rendering/katex.spec.js
@@ -0,0 +1,36 @@
+import { imgSnapshotTest } from '../../helpers/util';
+
+describe('Katex', () => {
+ it('1: should render a complex Katex flowchart no htmlLabels', () => {
+ imgSnapshotTest(
+ `graph LR
+ A["$$f(\\relax{x}) = \\int_{-\\infty}^\\infty \\hat{f}(\\xi)\\,e^{2 \\pi i \\xi x}\\,d\\xi$$"] -->|"$$\\Bigg(\\bigg(\\Big(\\big((\\frac{-b\\pm\\sqrt{b^2-4ac}}{2a})\\big)\\Big)\\bigg)\\Bigg)$$"| B("$$1+\\frac{e^{-2\\pi}} {1+\\frac{e^{-4\\pi}} {1+\\frac{e^{-6\\pi}} {1+\\frac{e^{-8\\pi}} {1+\\cdots}}}}$$")
+ A -->|"$$\\overbrace{a+b+c}^{\\text{note}}$$"| C("$$\\phase{-78^\\circ}$$")
+ B --> D("$$x = \\begin{cases} a &\\text{if } b \\\\ c &\\text{if } d \\end{cases}$$")
+ C --> E("$$x(t)=c_1\\begin{bmatrix}-\\cos{t}+\\sin{t}\\\\ 2\\cos{t} \\end{bmatrix}e^{2t}$$")`,
+ { fontFamily: 'courier' }
+ );
+ });
+ it('2: should render a Katex flowchart containing the Greek alphabet', () => {
+ imgSnapshotTest(
+ `graph LR
+ A["$$\\alpha\\beta\\gamma\\delta\\epsilon\\zeta\\eta\\theta\\iota\\kappa\\lambda\\mu\\nu\\xi\\omicron\\pi\\rho\\sigma\\tau\\upsilon\\phi\\chi\\psi\\omega$$"] --> B["$$\\Alpha\\Beta\\Gamma\\Delta\\Epsilon\\Zeta\\Eta\\Theta\\Iota\\Kappa\\Lambda\\Mu\\Nu\\Xi\\Omicron\\Pi\\Rho\\Sigma\\Tau\\Upsilon\\Phi\\Chi\\Psi\\Omega$$"]`,
+ { fontFamily: 'courier' }
+ );
+ });
+ it('3: should render a Katex flowchart containing set theory symbols', () => {
+ imgSnapshotTest(
+ `graph LR
+ A["$$\\forall\\complement\\therefore\\emptyset\\exists\\subset\\because\\empty\\exist\\supset\\mapsto\\varnothing\\nexists\\mid\\to\\implies\\in\\land\\gets\\impliedby\\isin\\lor\\leftrightarrow\\iff\\notin\\ni\\notni\\lnot$$"] --> B["$$\\nabla\\Im\\Reals\\jmath\\partial\\image\\wp\\aleph\\Game\\weierp\\alef\\Finv\\N\\Z\\alefsym\\cnums\\natnums\\beth\\Complex\\R\\gimel\\ell\\Re\\daleth\\hbar\\real\\eth\\hslash\\reals$$"]`,
+ { fontFamily: 'courier' }
+ );
+ });
+ // TODO: changes made to develop between Feb 13 - Feb 23 cause this test to no longer function
+ // it.skip('4: should render an error box originating from Katex', () => {
+ // imgSnapshotTest(
+ // `graph LR
+ // A["$$\\shouldBeError$$"]`,
+ // { fontFamily: 'courier' }
+ // );
+ // });
+});
diff --git a/cypress/integration/rendering/quadrantChart.spec.js b/cypress/integration/rendering/quadrantChart.spec.js
index 1be1f7def..83a1455c6 100644
--- a/cypress/integration/rendering/quadrantChart.spec.js
+++ b/cypress/integration/rendering/quadrantChart.spec.js
@@ -1,4 +1,4 @@
-import { imgSnapshotTest, renderGraph } from '../../helpers/util.ts';
+import { imgSnapshotTest } from '../../helpers/util.ts';
describe('Quadrant Chart', () => {
it('should render if only chart type is provided', () => {
@@ -226,4 +226,52 @@ describe('Quadrant Chart', () => {
);
cy.get('svg');
});
+
+ it('it should render data points with styles', () => {
+ imgSnapshotTest(
+ `
+ quadrantChart
+ title Reach and engagement of campaigns
+ x-axis Reach -->
+ y-axis 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] radius: 20
+ Campaign B: [0.45, 0.23] color: #ff0000
+ Campaign C: [0.57, 0.69] stroke-color: #ff00ff
+ Campaign D: [0.78, 0.34] stroke-width: 3px
+ Campaign E: [0.40, 0.34] radius: 20, color: #ff0000 , stroke-color : #ff00ff, stroke-width : 3px
+ Campaign F: [0.35, 0.78] stroke-width: 3px , color: #ff0000, radius: 20, stroke-color: #ff00ff
+ Campaign G: [0.22, 0.22] stroke-width: 3px , color: #309708 , radius : 20 , stroke-color: #5060ff
+ Campaign H: [0.22, 0.44]
+ `,
+ {}
+ );
+ cy.get('svg');
+ });
+
+ it('it should render data points with styles + classes', () => {
+ imgSnapshotTest(
+ `
+ quadrantChart
+ title Reach and engagement of campaigns
+ x-axis Reach -->
+ y-axis Engagement -->
+ quadrant-1 We should expand
+ quadrant-2 Need to promote
+ quadrant-3 Re-evaluate
+ quadrant-4 May be improved
+ Campaign A:::class1: [0.3, 0.6] radius: 20
+ Campaign B: [0.45, 0.23] color: #ff0000
+ Campaign C: [0.57, 0.69] stroke-color: #ff00ff
+ Campaign D:::class2: [0.78, 0.34] stroke-width: 3px
+ Campaign E:::class2: [0.40, 0.34] radius: 20, color: #ff0000, stroke-color: #ff00ff, stroke-width: 3px
+ Campaign F:::class1: [0.35, 0.78]
+ classDef class1 color: #908342, radius : 10, stroke-color: #310085, stroke-width: 10px
+ classDef class2 color: #f00fff, radius : 10
+ `
+ );
+ });
});
diff --git a/cypress/integration/rendering/sequencediagram.spec.js b/cypress/integration/rendering/sequencediagram.spec.js
index 27e03da9c..1285a0832 100644
--- a/cypress/integration/rendering/sequencediagram.spec.js
+++ b/cypress/integration/rendering/sequencediagram.spec.js
@@ -375,6 +375,29 @@ context('Sequence diagram', () => {
{}
);
});
+ it('should have actor-top and actor-bottom classes on top and bottom actor box and symbol and actor-box and actor-man classes for text tags', () => {
+ imgSnapshotTest(
+ `
+ sequenceDiagram
+ actor Bob
+ Alice->>Bob: Hi Bob
+ Bob->>Alice: Hi Alice
+ `,
+ {}
+ );
+ cy.get('.actor').should('have.class', 'actor-top');
+ cy.get('.actor-man').should('have.class', 'actor-top');
+ cy.get('.actor.actor-top').should('not.have.class', 'actor-bottom');
+ cy.get('.actor-man.actor-top').should('not.have.class', 'actor-bottom');
+
+ cy.get('.actor').should('have.class', 'actor-bottom');
+ cy.get('.actor-man').should('have.class', 'actor-bottom');
+ cy.get('.actor.actor-bottom').should('not.have.class', 'actor-top');
+ cy.get('.actor-man.actor-bottom').should('not.have.class', 'actor-top');
+
+ cy.get('text.actor-box').should('include.text', 'Alice');
+ cy.get('text.actor-man').should('include.text', 'Bob');
+ });
it('should render long notes left of actor', () => {
imgSnapshotTest(
`
@@ -787,11 +810,42 @@ context('Sequence diagram', () => {
note left of Alice: config: mirrorActors=true directive: mirrorActors=false
Bob->>Alice: Short as well
`,
- { logLevel: 0, sequence: { mirrorActors: true, noteFontSize: 18, noteFontFamily: 'Arial' } }
+ {
+ logLevel: 0,
+ sequence: { mirrorActors: true, noteFontSize: 18, noteFontFamily: 'Arial' },
+ }
);
});
});
context('links', () => {
+ it('should support actor links', () => {
+ renderGraph(
+ `
+ sequenceDiagram
+ link Alice: Dashboard @ https://dashboard.contoso.com/alice
+ link Alice: Wiki @ https://wiki.contoso.com/alice
+ link John: Dashboard @ https://dashboard.contoso.com/john
+ link John: Wiki @ https://wiki.contoso.com/john
+ Alice->>John: Hello John
+ John-->>Alice: Great day!
+ `,
+ { securityLevel: 'loose' }
+ );
+ cy.get('#actor0_popup').should((popupMenu) => {
+ const style = popupMenu.attr('style');
+ expect(style).to.undefined;
+ });
+ cy.get('#root-0').click();
+ cy.get('#actor0_popup').should((popupMenu) => {
+ const style = popupMenu.attr('style');
+ expect(style).to.match(/^display: block;$/);
+ });
+ cy.get('#root-0').click();
+ cy.get('#actor0_popup').should((popupMenu) => {
+ const style = popupMenu.attr('style');
+ expect(style).to.match(/^display: none;$/);
+ });
+ });
it('should support actor links and properties EXPERIMENTAL: USE WITH CAUTION', () => {
//Be aware that the syntax for "properties" is likely to be changed.
imgSnapshotTest(
@@ -810,7 +864,10 @@ context('Sequence diagram', () => {
a->>j: Hello John, how are you?
j-->>a: Great!
`,
- { logLevel: 0, sequence: { mirrorActors: true, noteFontSize: 18, noteFontFamily: 'Arial' } }
+ {
+ logLevel: 0,
+ sequence: { mirrorActors: true, noteFontSize: 18, noteFontFamily: 'Arial' },
+ }
);
});
it('should support actor links and properties when not mirrored EXPERIMENTAL: USE WITH CAUTION', () => {
diff --git a/cypress/platform/ashish2.html b/cypress/platform/ashish2.html
index 76fbd36f7..f9132d2e2 100644
--- a/cypress/platform/ashish2.html
+++ b/cypress/platform/ashish2.html
@@ -4,7 +4,7 @@
+
diff --git a/cypress/platform/click_security_other.html b/cypress/platform/click_security_other.html
index 7dc75ea88..11fd806ec 100644
--- a/cypress/platform/click_security_other.html
+++ b/cypress/platform/click_security_other.html
@@ -1,4 +1,4 @@
-
+
diff --git a/cypress/platform/click_security_sandbox.html b/cypress/platform/click_security_sandbox.html
index 2e03bceeb..50e3dfb3e 100644
--- a/cypress/platform/click_security_sandbox.html
+++ b/cypress/platform/click_security_sandbox.html
@@ -1,4 +1,4 @@
-
+
diff --git a/cypress/platform/click_security_strict.html b/cypress/platform/click_security_strict.html
index c4ac4bd68..c2a3f84cd 100644
--- a/cypress/platform/click_security_strict.html
+++ b/cypress/platform/click_security_strict.html
@@ -1,4 +1,4 @@
-
+
diff --git a/cypress/platform/css1.html b/cypress/platform/css1.html
index 9e070da25..2853a9358 100644
--- a/cypress/platform/css1.html
+++ b/cypress/platform/css1.html
@@ -1,4 +1,4 @@
-
+
diff --git a/cypress/platform/current.html b/cypress/platform/current.html
index 35b8ce3bc..ab017806f 100644
--- a/cypress/platform/current.html
+++ b/cypress/platform/current.html
@@ -4,7 +4,7 @@
+
diff --git a/cypress/platform/ghsa3.html b/cypress/platform/ghsa3.html
index 2170a808e..95436abff 100644
--- a/cypress/platform/ghsa3.html
+++ b/cypress/platform/ghsa3.html
@@ -4,7 +4,7 @@
+
diff --git a/cypress/platform/knsv.html b/cypress/platform/knsv.html
index 512333c01..e0372f00c 100644
--- a/cypress/platform/knsv.html
+++ b/cypress/platform/knsv.html
@@ -4,7 +4,7 @@
body {
/* background: rgb(221, 208, 208); */
- /* background:#333; */
+ background: #333;
font-family: 'Arial';
/* font-size: 18px !important; */
}
h1 {
color: grey;
}
+ .mermaid {
+ border: 1px solid #ddd;
+ margin: 10px;
+ }
.mermaid2 {
display: none;
}
.mermaid svg {
/* font-size: 18px !important; */
- background-color: #efefef;
- background-image: radial-gradient(#fff 51%, transparent 91%),
- radial-gradient(#fff 51%, transparent 91%);
+ /* background-color: #efefef; */
+ background-color: #333;
+ background-image: radial-gradient(#333 51%, transparent 91%),
+ radial-gradient(#333 51%, transparent 91%);
background-size: 20px 20px;
background-position: 0 0, 10px 10px;
background-repeat: repeat;
+ border: 2px solid rgb(131, 142, 205);
}
.malware {
position: fixed;
@@ -73,11 +79,45 @@
-stateDiagram
- state fork_state <>
- [*] --> fork_state
- fork_state --> State2
- fork_state --> State3
+ block-beta
+ blockArrowId<["Label"]>(right)
+ blockArrowId2<["Label"]>(left)
+ blockArrowId3<["Label"]>(up)
+ blockArrowId4<["Label"]>(down)
+ blockArrowId5<["Label"]>(x)
+ blockArrowId6<["Label"]>(y)
+ blockArrowId6<["Label"]>(x, down)
+
+
+block-beta
+ block:e:4
+ columns 2
+ f
+ g
+ end
+
+
+
+block-beta
+ block:e:4
+ columns 2
+ f
+ g
+ h
+ end
+
+
+
+block-beta
+ columns 4
+ a b c d
+ block:e:4
+ columns 2
+ f
+ g
+ h
+ end
+ i:4
state join_state <>
State2 --> join_state
@@ -87,97 +127,150 @@ stateDiagram
-stateDiagram-v2
- [*] --> Active
-
- state Active {
- [*] --> NumLockOff
- NumLockOff --> NumLockOn : EvNumLockPressed
- NumLockOn --> NumLockOff : EvNumLockPressed
- --
- [*] --> CapsLockOff
- CapsLockOff --> CapsLockOn : EvCapsLockPressed
- CapsLockOn --> CapsLockOff : EvCapsLockPressed
- --
- [*] --> ScrollLockOff
- ScrollLockOff --> ScrollLockOn : EvScrollLockPressed
- ScrollLockOn --> ScrollLockOff : EvScrollLockPressed
- }
-
-
-stateDiagram-v2
- state ProActive {
- state Active {
- Chimp --> A
- Chimp --> B
- Chimp --> C
- }
- }
-
-
----
- handdrawn: false
----
-stateDiagram-v2
- state First {
-second
- }
-
-
-stateDiagram-v2
- [*] --> First
- state First {
- [*] --> second
- second --> [*]
- }
-
-
- stateDiagram-v2
- state fork_state <>
- [*] --> fork_state
- fork_state --> State2
- fork_state --> State3
-
- state join_state <>
- State2 --> join_state
- State3 --> join_state
- join_state --> State4
- State4 --> [*]
+flowchart LR
+ X-- "y" -->z
- flowchart TB
- A1 & A2 & A3 & A4 & A5 & A6 & A7 & A8 --> C & D & E & F & G & H & I & J & K & L & M & N & O & P & Q & R & S & T & U & V & W & X & Y & Z
+block-beta
+columns 5
+ A space B
+ A --x B
+
+block-beta
+columns 3
+ a["A wide one"] b:2 c:2 d
+
+
+block-beta
+ block:e
+ f
+ end
+
+
+block-beta
+ columns 3
+ a:3
+ block:e:3
+ f
+ end
+ g
+
+
+block-beta
+ columns 3
+ a:3
+ block:e:3
+ f
+ g
+ end
+ h
+ i
+ j
+
+
+
+block-beta
+columns 3
+ a b:2
+ block:e:3
+ f
+ end
+ g h i
+
+
+block-beta
+columns 3
+ a b c
+ e:3
+ f g h
+
+
+block-beta
+columns 1
+ db(("DB"))
+ blockArrowId6<[" "]>(down)
+ block:ID
+ A
+ B["A wide one in the middle"]
+ C
+ end
+ space
+ D
+ ID --> D
+ C --> D
+ style B fill:#f9F,stroke:#333,stroke-width:4px
+
+
+block-beta
+ columns 5
+ A1:3
+ A2:1
+ A3
+ B1 B2 B3:3
+
+
+block-beta
+ block
+ D
+ E
+ end
+ db("This is the text in the box")
+
+
+block-beta
+
+ block
+ D
+ end
+ A["A: I am a wide one"]
+
+
+block-beta
+ A["square"]
+ B("rounded")
+ C(("circle"))
+
+
+block-beta
+ A>"rect_left_inv_arrow"]
+ B{"diamond"}
+ C{{"hexagon"}}
+
+
+block-beta
+ A(["stadium"])
+
+
+block-beta
+ %% A[["subroutine"]]
+ %% B[("cylinder")]
+ C>"surprise"]
+
+
+block-beta
+ A[/"lean right"/]
+ B[\"lean left"\]
+ C[/"trapezoid"\]
+ D[\"trapezoid"/]
+
+
flowchart
-Node1:::class1 --> Node2:::class2
-Node1:::class1 --> Node3:::class2
-Node3 --> Node4((I am a circle)):::larger
+ B
+ style B fill:#f9F,stroke:#333,stroke-width:4px
+
-classDef class1 fill:lightblue
-classDef class2 fill:pink
-classDef larger font-size:30px,fill:yellow
-
-stateDiagram-v2
- [*] --> Still
- Still --> [*]
- Still --> Moving
- Moving --> Still
- Moving --> Crash
- Crash --> [*]
+ flowchart LR
+ a1 -- apa --> b1
+
+
flowchart RL
- subgraph "`one`"
- a1 -- l1 --> a2
- a1 -- l2 --> a2
- end
+ subgraph "`one`"
+ id
+ end
flowchart RL
@@ -522,17 +615,8 @@ mindmap
// useMaxWidth: false,
// });
mermaid.initialize({
- handdrawn: true,
- layout: 'elk',
- flowchart: { titleTopMargin: 10 },
- // fontFamily: 'Caveat',
- fontFamily: 'Kalam',
- sequence: {
- actorFontFamily: 'courier',
- noteFontFamily: 'courier',
- messageFontFamily: 'courier',
- },
- fontSize: 16,
+ theme: 'dark',
+ startOnLoad: true,
logLevel: 0,
});
function callback() {
diff --git a/cypress/platform/per.html b/cypress/platform/per.html
index 56e7918fd..e84cea2d0 100644
--- a/cypress/platform/per.html
+++ b/cypress/platform/per.html
@@ -4,7 +4,7 @@
diff --git a/cypress/platform/render-after-error.html b/cypress/platform/render-after-error.html
index 2334158c2..4347df3c1 100644
--- a/cypress/platform/render-after-error.html
+++ b/cypress/platform/render-after-error.html
@@ -1,4 +1,4 @@
-
+
diff --git a/cypress/platform/rerender.html b/cypress/platform/rerender.html
index d9dbc4a5e..0cd5aeaac 100644
--- a/cypress/platform/rerender.html
+++ b/cypress/platform/rerender.html
@@ -1,4 +1,4 @@
-
+
diff --git a/cypress/platform/showcase_base.html b/cypress/platform/showcase_base.html
index 32a2ae72a..13e6a9484 100644
--- a/cypress/platform/showcase_base.html
+++ b/cypress/platform/showcase_base.html
@@ -4,7 +4,7 @@
+
diff --git a/cypress/platform/suppressError.html b/cypress/platform/suppressError.html
new file mode 100644
index 000000000..f20f97b59
--- /dev/null
+++ b/cypress/platform/suppressError.html
@@ -0,0 +1,59 @@
+
+
+
+
+
+ Mermaid Quick Test Page
+
+
+
+
+
+ flowchart
+ a[This should be visible]
+
+
+ flowchart
+ a --< b
+
+
+ flowchart
+ a[This should be visible]
+
+
+ ---
+ config:
+ suppressErrorRendering: true # This should not affect anything, as suppressErrorRendering is a secure config
+ ---
+ flowchart
+ a --< b
+
+
+ ---
+ config:
+ suppressErrorRendering: false # This should not affect anything, as suppressErrorRendering is a secure config
+ ---
+ flowchart
+ a --< b
+
+
+
+
+
diff --git a/cypress/platform/vertices.html b/cypress/platform/vertices.html
index f4c045b55..ca0e9e8d3 100644
--- a/cypress/platform/vertices.html
+++ b/cypress/platform/vertices.html
@@ -1,4 +1,4 @@
-
+
diff --git a/cypress/platform/viewer.js b/cypress/platform/viewer.js
index 39f456c23..482a90646 100644
--- a/cypress/platform/viewer.js
+++ b/cypress/platform/viewer.js
@@ -1,4 +1,5 @@
import mermaid from './mermaid.esm.mjs';
+import flowchartELK from './mermaid-flowchart-elk.esm.mjs';
import externalExample from './mermaid-example-diagram.esm.mjs';
import zenUml from './mermaid-zenuml.esm.mjs';
@@ -45,7 +46,7 @@ const contentLoaded = async function () {
document.getElementsByTagName('body')[0].appendChild(div);
}
- await mermaid.registerExternalDiagrams([externalExample, zenUml]);
+ await mermaid.registerExternalDiagrams([externalExample, zenUml, flowchartELK]);
mermaid.initialize(graphObj.mermaid);
await mermaid.run();
}
diff --git a/cypress/platform/xss10.html b/cypress/platform/xss10.html
index 79fa97136..91b0b94ac 100644
--- a/cypress/platform/xss10.html
+++ b/cypress/platform/xss10.html
@@ -4,7 +4,7 @@
+
diff --git a/cypress/platform/xss23-css.html b/cypress/platform/xss23-css.html
index c4bc43b6a..608adc1ab 100644
--- a/cypress/platform/xss23-css.html
+++ b/cypress/platform/xss23-css.html
@@ -4,7 +4,7 @@
+
+
+
+
+ Mermaid Block diagram demo page
+
+
+
+
+ Block diagram demos
+
+block-beta
+columns 1
+ db(("DB"))
+ blockArrowId6<[" "]>(down)
+ block:ID
+ A
+ B["A wide one in the middle"]
+ C
+ end
+ space
+ D
+ ID --> D
+ C --> D
+ style B fill:#f9F,stroke:#333,stroke-width:4px
+
+
+block-beta
+ A1["square"]
+ B1("rounded")
+ C1(("circle"))
+ A2>"rect_left_inv_arrow"]
+ B2{"diamond"}
+ C2{{"hexagon"}}
+
+
+
+block-beta
+ A1(["stadium"])
+ A2[["subroutine"]]
+ B1[("cylinder")]
+ C1>"surprise"]
+ A3[/"lean right"/]
+ B2[\"lean left"\]
+ C2[/"trapezoid"\]
+ D2[\"trapezoid"/]
+
+
+
+block-beta
+ block:e:4
+ columns 2
+ f
+ g
+ end
+
+
+
+block-beta
+ block:e:4
+ columns 2
+ f
+ g
+ h
+ end
+
+
+
+block-beta
+ columns 3
+ a:3
+ block:e:3
+ f
+ g
+ end
+ h
+ i
+ j
+
+
+
+block-beta
+ columns 4
+ a b c d
+ block:e:4
+ columns 2
+ f
+ g
+ h
+ end
+ i:4
+
+
+
+flowchart LR
+ X-- "a label" -->z
+
+
+block-beta
+columns 5
+ A space B
+ A --x B
+
+
+block-beta
+columns 3
+ a["A wide one"] b:2 c:2 d
+
+
+
+block-beta
+columns 3
+ a b c
+ e:3
+ f g h
+
+
+
+block-beta
+
+ A1:3
+ A2:1
+ A3
+
+
+
+
+
diff --git a/demos/c4context.html b/demos/c4context.html
index f674054a2..64ca768e1 100644
--- a/demos/c4context.html
+++ b/demos/c4context.html
@@ -1,4 +1,4 @@
-
+
diff --git a/demos/classchart.html b/demos/classchart.html
index 3ad8fb100..f04fa5b5f 100644
--- a/demos/classchart.html
+++ b/demos/classchart.html
@@ -1,4 +1,4 @@
-
+
diff --git a/demos/dataflowchart.html b/demos/dataflowchart.html
index 5fbfa29cc..dd8bca658 100644
--- a/demos/dataflowchart.html
+++ b/demos/dataflowchart.html
@@ -1,4 +1,4 @@
-
+
diff --git a/demos/dev/example.html b/demos/dev/example.html
index 4ece7efa8..27d31e177 100644
--- a/demos/dev/example.html
+++ b/demos/dev/example.html
@@ -39,6 +39,8 @@ graph TB
+
+
+```
diff --git a/docs/config/setup/interfaces/mermaidAPI.RenderResult.md b/docs/config/setup/interfaces/mermaidAPI.RenderResult.md
index aebd88b23..b5cc48038 100644
--- a/docs/config/setup/interfaces/mermaidAPI.RenderResult.md
+++ b/docs/config/setup/interfaces/mermaidAPI.RenderResult.md
@@ -14,10 +14,6 @@
• `Optional` **bindFunctions**: (`element`: `Element`) => `void`
-#### Type declaration
-
-▸ (`element`): `void`
-
Bind function to be called after the svg has been inserted into the DOM.
This is necessary for adding event listeners to the elements in the svg.
@@ -27,6 +23,10 @@ div.innerHTML = svg;
bindFunctions?.(div); // To call bindFunctions only if it's present.
```
+#### Type declaration
+
+▸ (`element`): `void`
+
##### Parameters
| Name | Type |
diff --git a/docs/config/setup/modules/config.md b/docs/config/setup/modules/config.md
index f1de64e2d..48e687577 100644
--- a/docs/config/setup/modules/config.md
+++ b/docs/config/setup/modules/config.md
@@ -50,7 +50,7 @@ Pushes in a directive to the configuration
| --------- | ------------------------- | ----------- | ------------------------------ |
| getConfig | Obtains the currentConfig | Get Request | Any Values from current Config |
-**Notes**: Returns **any** the currentConfig
+**Notes**: Avoid calling this function repeatedly. Instead, store the result in a variable and use it, and pass it down to function calls.
#### Returns
diff --git a/docs/config/setup/modules/mermaidAPI.md b/docs/config/setup/modules/mermaidAPI.md
index e84eb0f86..1a68b05bd 100644
--- a/docs/config/setup/modules/mermaidAPI.md
+++ b/docs/config/setup/modules/mermaidAPI.md
@@ -43,6 +43,7 @@ const config = {
securityLevel: 'strict',
startOnLoad: true,
arrowMarkerAbsolute: false,
+ suppressErrorRendering: false,
er: {
diagramPadding: 20,
@@ -97,7 +98,7 @@ mermaid.initialize(config);
#### Defined in
-[mermaidAPI.ts:623](https://github.com/mermaid-js/mermaid/blob/master/packages/mermaid/src/mermaidAPI.ts#L623)
+[mermaidAPI.ts:635](https://github.com/mermaid-js/mermaid/blob/master/packages/mermaid/src/mermaidAPI.ts#L635)
## Functions
diff --git a/docs/config/theming.md b/docs/config/theming.md
index 63271a39b..3045298f6 100644
--- a/docs/config/theming.md
+++ b/docs/config/theming.md
@@ -12,15 +12,15 @@ Themes can now be customized at the site-wide level, or on individual Mermaid di
## Available Themes
-1. [**default**](https://github.com/mermaid-js/mermaid/blob/develop/packages/mermaid/src/themes/theme-default.js) - This is the default theme for all diagrams.
+1. [**default**](https://github.com/mermaid-js/mermaid/blob/develop/packages/mermaid/src/themes/theme-default.js) - This is the default theme for all diagrams.
-2. [**neutral**](https://github.com/mermaid-js/mermaid/blob/develop/packages/mermaid/src/themes/theme-neutral.js) - This theme is great for black and white documents that will be printed.
+2. [**neutral**](https://github.com/mermaid-js/mermaid/blob/develop/packages/mermaid/src/themes/theme-neutral.js) - This theme is great for black and white documents that will be printed.
-3. [**dark**](https://github.com/mermaid-js/mermaid/blob/develop/packages/mermaid/src/themes/theme-dark.js) - This theme goes well with dark-colored elements or dark-mode.
+3. [**dark**](https://github.com/mermaid-js/mermaid/blob/develop/packages/mermaid/src/themes/theme-dark.js) - This theme goes well with dark-colored elements or dark-mode.
-4. [**forest**](https://github.com/mermaid-js/mermaid/blob/develop/packages/mermaid/src/themes/theme-forest.js) - This theme contains shades of green.
+4. [**forest**](https://github.com/mermaid-js/mermaid/blob/develop/packages/mermaid/src/themes/theme-forest.js) - This theme contains shades of green.
-5. [**base**](https://github.com/mermaid-js/mermaid/blob/develop/packages/mermaid/src/themes/theme-base.js) - This is the only theme that can be modified. Use this theme as the base for customizations.
+5. [**base**](https://github.com/mermaid-js/mermaid/blob/develop/packages/mermaid/src/themes/theme-base.js) - This is the only theme that can be modified. Use this theme as the base for customizations.
## Site-wide Theme
@@ -65,7 +65,7 @@ Example of `init` directive setting the `theme` to `forest`:
a --> b
```
-> **Reminder**: the only theme that can be customed is the `base` theme. The following section covers how to use `themeVariables` for customizations.
+> **Reminder**: the only theme that can be customized is the `base` theme. The following section covers how to use `themeVariables` for customizations.
## Customizing Themes with `themeVariables`
@@ -250,7 +250,7 @@ The theming engine will only recognize hex colors and not color names. So, the v
| actorBkg | mainBkg | Actor Background Color |
| actorBorder | primaryBorderColor | Actor Border Color |
| actorTextColor | primaryTextColor | Actor Text Color |
-| actorLineColor | grey | Actor Line Color |
+| actorLineColor | actorBorder | Actor Line Color |
| signalColor | textColor | Signal Color |
| signalTextColor | textColor | Signal Text Color |
| labelBoxBkgColor | actorBkg | Label Box Background Color |
diff --git a/docs/config/usage.md b/docs/config/usage.md
index 10fa63e64..d853643d3 100644
--- a/docs/config/usage.md
+++ b/docs/config/usage.md
@@ -73,7 +73,7 @@ Example:
## Simple full example:
```html
-
+
@@ -286,11 +286,11 @@ const drawDiagram = async function () {
};
```
-1. The graph is generated using the render call.
-2. After generation the render function calls the provided callback function, in this case it's called insertSvg.
-3. The callback function is called with two parameters, the SVG code of the generated graph and a function. This function binds events to the SVG **after** it is inserted into the DOM.
-4. Insert the SVG code into the DOM for presentation.
-5. Call the binding function that binds the events.
+1. The graph is generated using the render call.
+2. After generation the render function calls the provided callback function, in this case it's called insertSvg.
+3. The callback function is called with two parameters, the SVG code of the generated graph and a function. This function binds events to the SVG **after** it is inserted into the DOM.
+4. Insert the SVG code into the DOM for presentation.
+5. Call the binding function that binds the events.
## Example of a marked renderer
@@ -393,3 +393,8 @@ mermaid.startOnLoad = true;
> **Warning**
> This way of setting the configuration is deprecated. Instead the preferred way is to use the initialize method. This functionality is only kept for backwards compatibility.
+
+
diff --git a/docs/ecosystem/integrations-community.md b/docs/ecosystem/integrations-community.md
index 6ad02f6b6..01a32ae43 100644
--- a/docs/ecosystem/integrations-community.md
+++ b/docs/ecosystem/integrations-community.md
@@ -71,6 +71,12 @@ To add an integration to this list, see the [Integrations - create page](./integ
- [redmine-mermaid](https://github.com/styz/redmine_mermaid)
- Visual Studio Code [Polyglot Interactive Notebooks](https://github.com/dotnet/interactive#net-interactive)
+### LLM integrations
+
+LLM integrations to create mermaid diagrams using AI from text descriptions.
+
+- [HueHive - Create mermaid diagrams with text](https://huehive.co/tools/diagrams)
+
### CRM/ERP
Customer Relationship Management/Enterprise Resource Planning
@@ -95,6 +101,10 @@ Blogging frameworks and platforms
Content Management Systems/Enterprise Content Management
+- [ApostropheCMS](https://apostrophecms.com/)
+ - [Extension for Mermaid.js](https://github.com/BoDonkey/mermaid-extension)
+- [Drupal](https://drupal.org/)
+ - [Mermaid Diagram Field module](https://www.drupal.org/project/mermaid_diagram_field)
- [Grav CMS](https://getgrav.org/)
- [Mermaid Diagrams Plugin](https://github.com/DanielFlaum/grav-plugin-mermaid-diagrams)
- [GitLab Markdown Adapter](https://github.com/Goutte/grav-plugin-gitlab-markdown-adapter)
@@ -116,7 +126,7 @@ Communication tools and platforms
- [phpBB](https://phpbb.com)
- [phpbb-ext-mermaid](https://github.com/AlfredoRamos/phpbb-ext-mermaid)
- [Slack](https://slack.com)
- - [Mermaid Preview](https://github.com/JackuB/mermaid-for-slack)
+ - [Mermaid Preview](https://mermaid-preview.com)
### Wikis
@@ -215,23 +225,24 @@ Communication tools and platforms
### Browser Extensions
-| Name | Chrome Web Store | Firefox Add-ons | Opera | Edge | Source/Repository |
-| ------------------------ | ------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------ | ------------------------------------------------------------------------------ | ---------------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------- |
-| GitHub + Mermaid | - | [🦊🔗](https://addons.mozilla.org/firefox/addon/github-mermaid/) | - | - | [🐙🔗](https://github.com/BackMarket/github-mermaid-extension) |
-| Asciidoctor Live Preview | [🎡🔗](https://chrome.google.com/webstore/detail/asciidoctorjs-live-previe/iaalpfgpbocpdfblpnhhgllgbdbchmia) | - | - | [🌀🔗](https://microsoftedge.microsoft.com/addons/detail/asciidoctorjs-live-previ/pefkelkanablhjdekgdahplkccnbdggd?hl=en-US) | - |
-| Diagram Tab | - | - | - | - | [🐙🔗](https://github.com/khafast/diagramtab) |
-| Markdown Diagrams | [🎡🔗](https://chrome.google.com/webstore/detail/markdown-diagrams/pmoglnmodacnbbofbgcagndelmgaclel/) | [🦊🔗](https://addons.mozilla.org/en-US/firefox/addon/markdown-diagrams/) | [🔴🔗](https://addons.opera.com/en/extensions/details/markdown-diagrams/) | [🌀🔗](https://microsoftedge.microsoft.com/addons/detail/markdown-diagrams/hceenoomhhdkjjijnmlclkpenkapfihe) | [🐙🔗](https://github.com/marcozaccari/markdown-diagrams-browser-extension/tree/master/doc/examples) |
-| Markdown Viewer | - | [🦊🔗](https://addons.mozilla.org/en-US/firefox/addon/markdown-viewer-chrome/) | - | - | [🐙🔗](https://github.com/simov/markdown-viewer) |
-| Extensions for Mermaid | - | - | [🔴🔗](https://addons.opera.com/en/extensions/details/extensions-for-mermaid/) | - | [🐙🔗](https://github.com/Stefan-S/mermaid-extension) |
-| Chrome Diagrammer | [🎡🔗](https://chrome.google.com/webstore/detail/chrome-diagrammer/bkpbgjmkomfoakfklcjeoegkklgjnnpk) | - | - | - | - |
-| Mermaid Diagrams | [🎡🔗](https://chrome.google.com/webstore/detail/mermaid-diagrams/phfcghedmopjadpojhmmaffjmfiakfil) | - | - | - | - |
-| Monkeys | [🎡🔗](https://chrome.google.com/webstore/detail/monkeys-mermaid-for-githu/cplfdpoajbclbgphaphphcldamfkjlgi) | - | - | - | - |
-| Mermaid Previewer | [🎡🔗](https://chrome.google.com/webstore/detail/mermaid-previewer/oidjnlhbegipkcklbdfnbkikplpghfdl) | - | - | - | - |
+| Name | Chrome Web Store | Firefox Add-ons | Opera | Edge | Source/Repository |
+| ------------------------ | ----------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------ | ------------------------------------------------------------------------------ | ---------------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------- |
+| GitHub + Mermaid | - | [🦊🔗](https://addons.mozilla.org/firefox/addon/github-mermaid/) | - | - | [🐙🔗](https://github.com/BackMarket/github-mermaid-extension) |
+| Asciidoctor Live Preview | [🎡🔗](https://chromewebstore.google.com/detail/asciidoctorjs-live-previe/iaalpfgpbocpdfblpnhhgllgbdbchmia) | - | - | [🌀🔗](https://microsoftedge.microsoft.com/addons/detail/asciidoctorjs-live-previ/pefkelkanablhjdekgdahplkccnbdggd?hl=en-US) | - |
+| Diagram Tab | - | - | - | - | [🐙🔗](https://github.com/khafast/diagramtab) |
+| Markdown Diagrams | [🎡🔗](https://chromewebstore.google.com/detail/markdown-diagrams/pmoglnmodacnbbofbgcagndelmgaclel) | [🦊🔗](https://addons.mozilla.org/en-US/firefox/addon/markdown-diagrams/) | [🔴🔗](https://addons.opera.com/en/extensions/details/markdown-diagrams/) | [🌀🔗](https://microsoftedge.microsoft.com/addons/detail/markdown-diagrams/hceenoomhhdkjjijnmlclkpenkapfihe) | [🐙🔗](https://github.com/marcozaccari/markdown-diagrams-browser-extension/tree/master/doc/examples) |
+| Markdown Viewer | - | [🦊🔗](https://addons.mozilla.org/en-US/firefox/addon/markdown-viewer-chrome/) | - | - | [🐙🔗](https://github.com/simov/markdown-viewer) |
+| Extensions for Mermaid | - | - | [🔴🔗](https://addons.opera.com/en/extensions/details/extensions-for-mermaid/) | - | [🐙🔗](https://github.com/Stefan-S/mermaid-extension) |
+| Chrome Diagrammer | [🎡🔗](https://chromewebstore.google.com/detail/chrome-diagrammer/bkpbgjmkomfoakfklcjeoegkklgjnnpk) | - | - | - | - |
+| Mermaid Diagrams | [🎡🔗](https://chromewebstore.google.com/detail/mermaid-diagrams/phfcghedmopjadpojhmmaffjmfiakfil) | - | - | - | - |
+| Monkeys | [🎡🔗](https://chromewebstore.google.com/detail/monkeys-mermaid-for-githu/cplfdpoajbclbgphaphphcldamfkjlgi) | - | - | - | - |
+| Mermaid Previewer | [🎡🔗](https://chromewebstore.google.com/detail/mermaid-previewer/oidjnlhbegipkcklbdfnbkikplpghfdl) | - | - | - | - |
### Other
- [Bisheng](https://www.npmjs.com/package/bisheng)
- [bisheng-plugin-mermaid](https://github.com/yct21/bisheng-plugin-mermaid)
+- [Blazorade Mermaid: Render Mermaid diagrams in Blazor applications](https://github.com/Blazorade/Blazorade-Mermaid/wiki)
- [Codemia: A tool to practice system design problems](https://codemia.io) ✅
- [ExDoc](https://github.com/elixir-lang/ex_doc)
- [Rendering Mermaid graphs](https://github.com/elixir-lang/ex_doc#rendering-mermaid-graphs)
@@ -248,5 +259,5 @@ Communication tools and platforms
- [reveal-ck-mermaid-plugin](https://github.com/tmtm/reveal-ck-mermaid-plugin)
- [mermaid-isomorphic](https://github.com/remcohaszing/mermaid-isomorphic)
- [mermaid-server: Generate diagrams using a HTTP request](https://github.com/TomWright/mermaid-server)
-- [ExDoc](https://github.com/elixir-lang/ex_doc)
- - [Rendering Mermaid graphs](https://github.com/elixir-lang/ex_doc#rendering-mermaid-graphs)
+
+
diff --git a/docs/ecosystem/integrations-create.md b/docs/ecosystem/integrations-create.md
index 7643c8898..f5e938d4d 100644
--- a/docs/ecosystem/integrations-create.md
+++ b/docs/ecosystem/integrations-create.md
@@ -24,7 +24,7 @@ Currently pending [IANA](https://www.iana.org/) recognition.
### Mermaid Discord workspace
-We would love to see what you create with Mermaid. Please share your creations with us in our [Discord](https://discord.gg/wwtabKgp8y) server [#showcase](https://discord.com/channels/1079455296289788015/1079502635054399649) channel.
+We would love to see what you create with Mermaid. Please share your creations with us in our [Discord](https://discord.gg/AgrbSrBer3) server [#showcase](https://discord.com/channels/1079455296289788015/1079502635054399649) channel.
### Add to Mermaid Ecosystem
diff --git a/docs/ecosystem/tutorials.md b/docs/ecosystem/tutorials.md
index 36d5ad93f..26498f090 100644
--- a/docs/ecosystem/tutorials.md
+++ b/docs/ecosystem/tutorials.md
@@ -80,3 +80,5 @@ graph LR;
**Output**

+
+
diff --git a/docs/intro/getting-started.md b/docs/intro/getting-started.md
index c2c663d39..735859644 100644
--- a/docs/intro/getting-started.md
+++ b/docs/intro/getting-started.md
@@ -8,9 +8,9 @@
## Mermaid is composed of three parts
-1. Deployment
-2. Syntax
-3. Configuration
+1. Deployment
+2. Syntax
+3. Configuration
This section talks about the different ways to **deploy** Mermaid.
@@ -21,11 +21,11 @@ If you are a beginner:
## Ways to use Mermaid
-1. [Using the Mermaid Live Editor](getting-started.md#_1-using-the-mermaid-live-editor)
-2. [Using the Mermaid Chart Editor](getting-started.md#_2-using-the-mermaid-chart-editor)
-3. [Using Mermaid Plugins and Integrations](getting-started.md#_3-using-mermaid-plugins)
-4. [Calling the Mermaid JavaScript API](getting-started.md#_4-calling-the-mermaid-javascript-api)
-5. [Adding Mermaid as a dependency](getting-started.md#_5-adding-mermaid-as-a-dependency)
+1. [Using the Mermaid Live Editor](getting-started.md#_1-using-the-mermaid-live-editor)
+2. [Using the Mermaid Chart Editor](getting-started.md#_2-using-the-mermaid-chart-editor)
+3. [Using Mermaid Plugins and Integrations](getting-started.md#_3-using-mermaid-plugins)
+4. [Calling the Mermaid JavaScript API](getting-started.md#_4-calling-the-mermaid-javascript-api)
+5. [Adding Mermaid as a dependency](getting-started.md#_5-adding-mermaid-as-a-dependency)
To learn more, visit the [Usage](../config/usage.md) page.
@@ -246,18 +246,18 @@ In this example, the `mermaidAPI` is being called through the `CDN`:
Here is one mermaid diagram:
- graph TD
- A[Client] --> B[Load Balancer]
- B --> C[Server1]
+ graph TD
+ A[Client] --> B[Load Balancer]
+ B --> C[Server1]
B --> D[Server2]
And here is another:
- graph TD
+ graph TD
A[Client] -->|tcp_123| B
- B(Load Balancer)
- B -->|tcp_456| C[Server1]
+ B(Load Balancer)
+ B -->|tcp_456| C[Server1]
B -->|tcp_456| D[Server2]
@@ -278,15 +278,15 @@ In this example, `mermaid.js` is referenced in `src` as a separate JavaScript fi
- graph LR
- A --- B
- B-->C[fa:fa-ban forbidden]
+ graph LR
+ A --- B
+ B-->C[fa:fa-ban forbidden]
B-->D(fa:fa-spinner);
- graph TD
- A[Client] --> B[Load Balancer]
- B --> C[Server1]
+ graph TD
+ A[Client] --> B[Load Balancer]
+ B --> C[Server1]
B --> D[Server2]
+
+
diff --git a/packages/mermaid/src/docs/.vitepress/theme/custom.css b/packages/mermaid/src/docs/.vitepress/theme/custom.css
index 28ef8d338..1d72056ec 100644
--- a/packages/mermaid/src/docs/.vitepress/theme/custom.css
+++ b/packages/mermaid/src/docs/.vitepress/theme/custom.css
@@ -1,5 +1,5 @@
-@import url('https://cdnjs.cloudflare.com/ajax/libs/font-awesome/4.7.0/css/font-awesome.min.css');
-@import url('https://cdn.jsdelivr.net/npm/@mdi/font@6.9.96/css/materialdesignicons.min.css');
+@import 'font-awesome/css/font-awesome.min.css';
+@import '@mdi/font/css/materialdesignicons.min.css';
:root {
--vp-c-brand: #ff3670;
diff --git a/packages/mermaid/src/docs/.vitepress/theme/index.ts b/packages/mermaid/src/docs/.vitepress/theme/index.ts
index 344d602bd..3ebb7614a 100644
--- a/packages/mermaid/src/docs/.vitepress/theme/index.ts
+++ b/packages/mermaid/src/docs/.vitepress/theme/index.ts
@@ -8,14 +8,12 @@ import Contributors from '../components/Contributors.vue';
import HomePage from '../components/HomePage.vue';
// @ts-ignore
import TopBar from '../components/TopBar.vue';
-
import { getRedirect } from './redirect.js';
-
import { h } from 'vue';
-
import Theme from 'vitepress/theme';
import '../style/main.css';
import 'uno.css';
+import type { EnhanceAppContext } from 'vitepress';
export default {
...DefaultTheme,
@@ -26,19 +24,22 @@ export default {
'home-features-after': () => h(HomePage),
});
},
- enhanceApp({ app, router }) {
+ enhanceApp({ app, router }: EnhanceAppContext) {
// register global components
app.component('Mermaid', Mermaid);
app.component('Contributors', Contributors);
router.onBeforeRouteChange = (to) => {
try {
- const newPath = getRedirect(to);
+ const url = new URL(window.location.origin + to);
+ const newPath = getRedirect(url);
if (newPath) {
console.log(`Redirecting to ${newPath} from ${window.location}`);
// router.go isn't loading the ID properly.
window.location.href = `/${newPath}`;
}
- } catch (e) {}
+ } catch (e) {
+ console.error(e);
+ }
};
},
};
diff --git a/packages/mermaid/src/docs/.vitepress/theme/redirect.spec.ts b/packages/mermaid/src/docs/.vitepress/theme/redirect.spec.ts
index 7a5481a59..91b6c91fe 100644
--- a/packages/mermaid/src/docs/.vitepress/theme/redirect.spec.ts
+++ b/packages/mermaid/src/docs/.vitepress/theme/redirect.spec.ts
@@ -57,5 +57,5 @@ test.each([
'configure/faq.html#frequently-asked-questions',
], // with hash
])('should process url %s to %s', (link: string, path: string) => {
- expect(getRedirect(link)).toBe(path);
+ expect(getRedirect(new URL(link))).toBe(path);
});
diff --git a/packages/mermaid/src/docs/.vitepress/theme/redirect.ts b/packages/mermaid/src/docs/.vitepress/theme/redirect.ts
index 9c8151b94..1b04e01d5 100644
--- a/packages/mermaid/src/docs/.vitepress/theme/redirect.ts
+++ b/packages/mermaid/src/docs/.vitepress/theme/redirect.ts
@@ -104,8 +104,7 @@ const urlRedirectMap: Record = {
* @param link - The old documentation URL.
* @returns The new documentation path.
*/
-export const getRedirect = (link: string): string | undefined => {
- const url = new URL(link);
+export const getRedirect = (url: URL): string | undefined => {
// Redirects for deprecated vitepress URLs
if (url.pathname in urlRedirectMap) {
return `${urlRedirectMap[url.pathname]}${url.hash}`;
diff --git a/packages/mermaid/src/docs/community/contributing.md b/packages/mermaid/src/docs/community/contributing.md
index 9a83b5294..195146a61 100644
--- a/packages/mermaid/src/docs/community/contributing.md
+++ b/packages/mermaid/src/docs/community/contributing.md
@@ -130,7 +130,7 @@ You might see _lint_ or _formatting_ warnings. Those are ok during this step.
## Workflow
-Contributing process is very simple and strightforward:
+Contributing process is very simple and straightforward:
```mermaid-nocode
flowchart LR
@@ -371,13 +371,13 @@ If the users have no way to know that things have changed, then you haven't real
Likewise, if users don't know that there is a new feature that you've implemented, it will forever remain unknown and unused.
The documentation has to be updated for users to know that things have been changed and added!
-If you are adding a new feature, add `(v+)` in the title or description. It will be replaced automatically with the current version number when the release happens.
+If you are adding a new feature, add `(v10.8.0+)` in the title or description. It will be replaced automatically with the current version number when the release happens.
-eg: `# Feature Name (v+)`
+eg: `# Feature Name (v10.8.0+)`
We know it can sometimes be hard to code _and_ write user documentation.
-Create another issue specifically for the documentation.
+Create another issue specifically for the documentation.
You will need to help with the PR, but definitely ask for help if you feel stuck.
When it feels hard to write stuff out, explaining it to someone and having that person ask you clarifying questions can often be 80% of the work!
@@ -403,7 +403,7 @@ The contents of [mermaid.js.org](https://mermaid.js.org/) are based on the docs
flowchart LR
classDef default fill:#fff,color:black,stroke:black
- source["Edit /packages/mermaid/src/docs"] -- automatic processing--> published["View /docs which will be publised on Official Website"]
+ source["Edit /packages/mermaid/src/docs"] -- automatic processing--> published["View /docs which will be published on Official Website"]
```
### Running the Documentation Website Locally
@@ -521,3 +521,5 @@ You have successfully submitted your improvements! What is next?
- When a release is ready, the `release/x.x.x` branch will be created, extensively tested and knsv will be in charge of the release process.
Thanks for you help!
+
+
diff --git a/packages/mermaid/src/docs/community/intro.md b/packages/mermaid/src/docs/community/intro.md
index e700fde45..a83b96380 100644
--- a/packages/mermaid/src/docs/community/intro.md
+++ b/packages/mermaid/src/docs/community/intro.md
@@ -39,7 +39,7 @@ Where to start:
- You could work on a new feature! [These](https://github.com/mermaid-js/mermaid/issues?q=is%3Aissue+is%3Aopen+label%3A%22Area%3A+Development%22+label%3A%22Type%3A+Enhancement%22+label%3A%22Status%3A+Approved%22+) are some ideas!
- You could confirm the bugs in [these issues](https://github.com/mermaid-js/mermaid/issues?q=is%3Aissue+is%3Aopen+label%3A%22Status%3A+Triage%22++label%3A%22Type%3A+Bug+%2F+Error%22).
-[Join our slack community if you want closer contact!](https://join.slack.com/t/mermaid-talk/shared_invite/enQtNzc4NDIyNzk4OTAyLWVhYjQxOTI2OTg4YmE1ZmJkY2Y4MTU3ODliYmIwOTY3NDJlYjA0YjIyZTdkMDMyZTUwOGI0NjEzYmEwODcwOTE)
+[You can join our Discord server if you want closer contact!](https://discord.gg/AgrbSrBer3)
## A Question Or a Suggestion?
@@ -53,6 +53,6 @@ If you have faced a vulnerability [report it to us](./security.md).
Don't get daunted if it is hard in the beginning. We have a great community with only encouraging words. So, if you get stuck, ask for help and hints in the Slack forum. If you want to show off something good, show it off there.
-[Join our Slack community if you want closer contact!](https://join.slack.com/t/mermaid-talk/shared_invite/enQtNzc4NDIyNzk4OTAyLWVhYjQxOTI2OTg4YmE1ZmJkY2Y4MTU3ODliYmIwOTY3NDJlYjA0YjIyZTdkMDMyZTUwOGI0NjEzYmEwODcwOTE)
+[You can join our Discord server if you want closer contact!](https://discord.gg/AgrbSrBer3)

diff --git a/packages/mermaid/src/docs/community/new-diagram-jison.md b/packages/mermaid/src/docs/community/new-diagram-jison.md
new file mode 100644
index 000000000..4a9020ba8
--- /dev/null
+++ b/packages/mermaid/src/docs/community/new-diagram-jison.md
@@ -0,0 +1,220 @@
+# Adding a New Diagram/Chart (Deprecated) 📊
+
+```warning
+JISON grammars are deprecated in mermaid. Please use Langium instead. See [New Diagram](./new-diagram.md) for more information.
+
+**New diagrams with JISON grammars will not be accepted.**
+```
+
+### Step 1: Grammar & Parsing
+
+#### Grammar
+
+This would be to define a JISON grammar for the new diagram type. That should start with a way to identify that the text in the mermaid tag is a diagram of that type. Create a new folder under diagrams for your new diagram type and a parser folder in it. This leads us to step 2.
+
+For instance:
+
+- the flowchart starts with the keyword _graph_
+- the sequence diagram starts with the keyword _sequenceDiagram_
+
+#### Store data found during parsing
+
+There are some jison specific sub steps here where the parser stores the data encountered when parsing the diagram, this data is later used by the renderer. You can during the parsing call an object provided to the parser by the user of the parser. This object can be called during parsing for storing data.
+
+```jison
+statement
+ : 'participant' actor { $$='actor'; }
+ | signal { $$='signal'; }
+ | note_statement { $$='note'; }
+ | 'title' message { yy.setTitle($2); }
+ ;
+```
+
+In the extract of the grammar above, it is defined that a call to the setTitle method in the data object will be done when parsing and the title keyword is encountered.
+
+```note
+Make sure that the `parseError` function for the parser is defined and calling `mermaid.parseError`. This way a common way of detecting parse errors is provided for the end-user.
+```
+
+For more info look at the example diagram type:
+
+The `yy` object has the following function:
+
+```javascript
+exports.parseError = function (err, hash) {
+ mermaid.parseError(err, hash);
+};
+```
+
+when parsing the `yy` object is initialized as per below:
+
+```javascript
+const parser = exampleParser.parser;
+parser.yy = db;
+```
+
+### Step 2: Rendering
+
+Write a renderer that given the data found during parsing renders the diagram. To look at an example look at sequenceRenderer.js rather than the flowchart renderer as this is a more generic example.
+
+Place the renderer in the diagram folder.
+
+### Step 3: Detection of the new diagram type
+
+The second thing to do is to add the capability to detect the new diagram to type to the detectType in `diagram-api/detectType.ts`. The detection should return a key for the new diagram type.
+[This key will be used to as the aria roledescription](#aria-roledescription), so it should be a word that clearly describes the diagram type.
+For example, if your new diagram uses a UML deployment diagram, a good key would be "UMLDeploymentDiagram" because assistive technologies such as a screen reader
+would voice that as "U-M-L Deployment diagram." Another good key would be "deploymentDiagram" because that would be voiced as "Deployment Diagram." A bad key would be "deployment" because that would not sufficiently describe the diagram.
+
+Note that the diagram type key does not have to be the same as the diagram keyword chosen for the [grammar](#grammar), but it is helpful if they are the same.
+
+### Step 4: The final piece - triggering the rendering
+
+At this point when mermaid is trying to render the diagram, it will detect it as being of the new type but there will be no match when trying to render the diagram. To fix this add a new case in the switch statement in main.js:init this should match the diagram type returned from step #2. The code in this new case statement should call the renderer for the diagram type with the data found by the parser as an argument.
+
+## Usage of the parser as a separate module
+
+### Setup
+
+```javascript
+const graph = require('./graphDb');
+const flow = require('./parser/flow');
+flow.parser.yy = graph;
+```
+
+### Parsing
+
+```javascript
+flow.parser.parse(text);
+```
+
+### Data extraction
+
+```javascript
+graph.getDirection();
+graph.getVertices();
+graph.getEdges();
+```
+
+The parser is also exposed in the mermaid api by calling:
+
+```javascript
+const parser = mermaid.getParser();
+```
+
+Note that the parse needs a graph object to store the data as per:
+
+```javascript
+flow.parser.yy = graph;
+```
+
+Look at `graphDb.js` for more details on that object.
+
+## Layout
+
+If you are using a dagre based layout, please use flowchart-v2 as a template and by doing that you will be using dagre-wrapper instead of dagreD3 which we are migrating away from.
+
+### Common parts of a diagram
+
+There are a few features that are common between the different types of diagrams. We try to standardize the diagrams that work as similar as possible for the end user. The commonalities are:
+
+- Directives, a way of modifying the diagram configuration from within the diagram code.
+- Accessibility, a way for an author to provide additional information like titles and descriptions to people accessing a text with diagrams using a screen reader.
+- Themes, there is a common way to modify the styling of diagrams in Mermaid.
+- Comments should follow mermaid standards
+
+Here are some pointers on how to handle these different areas.
+
+## Accessibility
+
+Mermaid automatically adds the following accessibility information for the diagram SVG HTML element:
+
+- aria-roledescription
+- accessible title
+- accessible description
+
+### aria-roledescription
+
+The aria-roledescription is automatically set to [the diagram type](#step-3--detection-of-the-new-diagram-type) and inserted into the SVG element.
+
+See [the definition of aria-roledescription](https://www.w3.org/TR/wai-aria-1.1/#aria-roledescription) in [the Accessible Rich Internet Applications W3 standard.](https://www.w3.org/WAI/standards-guidelines/aria/)
+
+### accessible title and description
+
+The syntax for accessible titles and descriptions is described in [the Accessibility documentation section.](../config/accessibility.md)
+
+As a design goal, the jison syntax should be similar between the diagrams.
+
+```jison
+
+* lexical grammar */
+%lex
+%x acc_title
+%x acc_descr
+%x acc_descr_multiline
+
+%%
+accTitle\s*":"\s* { this.begin("acc_title");return 'acc_title'; }
+(?!\n|;|#)*[^\n]* { this.popState(); return "acc_title_value"; }
+accDescr\s*":"\s* { this.begin("acc_descr");return 'acc_descr'; }
+(?!\n|;|#)*[^\n]* { this.popState(); return "acc_descr_value"; }
+accDescr\s*"{"\s* { this.begin("acc_descr_multiline");}
+[\}] { this.popState(); }
+[^\}]* return "acc_descr_multiline_value";
+
+statement
+ : acc_title acc_title_value { $$=$2.trim();yy.setTitle($$); }
+ | acc_descr acc_descr_value { $$=$2.trim();yy.setAccDescription($$); }
+ | acc_descr_multiline_value { $$=$1.trim();yy.setAccDescription($$); }
+
+```
+
+The functions for setting title and description are provided by a common module. This is the import from flowDb.js:
+
+```
+import {
+ setAccTitle,
+ getAccTitle,
+ getAccDescription,
+ setAccDescription,
+ clear as commonClear,
+} from '../../commonDb';
+```
+
+The accessibility title and description are inserted into the SVG element in the `render` function in mermaidAPI.
+
+## Theming
+
+Mermaid supports themes and has an integrated theming engine. You can read more about how the themes can be used [in the docs](../config/theming.md).
+
+When adding themes to a diagram it comes down to a few important locations in the code.
+
+The entry point for the styling engine is in **src/styles.js**. The getStyles function will be called by Mermaid when the styles are being applied to the diagram.
+
+This function will in turn call a function _your diagram should provide_ returning the css for the new diagram. The diagram specific, also which is commonly also called getStyles and located in the folder for your diagram under src/diagrams and should be named styles.js. The getStyles function will be called with the theme options as an argument like in the following example:
+
+```js
+const getStyles = (options) =>
+ `
+ .line {
+ stroke-width: 1;
+ stroke: ${options.lineColor};
+ stroke-dasharray: 2;
+ }
+ // ...
+ `;
+```
+
+Note that you need to provide your function to the main getStyles by adding it into the themes object in **src/styles.js** like in the xyzDiagram in the provided example:
+
+```js
+const themes = {
+ flowchart,
+ 'flowchart-v2': flowchart,
+ sequence,
+ xyzDiagram,
+ //...
+};
+```
+
+The actual options and values for the colors are defined in **src/theme/theme-[xyz].js**. If you provide the options your diagram needs in the existing theme files then the theming will work smoothly without hiccups.
diff --git a/packages/mermaid/src/docs/community/new-diagram.md b/packages/mermaid/src/docs/community/new-diagram.md
index bc43475bf..16504ca32 100644
--- a/packages/mermaid/src/docs/community/new-diagram.md
+++ b/packages/mermaid/src/docs/community/new-diagram.md
@@ -1,52 +1,18 @@
# Adding a New Diagram/Chart 📊
+### Examples
+
+Please refer to the following PRs on how to use Langium to add a new diagram grammar.
+
+- https://github.com/mermaid-js/mermaid/pull/4839
+- https://github.com/mermaid-js/mermaid/pull/4751
+
+```warning
+The below steps are a work in progress and will be updated soon.
+```
+
### Step 1: Grammar & Parsing
-#### Grammar
-
-This would be to define a JISON grammar for the new diagram type. That should start with a way to identify that the text in the mermaid tag is a diagram of that type. Create a new folder under diagrams for your new diagram type and a parser folder in it. This leads us to step 2.
-
-For instance:
-
-- the flowchart starts with the keyword _graph_
-- the sequence diagram starts with the keyword _sequenceDiagram_
-
-#### Store data found during parsing
-
-There are some jison specific sub steps here where the parser stores the data encountered when parsing the diagram, this data is later used by the renderer. You can during the parsing call an object provided to the parser by the user of the parser. This object can be called during parsing for storing data.
-
-```jison
-statement
- : 'participant' actor { $$='actor'; }
- | signal { $$='signal'; }
- | note_statement { $$='note'; }
- | 'title' message { yy.setTitle($2); }
- ;
-```
-
-In the extract of the grammar above, it is defined that a call to the setTitle method in the data object will be done when parsing and the title keyword is encountered.
-
-```note
-Make sure that the `parseError` function for the parser is defined and calling `mermaid.parseError`. This way a common way of detecting parse errors is provided for the end-user.
-```
-
-For more info look at the example diagram type:
-
-The `yy` object has the following function:
-
-```javascript
-exports.parseError = function (err, hash) {
- mermaid.parseError(err, hash);
-};
-```
-
-when parsing the `yy` object is initialized as per below:
-
-```javascript
-const parser = exampleParser.parser;
-parser.yy = db;
-```
-
### Step 2: Rendering
Write a renderer that given the data found during parsing renders the diagram. To look at an example look at sequenceRenderer.js rather than the flowchart renderer as this is a more generic example.
@@ -62,52 +28,6 @@ would voice that as "U-M-L Deployment diagram." Another good key would be "deplo
Note that the diagram type key does not have to be the same as the diagram keyword chosen for the [grammar](#grammar), but it is helpful if they are the same.
-### Step 4: The final piece - triggering the rendering
-
-At this point when mermaid is trying to render the diagram, it will detect it as being of the new type but there will be no match when trying to render the diagram. To fix this add a new case in the switch statement in main.js:init this should match the diagram type returned from step #2. The code in this new case statement should call the renderer for the diagram type with the data found by the parser as an argument.
-
-## Usage of the parser as a separate module
-
-### Setup
-
-```javascript
-const graph = require('./graphDb');
-const flow = require('./parser/flow');
-flow.parser.yy = graph;
-```
-
-### Parsing
-
-```javascript
-flow.parser.parse(text);
-```
-
-### Data extraction
-
-```javascript
-graph.getDirection();
-graph.getVertices();
-graph.getEdges();
-```
-
-The parser is also exposed in the mermaid api by calling:
-
-```javascript
-const parser = mermaid.getParser();
-```
-
-Note that the parse needs a graph object to store the data as per:
-
-```javascript
-flow.parser.yy = graph;
-```
-
-Look at `graphDb.js` for more details on that object.
-
-## Layout
-
-If you are using a dagre based layout, please use flowchart-v2 as a template and by doing that you will be using dagre-wrapper instead of dagreD3 which we are migrating away from.
-
### Common parts of a diagram
There are a few features that are common between the different types of diagrams. We try to standardize the diagrams that work as similar as possible for the end user. The commonalities are:
@@ -137,33 +57,7 @@ See [the definition of aria-roledescription](https://www.w3.org/TR/wai-aria-1.1/
The syntax for accessible titles and descriptions is described in [the Accessibility documentation section.](../config/accessibility.md)
-As a design goal, the jison syntax should be similar between the diagrams.
-
-```jison
-
-* lexical grammar */
-%lex
-%x acc_title
-%x acc_descr
-%x acc_descr_multiline
-
-%%
-accTitle\s*":"\s* { this.begin("acc_title");return 'acc_title'; }
-(?!\n|;|#)*[^\n]* { this.popState(); return "acc_title_value"; }
-accDescr\s*":"\s* { this.begin("acc_descr");return 'acc_descr'; }
-(?!\n|;|#)*[^\n]* { this.popState(); return "acc_descr_value"; }
-accDescr\s*"{"\s* { this.begin("acc_descr_multiline");}
-[\}] { this.popState(); }
-[^\}]* return "acc_descr_multiline_value";
-
-statement
- : acc_title acc_title_value { $$=$2.trim();yy.setTitle($$); }
- | acc_descr acc_descr_value { $$=$2.trim();yy.setAccDescription($$); }
- | acc_descr_multiline_value { $$=$1.trim();yy.setAccDescription($$); }
-
-```
-
-The functions for setting title and description are provided by a common module. This is the import from flowDb.js:
+The functions for setting title and description are provided by a common module. This is the import in flowDb.js:
```
import {
diff --git a/packages/mermaid/src/docs/config/accessibility.md b/packages/mermaid/src/docs/config/accessibility.md
index 559c73987..b53567f73 100644
--- a/packages/mermaid/src/docs/config/accessibility.md
+++ b/packages/mermaid/src/docs/config/accessibility.md
@@ -13,7 +13,7 @@ Mermaid will automatically insert the [aria-roledescription](#aria-roledescripti
The [aria-roledescription](https://www.w3.org/TR/wai-aria-1.1/#aria-roledescription) for the SVG HTML element is set to the diagram type key. (Note this may be slightly different than the keyword used for the diagram in the diagram text.)
-For example: The diagram type key for a state diagram is "stateDiagram". Here (a part of) the HTML of the SVG tag that shows the automatically inserted aria-roledscription set to "stateDiagram". _(Note that some of the SVG attributes and the SVG contents are omitted for clarity.):_
+For example: The diagram type key for a state diagram is "stateDiagram". Here (a part of) the HTML of the SVG tag that shows the automatically inserted aria-roledescription set to "stateDiagram". _(Note that some of the SVG attributes and the SVG contents are omitted for clarity.):_
```html
|"$$\sqrt{x+3}$$"| B("$$\frac{1}{2}$$")
+ A -->|"$$\overbrace{a+b+c}^{\text{note}}$$"| C("$$\pi r^2$$")
+ B --> D("$$x = \begin{cases} a &\text{if } b \\ c &\text{if } d \end{cases}$$")
+ C --> E("$$x(t)=c_1\begin{bmatrix}-\cos{t}+\sin{t}\\ 2\cos{t} \end{bmatrix}e^{2t}$$")
+```
+
+### Sequence
+
+```mermaid
+sequenceDiagram
+ autonumber
+ participant 1 as $$\alpha$$
+ participant 2 as $$\beta$$
+ 1->>2: Solve: $$\sqrt{2+2}$$
+ 2-->>1: Answer: $$2$$
+ Note right of 2: $$\sqrt{2+2}=\sqrt{4}=2$$
+```
+
+## Legacy Support
+
+By default, MathML is used for rendering mathematical expressions. If you have users on [unsupported browsers](https://caniuse.com/?search=mathml), `legacyMathML` can be set in the config to fall back to CSS rendering. Note that **you must provide KaTeX's stylesheets on your own** as they do not come bundled with Mermaid.
+
+Example with legacy mode enabled (the latest version of KaTeX's stylesheet can be found on their [docs](https://katex.org/docs/browser.html)):
+
+```html
+
+
+
+
+
+
+
+
+
+
+
+
+```
diff --git a/packages/mermaid/src/docs/config/theming.md b/packages/mermaid/src/docs/config/theming.md
index 0e0853283..3863202b4 100644
--- a/packages/mermaid/src/docs/config/theming.md
+++ b/packages/mermaid/src/docs/config/theming.md
@@ -47,7 +47,7 @@ Example of `init` directive setting the `theme` to `forest`:
a --> b
```
-> **Reminder**: the only theme that can be customed is the `base` theme. The following section covers how to use `themeVariables` for customizations.
+> **Reminder**: the only theme that can be customized is the `base` theme. The following section covers how to use `themeVariables` for customizations.
## Customizing Themes with `themeVariables`
@@ -172,7 +172,7 @@ The theming engine will only recognize hex colors and not color names. So, the v
| actorBkg | mainBkg | Actor Background Color |
| actorBorder | primaryBorderColor | Actor Border Color |
| actorTextColor | primaryTextColor | Actor Text Color |
-| actorLineColor | grey | Actor Line Color |
+| actorLineColor | actorBorder | Actor Line Color |
| signalColor | textColor | Signal Color |
| signalTextColor | textColor | Signal Text Color |
| labelBoxBkgColor | actorBkg | Label Box Background Color |
diff --git a/packages/mermaid/src/docs/config/usage.md b/packages/mermaid/src/docs/config/usage.md
index da0ec5b57..eec87e49f 100644
--- a/packages/mermaid/src/docs/config/usage.md
+++ b/packages/mermaid/src/docs/config/usage.md
@@ -67,7 +67,7 @@ Example:
## Simple full example:
```html
-
+
@@ -392,3 +392,8 @@ mermaid.startOnLoad = true;
```warning
This way of setting the configuration is deprecated. Instead the preferred way is to use the initialize method. This functionality is only kept for backwards compatibility.
```
+
+
diff --git a/packages/mermaid/src/docs/ecosystem/integrations-community.md b/packages/mermaid/src/docs/ecosystem/integrations-community.md
index a567e6788..95e71d626 100644
--- a/packages/mermaid/src/docs/ecosystem/integrations-community.md
+++ b/packages/mermaid/src/docs/ecosystem/integrations-community.md
@@ -66,6 +66,12 @@ To add an integration to this list, see the [Integrations - create page](./integ
- [redmine-mermaid](https://github.com/styz/redmine_mermaid)
- Visual Studio Code [Polyglot Interactive Notebooks](https://github.com/dotnet/interactive#net-interactive)
+### LLM integrations
+
+LLM integrations to create mermaid diagrams using AI from text descriptions.
+
+- [HueHive - Create mermaid diagrams with text](https://huehive.co/tools/diagrams)
+
### CRM/ERP
Customer Relationship Management/Enterprise Resource Planning
@@ -90,6 +96,10 @@ Blogging frameworks and platforms
Content Management Systems/Enterprise Content Management
+- [ApostropheCMS](https://apostrophecms.com/)
+ - [Extension for Mermaid.js](https://github.com/BoDonkey/mermaid-extension)
+- [Drupal](https://drupal.org/)
+ - [Mermaid Diagram Field module](https://www.drupal.org/project/mermaid_diagram_field)
- [Grav CMS](https://getgrav.org/)
- [Mermaid Diagrams Plugin](https://github.com/DanielFlaum/grav-plugin-mermaid-diagrams)
- [GitLab Markdown Adapter](https://github.com/Goutte/grav-plugin-gitlab-markdown-adapter)
@@ -111,7 +121,7 @@ Communication tools and platforms
- [phpBB](https://phpbb.com)
- [phpbb-ext-mermaid](https://github.com/AlfredoRamos/phpbb-ext-mermaid)
- [Slack](https://slack.com)
- - [Mermaid Preview](https://github.com/JackuB/mermaid-for-slack)
+ - [Mermaid Preview](https://mermaid-preview.com)
### Wikis
@@ -210,23 +220,24 @@ Communication tools and platforms
### Browser Extensions
-| Name | Chrome Web Store | Firefox Add-ons | Opera | Edge | Source/Repository |
-| ------------------------ | ------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------ | ------------------------------------------------------------------------------ | ---------------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------- |
-| GitHub + Mermaid | - | [🦊🔗](https://addons.mozilla.org/firefox/addon/github-mermaid/) | - | - | [🐙🔗](https://github.com/BackMarket/github-mermaid-extension) |
-| Asciidoctor Live Preview | [🎡🔗](https://chrome.google.com/webstore/detail/asciidoctorjs-live-previe/iaalpfgpbocpdfblpnhhgllgbdbchmia) | - | - | [🌀🔗](https://microsoftedge.microsoft.com/addons/detail/asciidoctorjs-live-previ/pefkelkanablhjdekgdahplkccnbdggd?hl=en-US) | - |
-| Diagram Tab | - | - | - | - | [🐙🔗](https://github.com/khafast/diagramtab) |
-| Markdown Diagrams | [🎡🔗](https://chrome.google.com/webstore/detail/markdown-diagrams/pmoglnmodacnbbofbgcagndelmgaclel/) | [🦊🔗](https://addons.mozilla.org/en-US/firefox/addon/markdown-diagrams/) | [🔴🔗](https://addons.opera.com/en/extensions/details/markdown-diagrams/) | [🌀🔗](https://microsoftedge.microsoft.com/addons/detail/markdown-diagrams/hceenoomhhdkjjijnmlclkpenkapfihe) | [🐙🔗](https://github.com/marcozaccari/markdown-diagrams-browser-extension/tree/master/doc/examples) |
-| Markdown Viewer | - | [🦊🔗](https://addons.mozilla.org/en-US/firefox/addon/markdown-viewer-chrome/) | - | - | [🐙🔗](https://github.com/simov/markdown-viewer) |
-| Extensions for Mermaid | - | - | [🔴🔗](https://addons.opera.com/en/extensions/details/extensions-for-mermaid/) | - | [🐙🔗](https://github.com/Stefan-S/mermaid-extension) |
-| Chrome Diagrammer | [🎡🔗](https://chrome.google.com/webstore/detail/chrome-diagrammer/bkpbgjmkomfoakfklcjeoegkklgjnnpk) | - | - | - | - |
-| Mermaid Diagrams | [🎡🔗](https://chrome.google.com/webstore/detail/mermaid-diagrams/phfcghedmopjadpojhmmaffjmfiakfil) | - | - | - | - |
-| Monkeys | [🎡🔗](https://chrome.google.com/webstore/detail/monkeys-mermaid-for-githu/cplfdpoajbclbgphaphphcldamfkjlgi) | - | - | - | - |
-| Mermaid Previewer | [🎡🔗](https://chrome.google.com/webstore/detail/mermaid-previewer/oidjnlhbegipkcklbdfnbkikplpghfdl) | - | - | - | - |
+| Name | Chrome Web Store | Firefox Add-ons | Opera | Edge | Source/Repository |
+| ------------------------ | ----------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------ | ------------------------------------------------------------------------------ | ---------------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------- |
+| GitHub + Mermaid | - | [🦊🔗](https://addons.mozilla.org/firefox/addon/github-mermaid/) | - | - | [🐙🔗](https://github.com/BackMarket/github-mermaid-extension) |
+| Asciidoctor Live Preview | [🎡🔗](https://chromewebstore.google.com/detail/asciidoctorjs-live-previe/iaalpfgpbocpdfblpnhhgllgbdbchmia) | - | - | [🌀🔗](https://microsoftedge.microsoft.com/addons/detail/asciidoctorjs-live-previ/pefkelkanablhjdekgdahplkccnbdggd?hl=en-US) | - |
+| Diagram Tab | - | - | - | - | [🐙🔗](https://github.com/khafast/diagramtab) |
+| Markdown Diagrams | [🎡🔗](https://chromewebstore.google.com/detail/markdown-diagrams/pmoglnmodacnbbofbgcagndelmgaclel) | [🦊🔗](https://addons.mozilla.org/en-US/firefox/addon/markdown-diagrams/) | [🔴🔗](https://addons.opera.com/en/extensions/details/markdown-diagrams/) | [🌀🔗](https://microsoftedge.microsoft.com/addons/detail/markdown-diagrams/hceenoomhhdkjjijnmlclkpenkapfihe) | [🐙🔗](https://github.com/marcozaccari/markdown-diagrams-browser-extension/tree/master/doc/examples) |
+| Markdown Viewer | - | [🦊🔗](https://addons.mozilla.org/en-US/firefox/addon/markdown-viewer-chrome/) | - | - | [🐙🔗](https://github.com/simov/markdown-viewer) |
+| Extensions for Mermaid | - | - | [🔴🔗](https://addons.opera.com/en/extensions/details/extensions-for-mermaid/) | - | [🐙🔗](https://github.com/Stefan-S/mermaid-extension) |
+| Chrome Diagrammer | [🎡🔗](https://chromewebstore.google.com/detail/chrome-diagrammer/bkpbgjmkomfoakfklcjeoegkklgjnnpk) | - | - | - | - |
+| Mermaid Diagrams | [🎡🔗](https://chromewebstore.google.com/detail/mermaid-diagrams/phfcghedmopjadpojhmmaffjmfiakfil) | - | - | - | - |
+| Monkeys | [🎡🔗](https://chromewebstore.google.com/detail/monkeys-mermaid-for-githu/cplfdpoajbclbgphaphphcldamfkjlgi) | - | - | - | - |
+| Mermaid Previewer | [🎡🔗](https://chromewebstore.google.com/detail/mermaid-previewer/oidjnlhbegipkcklbdfnbkikplpghfdl) | - | - | - | - |
### Other
- [Bisheng](https://www.npmjs.com/package/bisheng)
- [bisheng-plugin-mermaid](https://github.com/yct21/bisheng-plugin-mermaid)
+- [Blazorade Mermaid: Render Mermaid diagrams in Blazor applications](https://github.com/Blazorade/Blazorade-Mermaid/wiki)
- [Codemia: A tool to practice system design problems](https://codemia.io) ✅
- [ExDoc](https://github.com/elixir-lang/ex_doc)
- [Rendering Mermaid graphs](https://github.com/elixir-lang/ex_doc#rendering-mermaid-graphs)
@@ -243,5 +254,5 @@ Communication tools and platforms
- [reveal-ck-mermaid-plugin](https://github.com/tmtm/reveal-ck-mermaid-plugin)
- [mermaid-isomorphic](https://github.com/remcohaszing/mermaid-isomorphic)
- [mermaid-server: Generate diagrams using a HTTP request](https://github.com/TomWright/mermaid-server)
-- [ExDoc](https://github.com/elixir-lang/ex_doc)
- - [Rendering Mermaid graphs](https://github.com/elixir-lang/ex_doc#rendering-mermaid-graphs)
+
+
diff --git a/packages/mermaid/src/docs/ecosystem/integrations-create.md b/packages/mermaid/src/docs/ecosystem/integrations-create.md
index c36951128..b14c43ec2 100644
--- a/packages/mermaid/src/docs/ecosystem/integrations-create.md
+++ b/packages/mermaid/src/docs/ecosystem/integrations-create.md
@@ -18,7 +18,7 @@ Currently pending [IANA](https://www.iana.org/) recognition.
### Mermaid Discord workspace
-We would love to see what you create with Mermaid. Please share your creations with us in our [Discord](https://discord.gg/wwtabKgp8y) server [#showcase](https://discord.com/channels/1079455296289788015/1079502635054399649) channel.
+We would love to see what you create with Mermaid. Please share your creations with us in our [Discord](https://discord.gg/AgrbSrBer3) server [#showcase](https://discord.com/channels/1079455296289788015/1079502635054399649) channel.
### Add to Mermaid Ecosystem
diff --git a/packages/mermaid/src/docs/ecosystem/tutorials.md b/packages/mermaid/src/docs/ecosystem/tutorials.md
index ed0143f05..d5bf9330d 100644
--- a/packages/mermaid/src/docs/ecosystem/tutorials.md
+++ b/packages/mermaid/src/docs/ecosystem/tutorials.md
@@ -74,3 +74,5 @@ graph LR;
**Output**

+
+
diff --git a/packages/mermaid/src/docs/intro/examples.md b/packages/mermaid/src/docs/intro/examples.md
index 978edb2b7..570dc3861 100644
--- a/packages/mermaid/src/docs/intro/examples.md
+++ b/packages/mermaid/src/docs/intro/examples.md
@@ -17,7 +17,7 @@ sequenceDiagram
participant Alice
participant Bob
Alice->>John: Hello John, how are you?
- loop Healthcheck
+ loop HealthCheck
John->>John: Fight against hypochondria
end
Note right of John: Rational thoughts prevail!
diff --git a/packages/mermaid/src/docs/intro/getting-started.md b/packages/mermaid/src/docs/intro/getting-started.md
index 1a97fcfbf..2bfa36bb7 100644
--- a/packages/mermaid/src/docs/intro/getting-started.md
+++ b/packages/mermaid/src/docs/intro/getting-started.md
@@ -239,18 +239,18 @@ In this example, the `mermaidAPI` is being called through the `CDN`:
Here is one mermaid diagram:
- graph TD
- A[Client] --> B[Load Balancer]
- B --> C[Server1]
+ graph TD
+ A[Client] --> B[Load Balancer]
+ B --> C[Server1]
B --> D[Server2]
And here is another:
- graph TD
+ graph TD
A[Client] -->|tcp_123| B
- B(Load Balancer)
- B -->|tcp_456| C[Server1]
+ B(Load Balancer)
+ B -->|tcp_456| C[Server1]
B -->|tcp_456| D[Server2]
@@ -271,15 +271,15 @@ In this example, `mermaid.js` is referenced in `src` as a separate JavaScript fi
- graph LR
- A --- B
- B-->C[fa:fa-ban forbidden]
+ graph LR
+ A --- B
+ B-->C[fa:fa-ban forbidden]
B-->D(fa:fa-spinner);
- graph TD
- A[Client] --> B[Load Balancer]
- B --> C[Server1]
+ graph TD
+ A[Client] --> B[Load Balancer]
+ B --> C[Server1]
B --> D[Server2]