Meet The Team
12 |Contributors
16 |
17 |
19 | Join the community
20 | and get involved!
21 |
├── docs ├── public │ ├── .nojekyll │ ├── favicon.ico │ ├── favicon.png │ ├── header.png │ ├── manifest.json │ ├── icons │ │ ├── folder.svg │ │ ├── terminal.svg │ │ ├── open-source.svg │ │ ├── public.svg │ │ ├── group.svg │ │ ├── comment.svg │ │ ├── presentation.svg │ │ └── whiteboard.svg │ └── mermaid-logo-horizontal.svg ├── img │ └── er.png ├── community │ └── img │ │ └── er.png ├── config │ ├── img │ │ ├── wrapped text.png │ │ ├── assignWithDepth.png │ │ ├── mathMLDifferences.png │ │ ├── accessibility-div-example.png │ │ ├── accessibility-div-example-2.png │ │ └── object.assign without depth.png │ ├── mermaidCLI.md │ └── setup │ │ ├── README.md │ │ ├── defaultConfig │ │ ├── README.md │ │ └── variables │ │ │ ├── configKeys.md │ │ │ └── default.md │ │ ├── mermaid │ │ ├── variables │ │ │ └── default.md │ │ ├── type-aliases │ │ │ ├── InternalHelpers.md │ │ │ ├── SVG.md │ │ │ ├── SVGGroup.md │ │ │ └── ParseErrorFunction.md │ │ └── interfaces │ │ │ ├── RenderOptions.md │ │ │ └── ParseOptions.md │ │ └── config │ │ ├── variables │ │ └── defaultConfig.md │ │ ├── functions │ │ ├── getUserDefinedConfig.md │ │ ├── saveConfigFromInitialize.md │ │ ├── addDirective.md │ │ ├── updateSiteConfig.md │ │ └── updateCurrentConfig.md │ │ └── README.md ├── intro │ └── img │ │ ├── Code-Preview-Config.png │ │ ├── Live-Editor-Choices.png │ │ └── book-banner-post-release.jpg ├── syntax │ └── img │ │ ├── Gantt-long-weekend-look.png │ │ ├── Gantt-excluded-days-within.png │ │ └── zenuml-participant-annotators.png └── ecosystem │ └── img │ ├── python-mermaid-integration.png │ └── python-mermaid-integration-updated.png ├── .node-version ├── .gitattributes ├── CHANGELOG.md ├── packages ├── mermaid │ ├── src │ │ ├── docs │ │ │ ├── public │ │ │ │ ├── .nojekyll │ │ │ │ ├── favicon.ico │ │ │ │ ├── favicon.png │ │ │ │ ├── header.png │ │ │ │ ├── manifest.json │ │ │ │ ├── icons │ │ │ │ │ ├── folder.svg │ │ │ │ │ ├── terminal.svg │ │ │ │ │ ├── open-source.svg │ │ │ │ │ ├── public.svg │ │ │ │ │ ├── group.svg │ │ │ │ │ ├── comment.svg │ │ │ │ │ └── presentation.svg │ │ │ │ └── mermaid-logo-horizontal.svg │ │ │ ├── img │ │ │ │ └── er.png │ │ │ ├── landing │ │ │ │ ├── er.png │ │ │ │ ├── class.png │ │ │ │ ├── cover.jpg │ │ │ │ ├── gantt.png │ │ │ │ ├── state.png │ │ │ │ ├── flowchart.png │ │ │ │ └── sequence-diagram.png │ │ │ ├── community │ │ │ │ └── img │ │ │ │ │ └── er.png │ │ │ ├── config │ │ │ │ ├── img │ │ │ │ │ ├── wrapped text.png │ │ │ │ │ ├── assignWithDepth.png │ │ │ │ │ ├── mathMLDifferences.png │ │ │ │ │ ├── accessibility-div-example.png │ │ │ │ │ ├── accessibility-div-example-2.png │ │ │ │ │ └── object.assign without depth.png │ │ │ │ ├── mermaidCLI.md │ │ │ │ └── layouts.md │ │ │ ├── intro │ │ │ │ └── img │ │ │ │ │ ├── Code-Preview-Config.png │ │ │ │ │ ├── Live-Editor-Choices.png │ │ │ │ │ └── book-banner-post-release.jpg │ │ │ ├── syntax │ │ │ │ ├── img │ │ │ │ │ ├── Gantt-long-weekend-look.png │ │ │ │ │ ├── Gantt-excluded-days-within.png │ │ │ │ │ └── zenuml-participant-annotators.png │ │ │ │ └── userJourney.md │ │ │ ├── ecosystem │ │ │ │ └── img │ │ │ │ │ ├── python-mermaid-integration.png │ │ │ │ │ └── python-mermaid-integration-updated.png │ │ │ ├── tsconfig.json │ │ │ └── .vitepress │ │ │ │ ├── components │ │ │ │ ├── Contributors.vue │ │ │ │ └── HomePage.vue │ │ │ │ └── theme │ │ │ │ ├── custom.css │ │ │ │ └── mermaid.ts │ │ ├── diagrams │ │ │ ├── kanban │ │ │ │ ├── kanbanTypes.ts │ │ │ │ ├── kanban-definition.ts │ │ │ │ └── detector.ts │ │ │ ├── sankey │ │ │ │ ├── styles.js │ │ │ │ ├── sankeyUtils.ts │ │ │ │ ├── sankeyDetector.ts │ │ │ │ └── sankeyDiagram.ts │ │ │ ├── c4 │ │ │ │ ├── styles.js │ │ │ │ ├── c4Diagram.ts │ │ │ │ └── c4Detector.ts │ │ │ ├── info │ │ │ │ ├── infoTypes.ts │ │ │ │ ├── infoDiagram.ts │ │ │ │ ├── infoDb.ts │ │ │ │ ├── infoParser.ts │ │ │ │ └── infoDetector.ts │ │ │ ├── block │ │ │ │ ├── blockUtils.ts │ │ │ │ ├── blockDiagram.ts │ │ │ │ ├── blockDetector.ts │ │ │ │ └── layout.spec.ts │ │ │ ├── error │ │ │ │ └── errorDiagram.ts │ │ │ ├── timeline │ │ │ │ ├── timeline-definition.ts │ │ │ │ └── detector.ts │ │ │ ├── radar │ │ │ │ ├── diagram.ts │ │ │ │ ├── detector.ts │ │ │ │ └── parser.ts │ │ │ ├── pie │ │ │ │ ├── pieDiagram.ts │ │ │ │ ├── pieDetector.ts │ │ │ │ └── pieParser.ts │ │ │ ├── xychart │ │ │ │ ├── xychartDiagram.ts │ │ │ │ ├── xychartDetector.ts │ │ │ │ └── chartBuilder │ │ │ │ │ └── index.ts │ │ │ ├── er │ │ │ │ ├── erRenderer.spec.ts │ │ │ │ ├── erDiagram.ts │ │ │ │ ├── erDetector.ts │ │ │ │ └── erTypes.ts │ │ │ ├── globalStyles.ts │ │ │ ├── quadrant-chart │ │ │ │ ├── quadrantDiagram.ts │ │ │ │ ├── quadrantDetector.ts │ │ │ │ └── utils.ts │ │ │ ├── packet │ │ │ │ ├── diagram.ts │ │ │ │ └── detector.ts │ │ │ ├── treemap │ │ │ │ ├── diagram.ts │ │ │ │ └── detector.ts │ │ │ ├── common │ │ │ │ ├── populateCommonDb.ts │ │ │ │ └── commonDb.ts │ │ │ ├── flowchart │ │ │ │ ├── parser │ │ │ │ │ └── flowParser.ts │ │ │ │ ├── flowDetector.ts │ │ │ │ ├── elk │ │ │ │ │ └── detector.ts │ │ │ │ └── flowDiagram.ts │ │ │ ├── git │ │ │ │ ├── gitGraphDiagram.ts │ │ │ │ ├── gitGraphDetector.ts │ │ │ │ └── parser │ │ │ │ │ └── desired syntax │ │ │ ├── gantt │ │ │ │ ├── ganttDiagram.ts │ │ │ │ └── ganttDetector.ts │ │ │ ├── architecture │ │ │ │ ├── architectureDiagram.ts │ │ │ │ └── architectureDetector.ts │ │ │ ├── mindmap │ │ │ │ ├── mindmap-definition.ts │ │ │ │ ├── mindmapTypes.ts │ │ │ │ └── detector.ts │ │ │ ├── requirement │ │ │ │ ├── requirementDiagram.ts │ │ │ │ └── requirementDetector.ts │ │ │ ├── user-journey │ │ │ │ ├── journeyDiagram.ts │ │ │ │ └── journeyDetector.ts │ │ │ ├── sequence │ │ │ │ ├── sequenceDetector.ts │ │ │ │ └── sequenceDiagram.ts │ │ │ ├── state │ │ │ │ ├── stateDiagram.ts │ │ │ │ ├── stateDiagram-v2.ts │ │ │ │ ├── stateDetector-V2.ts │ │ │ │ └── stateDetector.ts │ │ │ └── class │ │ │ │ ├── classDiagram.ts │ │ │ │ ├── classDiagram-v2.ts │ │ │ │ ├── svgDraw.spec.js │ │ │ │ ├── classDetector.ts │ │ │ │ ├── parser │ │ │ │ └── class.spec.js │ │ │ │ └── classDetector-V2.ts │ │ ├── type.d.ts │ │ ├── types │ │ │ └── cytoscape-cose-bilkent.d.ts │ │ ├── errors.ts │ │ ├── rendering-util │ │ │ ├── rendering-elements │ │ │ │ ├── intersect │ │ │ │ │ ├── intersect-node.js │ │ │ │ │ ├── intersect-circle.js │ │ │ │ │ ├── index.js │ │ │ │ │ ├── intersect-ellipse.js │ │ │ │ │ └── intersect-rect.js │ │ │ │ └── shapes │ │ │ │ │ ├── state.ts │ │ │ │ │ ├── mindmapCircle.ts │ │ │ │ │ ├── squareRect.ts │ │ │ │ │ └── insertPolygonShape.ts │ │ │ ├── uid.ts │ │ │ ├── insertElementsForSize.js │ │ │ └── selectSvgElement.ts │ │ ├── themes │ │ │ ├── theme-helpers.js │ │ │ ├── erDiagram-oldHardcodedValues.ts │ │ │ └── index.js │ │ ├── dagre-wrapper │ │ │ └── intersect │ │ │ │ ├── intersect-node.js │ │ │ │ ├── intersect-circle.js │ │ │ │ ├── index.js │ │ │ │ ├── intersect-ellipse.js │ │ │ │ └── intersect-rect.js │ │ ├── interactionDb.ts │ │ ├── utils │ │ │ ├── base64.ts │ │ │ ├── subGraphTitleMargins.spec.ts │ │ │ ├── subGraphTitleMargins.ts │ │ │ └── imperativeState.ts │ │ ├── diagram-api │ │ │ ├── comments.ts │ │ │ └── regexes.ts │ │ ├── setupGraphViewbox.spec.js │ │ └── __mocks__ │ │ │ └── mermaidAPI.ts │ ├── scripts │ │ ├── docs.cli.mts │ │ └── loadHook.mjs │ ├── .gitignore │ ├── tsconfig.eslint.json │ ├── typedoc.json │ ├── .madgerc │ ├── tsconfig.json │ └── .lintstagedrc.mjs ├── parser │ ├── src │ │ ├── language │ │ │ ├── info │ │ │ │ ├── index.ts │ │ │ │ ├── info.langium │ │ │ │ └── tokenBuilder.ts │ │ │ ├── packet │ │ │ │ ├── index.ts │ │ │ │ ├── tokenBuilder.ts │ │ │ │ └── packet.langium │ │ │ ├── pie │ │ │ │ ├── index.ts │ │ │ │ ├── tokenBuilder.ts │ │ │ │ ├── pie.langium │ │ │ │ └── valueConverter.ts │ │ │ ├── radar │ │ │ │ ├── index.ts │ │ │ │ └── tokenBuilder.ts │ │ │ ├── treemap │ │ │ │ ├── index.ts │ │ │ │ └── tokenBuilder.ts │ │ │ ├── architecture │ │ │ │ ├── index.ts │ │ │ │ ├── arch.langium │ │ │ │ ├── tokenBuilder.ts │ │ │ │ └── valueConverter.ts │ │ │ ├── gitGraph │ │ │ │ ├── index.ts │ │ │ │ ├── reference.langium │ │ │ │ └── tokenBuilder.ts │ │ │ └── common │ │ │ │ ├── index.ts │ │ │ │ └── matcher.ts │ │ └── index.ts │ ├── tsconfig.json │ └── tests │ │ └── packet.test.ts ├── mermaid-example-diagram │ ├── src │ │ ├── types │ │ │ └── index.d.ts │ │ ├── diagram-definition.ts │ │ ├── detector.ts │ │ ├── styles.js │ │ ├── exampleDiagramDb.js │ │ ├── exampleDiagram.spec.js │ │ └── parser │ │ │ └── exampleDiagram.jison │ ├── tsconfig.json │ └── tsconfig.eslint.json ├── mermaid-zenuml │ ├── tsconfig.json │ └── src │ │ ├── zenuml.d.ts │ │ ├── parser.ts │ │ ├── zenuml-definition.ts │ │ └── detector.ts ├── examples │ ├── src │ │ ├── types.ts │ │ └── examples │ │ │ ├── pie.ts │ │ │ ├── treemap.ts │ │ │ ├── state.ts │ │ │ ├── flowchart.ts │ │ │ ├── timeline.ts │ │ │ ├── sequence.ts │ │ │ ├── user-journey.ts │ │ │ ├── radar.ts │ │ │ ├── gantt.ts │ │ │ ├── block.ts │ │ │ ├── git.ts │ │ │ ├── requirement.ts │ │ │ ├── architecture.ts │ │ │ ├── xychart.ts │ │ │ ├── packet.ts │ │ │ ├── class.ts │ │ │ ├── mindmap.ts │ │ │ ├── quadrant-chart.ts │ │ │ └── er.ts │ ├── tsconfig.json │ └── package.json ├── mermaid-layout-elk │ ├── src │ │ ├── find-common-ancestor.d.ts │ │ ├── layouts.ts │ │ └── find-common-ancestor.ts │ └── tsconfig.json ├── mermaid-layout-tidy-tree │ ├── tsconfig.json │ ├── src │ │ ├── layouts.ts │ │ └── non-layered-tidy-tree-layout.d.ts │ └── CHANGELOG.md └── tiny │ └── package.json ├── CONTRIBUTING.md ├── cypress ├── support │ ├── eyes-index.d.ts │ └── e2e.js ├── platform │ ├── xss.png │ ├── exploit.js │ ├── empty.html │ ├── xss22.html │ ├── e2e.html │ ├── iife.html │ ├── flow-elk.html │ ├── render-after-error.html │ ├── regression │ │ └── issue-1874.html │ └── ghsa2.html ├── fixtures │ └── example.json ├── .eslintrc.json ├── tsconfig.json └── integration │ ├── rendering │ ├── info.spec.ts │ ├── marker_unique_id.spec.js │ ├── zenuml.spec.js │ ├── current.spec.js │ └── flowchart-icon.spec.js │ └── other │ ├── iife.spec.js │ ├── external-diagrams.spec.js │ ├── rerender.spec.js │ └── ghsa.spec.js ├── .hadolint.yaml ├── img ├── header.png ├── gray-pie.png ├── gray-class.png ├── gray-flow.png ├── gray-gantt.png ├── gray-state.png ├── gray-journey.png ├── gray-sequence.png ├── GitHub-Mark-32px.png └── gray-user-journey.png ├── .github ├── codeql │ └── codeql-config.yml ├── workflows │ ├── unlock-reopened-issues.yml │ ├── issue-triage.yml │ └── update-browserlist.yml ├── codecov.yaml ├── pr-labeler.yml ├── FUNDING.yml ├── ISSUE_TEMPLATE │ └── config.yml └── stale.yml ├── .husky └── pre-commit ├── .changeset ├── slow-lemons-know.md ├── brave-memes-flash.md ├── chilly-words-march.md ├── short-seals-sort.md ├── ten-plums-bet.md ├── brave-baths-behave.md ├── lazy-brooms-battle.md ├── loud-results-melt.md ├── wide-lines-trade.md ├── curly-apes-prove.md ├── busy-mirrors-try.md ├── sweet-games-build.md ├── tricky-rivers-stand.md ├── chatty-insects-dream.md ├── config.json └── README.md ├── .cspell ├── misc-terms.txt ├── contributors.txt └── mermaid-terms.txt ├── .ackrc ├── FUNDING.json ├── .npmrc ├── pnpm-workspace.yaml ├── .prettierrc.json ├── vitest.workspace.js ├── .vscode └── extensions.json ├── .build ├── generateLangium.ts ├── jisonTransformer.ts └── types.ts ├── .editorconfig ├── tests └── webpack │ ├── public │ └── index.html │ ├── webpack.config.js │ └── package.json ├── Dockerfile ├── patches └── roughjs.patch ├── .vite ├── jisonPlugin.ts └── jsonSchemaPlugin.ts ├── .lintstagedrc.mjs ├── .esbuild └── jisonPlugin.ts ├── .prettierignore ├── tsconfig.eslint.json ├── CITATION.cff ├── scripts └── coverage.ts ├── demos ├── dev │ └── reload.js └── info.html ├── netlify.toml ├── docker-compose.yml └── .gitignore /docs/public/.nojekyll: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /.node-version: -------------------------------------------------------------------------------- 1 | 22.14.0 2 | -------------------------------------------------------------------------------- /.gitattributes: -------------------------------------------------------------------------------- 1 | * text=auto 2 | -------------------------------------------------------------------------------- /CHANGELOG.md: -------------------------------------------------------------------------------- 1 | ./packages/mermaid/CHANGELOG.md -------------------------------------------------------------------------------- /packages/mermaid/src/docs/public/.nojekyll: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /CONTRIBUTING.md: -------------------------------------------------------------------------------- 1 | ./packages/mermaid/src/docs/community/contributing.md -------------------------------------------------------------------------------- /cypress/support/eyes-index.d.ts: -------------------------------------------------------------------------------- 1 | import '@applitools/eyes-cypress'; 2 | -------------------------------------------------------------------------------- /packages/parser/src/language/info/index.ts: -------------------------------------------------------------------------------- 1 | export * from './module.js'; 2 | -------------------------------------------------------------------------------- /packages/parser/src/language/packet/index.ts: -------------------------------------------------------------------------------- 1 | export * from './module.js'; 2 | -------------------------------------------------------------------------------- /packages/parser/src/language/pie/index.ts: -------------------------------------------------------------------------------- 1 | export * from './module.js'; 2 | -------------------------------------------------------------------------------- /packages/parser/src/language/radar/index.ts: -------------------------------------------------------------------------------- 1 | export * from './module.js'; 2 | -------------------------------------------------------------------------------- /packages/parser/src/language/treemap/index.ts: -------------------------------------------------------------------------------- 1 | export * from './module.js'; 2 | -------------------------------------------------------------------------------- /.hadolint.yaml: -------------------------------------------------------------------------------- 1 | ignored: 2 | - DL3002 # TODO: Last USER should not be root 3 | -------------------------------------------------------------------------------- /img/header.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/code/app-mermaid/develop/img/header.png -------------------------------------------------------------------------------- /packages/parser/src/language/architecture/index.ts: -------------------------------------------------------------------------------- 1 | export * from './module.js'; 2 | -------------------------------------------------------------------------------- /packages/parser/src/language/gitGraph/index.ts: -------------------------------------------------------------------------------- 1 | export * from './module.js'; 2 | -------------------------------------------------------------------------------- /docs/img/er.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/code/app-mermaid/develop/docs/img/er.png -------------------------------------------------------------------------------- /img/gray-pie.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/code/app-mermaid/develop/img/gray-pie.png -------------------------------------------------------------------------------- /img/gray-class.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/code/app-mermaid/develop/img/gray-class.png -------------------------------------------------------------------------------- /img/gray-flow.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/code/app-mermaid/develop/img/gray-flow.png -------------------------------------------------------------------------------- /img/gray-gantt.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/code/app-mermaid/develop/img/gray-gantt.png -------------------------------------------------------------------------------- /img/gray-state.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/code/app-mermaid/develop/img/gray-state.png -------------------------------------------------------------------------------- /img/gray-journey.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/code/app-mermaid/develop/img/gray-journey.png -------------------------------------------------------------------------------- /img/gray-sequence.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/code/app-mermaid/develop/img/gray-sequence.png -------------------------------------------------------------------------------- /cypress/platform/xss.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/code/app-mermaid/develop/cypress/platform/xss.png -------------------------------------------------------------------------------- /docs/public/favicon.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/code/app-mermaid/develop/docs/public/favicon.ico -------------------------------------------------------------------------------- /docs/public/favicon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/code/app-mermaid/develop/docs/public/favicon.png -------------------------------------------------------------------------------- /docs/public/header.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/code/app-mermaid/develop/docs/public/header.png -------------------------------------------------------------------------------- /img/GitHub-Mark-32px.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/code/app-mermaid/develop/img/GitHub-Mark-32px.png -------------------------------------------------------------------------------- /.github/codeql/codeql-config.yml: -------------------------------------------------------------------------------- 1 | name: 'CodeQL config' 2 | paths-ignore: 3 | - dist 4 | - cypress 5 | -------------------------------------------------------------------------------- /.husky/pre-commit: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env sh 2 | NODE_OPTIONS="--max_old_space_size=8192" pnpm run pre-commit 3 | -------------------------------------------------------------------------------- /docs/community/img/er.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/code/app-mermaid/develop/docs/community/img/er.png -------------------------------------------------------------------------------- /img/gray-user-journey.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/code/app-mermaid/develop/img/gray-user-journey.png -------------------------------------------------------------------------------- /.changeset/slow-lemons-know.md: -------------------------------------------------------------------------------- 1 | --- 2 | '@mermaid': patch 3 | --- 4 | 5 | fix: Mindmap breaking in ELK layout 6 | -------------------------------------------------------------------------------- /packages/mermaid/scripts/docs.cli.mts: -------------------------------------------------------------------------------- 1 | import { processDocs } from './docs.mjs'; 2 | 3 | void processDocs(); 4 | -------------------------------------------------------------------------------- /.cspell/misc-terms.txt: -------------------------------------------------------------------------------- 1 | BRANDES 2 | Buzan 3 | circo 4 | handDrawn 5 | KOEPF 6 | neato 7 | newbranch 8 | validify 9 | -------------------------------------------------------------------------------- /docs/config/img/wrapped text.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/code/app-mermaid/develop/docs/config/img/wrapped text.png -------------------------------------------------------------------------------- /.changeset/brave-memes-flash.md: -------------------------------------------------------------------------------- 1 | --- 2 | 'mermaid': patch 3 | --- 4 | 5 | fix: Support edge animation in hand drawn look 6 | -------------------------------------------------------------------------------- /docs/config/img/assignWithDepth.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/code/app-mermaid/develop/docs/config/img/assignWithDepth.png -------------------------------------------------------------------------------- /packages/mermaid/src/docs/img/er.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/code/app-mermaid/develop/packages/mermaid/src/docs/img/er.png -------------------------------------------------------------------------------- /packages/parser/src/language/architecture/arch.langium: -------------------------------------------------------------------------------- 1 | terminal ARCH_ICON: /\([\w-:]+\)/; 2 | terminal ARCH_TITLE: /\[[\w ]+\]/; -------------------------------------------------------------------------------- /packages/parser/src/language/common/index.ts: -------------------------------------------------------------------------------- 1 | export * from './tokenBuilder.js'; 2 | export * from './valueConverter.js'; 3 | -------------------------------------------------------------------------------- /.changeset/chilly-words-march.md: -------------------------------------------------------------------------------- 1 | --- 2 | 'mermaid': patch 3 | --- 4 | 5 | fix: Correct viewBox casing and make SVGs responsive 6 | -------------------------------------------------------------------------------- /.changeset/short-seals-sort.md: -------------------------------------------------------------------------------- 1 | --- 2 | 'mermaid': minor 3 | --- 4 | 5 | feat: allow to put notes in namespaces on classDiagram 6 | -------------------------------------------------------------------------------- /.changeset/ten-plums-bet.md: -------------------------------------------------------------------------------- 1 | --- 2 | 'mermaid': patch 3 | --- 4 | 5 | fix: Support ComponentQueue_Ext to prevent parsing error 6 | -------------------------------------------------------------------------------- /docs/config/img/mathMLDifferences.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/code/app-mermaid/develop/docs/config/img/mathMLDifferences.png -------------------------------------------------------------------------------- /docs/intro/img/Code-Preview-Config.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/code/app-mermaid/develop/docs/intro/img/Code-Preview-Config.png -------------------------------------------------------------------------------- /docs/intro/img/Live-Editor-Choices.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/code/app-mermaid/develop/docs/intro/img/Live-Editor-Choices.png -------------------------------------------------------------------------------- /packages/mermaid/src/docs/landing/er.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/code/app-mermaid/develop/packages/mermaid/src/docs/landing/er.png -------------------------------------------------------------------------------- /.ackrc: -------------------------------------------------------------------------------- 1 | --ignore-dir=dist 2 | --ignore-file=match:/^yarn\.lock$/ 3 | --ignore-file=match:/^yarn-error\.log$/ 4 | --ignore-dir=coverage 5 | -------------------------------------------------------------------------------- /docs/intro/img/book-banner-post-release.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/code/app-mermaid/develop/docs/intro/img/book-banner-post-release.jpg -------------------------------------------------------------------------------- /docs/syntax/img/Gantt-long-weekend-look.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/code/app-mermaid/develop/docs/syntax/img/Gantt-long-weekend-look.png -------------------------------------------------------------------------------- /packages/mermaid/src/docs/landing/class.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/code/app-mermaid/develop/packages/mermaid/src/docs/landing/class.png -------------------------------------------------------------------------------- /packages/mermaid/src/docs/landing/cover.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/code/app-mermaid/develop/packages/mermaid/src/docs/landing/cover.jpg -------------------------------------------------------------------------------- /packages/mermaid/src/docs/landing/gantt.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/code/app-mermaid/develop/packages/mermaid/src/docs/landing/gantt.png -------------------------------------------------------------------------------- /packages/mermaid/src/docs/landing/state.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/code/app-mermaid/develop/packages/mermaid/src/docs/landing/state.png -------------------------------------------------------------------------------- /packages/mermaid/src/docs/public/favicon.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/code/app-mermaid/develop/packages/mermaid/src/docs/public/favicon.ico -------------------------------------------------------------------------------- /packages/mermaid/src/docs/public/favicon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/code/app-mermaid/develop/packages/mermaid/src/docs/public/favicon.png -------------------------------------------------------------------------------- /packages/mermaid/src/docs/public/header.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/code/app-mermaid/develop/packages/mermaid/src/docs/public/header.png -------------------------------------------------------------------------------- /.changeset/brave-baths-behave.md: -------------------------------------------------------------------------------- 1 | --- 2 | 'mermaid': patch 3 | --- 4 | 5 | fix: Prevent HTML tags from being escaped in sandbox label rendering 6 | -------------------------------------------------------------------------------- /FUNDING.json: -------------------------------------------------------------------------------- 1 | { 2 | "drips": { 3 | "ethereum": { 4 | "ownedBy": "0x0831DDFe60d009d9448CC976157b539089aB821E" 5 | } 6 | } 7 | } 8 | -------------------------------------------------------------------------------- /docs/config/img/accessibility-div-example.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/code/app-mermaid/develop/docs/config/img/accessibility-div-example.png -------------------------------------------------------------------------------- /docs/syntax/img/Gantt-excluded-days-within.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/code/app-mermaid/develop/docs/syntax/img/Gantt-excluded-days-within.png -------------------------------------------------------------------------------- /packages/mermaid/src/diagrams/kanban/kanbanTypes.ts: -------------------------------------------------------------------------------- 1 | import type kanbanDb from './kanbanDb.js'; 2 | 3 | export type KanbanDB = typeof kanbanDb; 4 | -------------------------------------------------------------------------------- /packages/mermaid/src/docs/community/img/er.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/code/app-mermaid/develop/packages/mermaid/src/docs/community/img/er.png -------------------------------------------------------------------------------- /.changeset/lazy-brooms-battle.md: -------------------------------------------------------------------------------- 1 | --- 2 | 'mermaid': patch 3 | --- 4 | 5 | feat: add alias support for new participant syntax of sequence diagrams 6 | -------------------------------------------------------------------------------- /.changeset/loud-results-melt.md: -------------------------------------------------------------------------------- 1 | --- 2 | 'mermaid': minor 3 | --- 4 | 5 | feat: Add half-arrowheads (solid & stick) and central connection support 6 | -------------------------------------------------------------------------------- /.changeset/wide-lines-trade.md: -------------------------------------------------------------------------------- 1 | --- 2 | 'mermaid': patch 3 | --- 4 | 5 | fix: Mindmap rendering issue when the number of Level 2 nodes exceeds 11 6 | -------------------------------------------------------------------------------- /.npmrc: -------------------------------------------------------------------------------- 1 | registry=https://registry.npmjs.org 2 | auto-install-peers=true 3 | strict-peer-dependencies=false 4 | package-import-method=clone-or-copy 5 | -------------------------------------------------------------------------------- /docs/config/img/accessibility-div-example-2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/code/app-mermaid/develop/docs/config/img/accessibility-div-example-2.png -------------------------------------------------------------------------------- /docs/config/img/object.assign without depth.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/code/app-mermaid/develop/docs/config/img/object.assign without depth.png -------------------------------------------------------------------------------- /docs/ecosystem/img/python-mermaid-integration.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/code/app-mermaid/develop/docs/ecosystem/img/python-mermaid-integration.png -------------------------------------------------------------------------------- /docs/syntax/img/zenuml-participant-annotators.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/code/app-mermaid/develop/docs/syntax/img/zenuml-participant-annotators.png -------------------------------------------------------------------------------- /packages/mermaid/src/docs/landing/flowchart.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/code/app-mermaid/develop/packages/mermaid/src/docs/landing/flowchart.png -------------------------------------------------------------------------------- /pnpm-workspace.yaml: -------------------------------------------------------------------------------- 1 | packages: 2 | - 'packages/*' 3 | - 'packages/mermaid/src/docs' 4 | - 'packages/mermaid/src/vitepress' 5 | - 'tests/*' 6 | -------------------------------------------------------------------------------- /.changeset/curly-apes-prove.md: -------------------------------------------------------------------------------- 1 | --- 2 | 'mermaid': patch 3 | --- 4 | 5 | fix: Improve participant parsing and prevent recursive loops on invalid syntax 6 | -------------------------------------------------------------------------------- /.changeset/busy-mirrors-try.md: -------------------------------------------------------------------------------- 1 | --- 2 | 'mermaid': patch 3 | --- 4 | 5 | fix: Resolved parsing error where direction TD was not recognized within subgraphs 6 | -------------------------------------------------------------------------------- /packages/mermaid/src/docs/config/img/wrapped text.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/code/app-mermaid/develop/packages/mermaid/src/docs/config/img/wrapped text.png -------------------------------------------------------------------------------- /packages/mermaid/src/docs/landing/sequence-diagram.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/code/app-mermaid/develop/packages/mermaid/src/docs/landing/sequence-diagram.png -------------------------------------------------------------------------------- /.changeset/sweet-games-build.md: -------------------------------------------------------------------------------- 1 | --- 2 | 'mermaid': patch 3 | --- 4 | 5 | fix(er-diagram): prevent syntax error when using 'u', numbers, and decimals in node names 6 | -------------------------------------------------------------------------------- /.changeset/tricky-rivers-stand.md: -------------------------------------------------------------------------------- 1 | --- 2 | 'mermaid': patch 3 | --- 4 | 5 | fix: validate dates and tick interval to prevent UI freeze/crash in gantt diagramtype 6 | -------------------------------------------------------------------------------- /packages/mermaid/src/docs/config/img/assignWithDepth.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/code/app-mermaid/develop/packages/mermaid/src/docs/config/img/assignWithDepth.png -------------------------------------------------------------------------------- /packages/mermaid/src/type.d.ts: -------------------------------------------------------------------------------- 1 | // eslint-disable-next-line no-var 2 | declare var injected: { 3 | version: string; 4 | includeLargeFeatures: boolean; 5 | }; 6 | -------------------------------------------------------------------------------- /.changeset/chatty-insects-dream.md: -------------------------------------------------------------------------------- 1 | --- 2 | 'mermaid': patch 3 | --- 4 | 5 | fix(treemap): Fixed treemap classDef style application to properly apply user-defined styles 6 | -------------------------------------------------------------------------------- /docs/ecosystem/img/python-mermaid-integration-updated.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/code/app-mermaid/develop/docs/ecosystem/img/python-mermaid-integration-updated.png -------------------------------------------------------------------------------- /packages/mermaid/src/docs/config/img/mathMLDifferences.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/code/app-mermaid/develop/packages/mermaid/src/docs/config/img/mathMLDifferences.png -------------------------------------------------------------------------------- /packages/mermaid/src/docs/intro/img/Code-Preview-Config.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/code/app-mermaid/develop/packages/mermaid/src/docs/intro/img/Code-Preview-Config.png -------------------------------------------------------------------------------- /packages/mermaid/src/docs/intro/img/Live-Editor-Choices.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/code/app-mermaid/develop/packages/mermaid/src/docs/intro/img/Live-Editor-Choices.png -------------------------------------------------------------------------------- /packages/mermaid/src/types/cytoscape-cose-bilkent.d.ts: -------------------------------------------------------------------------------- 1 | declare module 'cytoscape-cose-bilkent' { 2 | const coseBilkent: any; 3 | export default coseBilkent; 4 | } 5 | -------------------------------------------------------------------------------- /.prettierrc.json: -------------------------------------------------------------------------------- 1 | { 2 | "endOfLine": "auto", 3 | "printWidth": 100, 4 | "singleQuote": true, 5 | "useTabs": false, 6 | "tabWidth": 2, 7 | "trailingComma": "es5" 8 | } 9 | -------------------------------------------------------------------------------- /packages/mermaid/src/docs/intro/img/book-banner-post-release.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/code/app-mermaid/develop/packages/mermaid/src/docs/intro/img/book-banner-post-release.jpg -------------------------------------------------------------------------------- /packages/mermaid/src/docs/syntax/img/Gantt-long-weekend-look.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/code/app-mermaid/develop/packages/mermaid/src/docs/syntax/img/Gantt-long-weekend-look.png -------------------------------------------------------------------------------- /vitest.workspace.js: -------------------------------------------------------------------------------- 1 | import { defineWorkspace } from 'vitest/config'; 2 | 3 | export default defineWorkspace(['./vite.config.ts', './packages/mermaid/src/docs/vite.config.ts']); 4 | -------------------------------------------------------------------------------- /packages/mermaid-example-diagram/src/types/index.d.ts: -------------------------------------------------------------------------------- 1 | export {}; 2 | 3 | declare global { 4 | interface Window { 5 | mermaid: any; // 👈️ turn off type checking 6 | } 7 | } 8 | -------------------------------------------------------------------------------- /packages/mermaid/.gitignore: -------------------------------------------------------------------------------- 1 | src/vitepress 2 | src/docs/config/setup 3 | README.* 4 | src/docs/public/user-avatars/ 5 | src/docs/.vitepress/cache 6 | src/docs/.vitepress/components.d.ts 7 | -------------------------------------------------------------------------------- /packages/mermaid/src/docs/config/img/accessibility-div-example.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/code/app-mermaid/develop/packages/mermaid/src/docs/config/img/accessibility-div-example.png -------------------------------------------------------------------------------- /.vscode/extensions.json: -------------------------------------------------------------------------------- 1 | { 2 | "recommendations": [ 3 | "dbaeumer.vscode-eslint", 4 | "esbenp.prettier-vscode", 5 | "vitest.explorer", 6 | "luniclynx.bison" 7 | ] 8 | } 9 | -------------------------------------------------------------------------------- /packages/mermaid/src/diagrams/sankey/styles.js: -------------------------------------------------------------------------------- 1 | const getStyles = (options) => 2 | `.label { 3 | font-family: ${options.fontFamily}; 4 | }`; 5 | 6 | export default getStyles; 7 | -------------------------------------------------------------------------------- /packages/mermaid/src/docs/config/img/accessibility-div-example-2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/code/app-mermaid/develop/packages/mermaid/src/docs/config/img/accessibility-div-example-2.png -------------------------------------------------------------------------------- /packages/mermaid/src/docs/config/img/object.assign without depth.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/code/app-mermaid/develop/packages/mermaid/src/docs/config/img/object.assign without depth.png -------------------------------------------------------------------------------- /packages/mermaid/src/docs/syntax/img/Gantt-excluded-days-within.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/code/app-mermaid/develop/packages/mermaid/src/docs/syntax/img/Gantt-excluded-days-within.png -------------------------------------------------------------------------------- /packages/mermaid/src/docs/ecosystem/img/python-mermaid-integration.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/code/app-mermaid/develop/packages/mermaid/src/docs/ecosystem/img/python-mermaid-integration.png -------------------------------------------------------------------------------- /packages/mermaid/src/docs/syntax/img/zenuml-participant-annotators.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/code/app-mermaid/develop/packages/mermaid/src/docs/syntax/img/zenuml-participant-annotators.png -------------------------------------------------------------------------------- /.build/generateLangium.ts: -------------------------------------------------------------------------------- 1 | import { generate } from 'langium-cli'; 2 | 3 | export async function generateLangium() { 4 | await generate({ file: `./packages/parser/langium-config.json` }); 5 | } 6 | -------------------------------------------------------------------------------- /packages/mermaid/src/docs/config/mermaidCLI.md: -------------------------------------------------------------------------------- 1 | # mermaid CLI 2 | 3 | mermaid CLI has been moved to [mermaid-cli](https://github.com/mermaid-js/mermaid-cli). Please read its documentation instead. 4 | -------------------------------------------------------------------------------- /packages/mermaid/src/errors.ts: -------------------------------------------------------------------------------- 1 | export class UnknownDiagramError extends Error { 2 | constructor(message: string) { 3 | super(message); 4 | this.name = 'UnknownDiagramError'; 5 | } 6 | } 7 | -------------------------------------------------------------------------------- /cypress/fixtures/example.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "Using fixtures to represent data", 3 | "email": "hello@cypress.io", 4 | "body": "Fixtures are a great way to mock data for responses to routes" 5 | } 6 | -------------------------------------------------------------------------------- /packages/mermaid/src/rendering-util/rendering-elements/intersect/intersect-node.js: -------------------------------------------------------------------------------- 1 | function intersectNode(node, point) { 2 | return node.intersect(point); 3 | } 4 | 5 | export default intersectNode; 6 | -------------------------------------------------------------------------------- /packages/mermaid/src/docs/ecosystem/img/python-mermaid-integration-updated.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/code/app-mermaid/develop/packages/mermaid/src/docs/ecosystem/img/python-mermaid-integration-updated.png -------------------------------------------------------------------------------- /packages/mermaid/src/themes/theme-helpers.js: -------------------------------------------------------------------------------- 1 | import { adjust } from 'khroma'; 2 | 3 | export const mkBorder = (col, darkMode) => 4 | darkMode ? adjust(col, { s: -40, l: 10 }) : adjust(col, { s: -40, l: -10 }); 5 | -------------------------------------------------------------------------------- /packages/mermaid/src/diagrams/c4/styles.js: -------------------------------------------------------------------------------- 1 | const getStyles = (options) => 2 | `.person { 3 | stroke: ${options.personBorder}; 4 | fill: ${options.personBkg}; 5 | } 6 | `; 7 | 8 | export default getStyles; 9 | -------------------------------------------------------------------------------- /packages/parser/src/language/info/info.langium: -------------------------------------------------------------------------------- 1 | grammar Info 2 | import "../common/common"; 3 | 4 | entry Info: 5 | NEWLINE* 6 | "info" NEWLINE* 7 | ("showInfo" NEWLINE*)? 8 | TitleAndAccessibilities? 9 | ; 10 | -------------------------------------------------------------------------------- /.editorconfig: -------------------------------------------------------------------------------- 1 | root = true 2 | 3 | [*] 4 | indent_style = space 5 | indent_size = 2 6 | charset = utf-8 7 | trim_trailing_whitespace = true 8 | insert_final_newline = true 9 | 10 | [*.md] 11 | indent_size = 4 12 | -------------------------------------------------------------------------------- /cypress/.eslintrc.json: -------------------------------------------------------------------------------- 1 | { 2 | "env": { 3 | "cypress/globals": true 4 | }, 5 | "extends": ["plugin:cypress/recommended"], 6 | "plugins": ["cypress"], 7 | "rules": { 8 | "cypress/no-unnecessary-waiting": 0 9 | } 10 | } 11 | -------------------------------------------------------------------------------- /.cspell/contributors.txt: -------------------------------------------------------------------------------- 1 | # Contributors to mermaidjs, one per line 2 | Ashish Jain 3 | cpettitt 4 | Dong Cai 5 | fourcube 6 | knsv 7 | Knut Sveidqvist 8 | Nikolay Rozhkov 9 | Peng Xiao 10 | Per Brolin 11 | Sidharth Vinod 12 | subhash-halder 13 | -------------------------------------------------------------------------------- /packages/mermaid-zenuml/tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "../../tsconfig.json", 3 | "compilerOptions": { 4 | "rootDir": "./src", 5 | "outDir": "./dist" 6 | }, 7 | "include": ["./src/**/*.ts"], 8 | "typeRoots": ["./src/types"] 9 | } 10 | -------------------------------------------------------------------------------- /packages/mermaid-example-diagram/tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "../../tsconfig.json", 3 | "compilerOptions": { 4 | "rootDir": "./src", 5 | "outDir": "./dist" 6 | }, 7 | "include": ["./src/**/*.ts"], 8 | "typeRoots": ["./src/types"] 9 | } 10 | -------------------------------------------------------------------------------- /packages/mermaid/src/docs/tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "$schema": "https://json.schemastore.org/tsconfig", 3 | "extends": ["../../../../tsconfig.json"], 4 | "compilerOptions": { 5 | "noEmit": true 6 | }, 7 | "include": ["./**/*.ts", "./.vitepress/**/*.ts"] 8 | } 9 | -------------------------------------------------------------------------------- /packages/parser/src/language/packet/tokenBuilder.ts: -------------------------------------------------------------------------------- 1 | import { AbstractMermaidTokenBuilder } from '../common/index.js'; 2 | 3 | export class PacketTokenBuilder extends AbstractMermaidTokenBuilder { 4 | public constructor() { 5 | super(['packet']); 6 | } 7 | } 8 | -------------------------------------------------------------------------------- /packages/parser/src/language/pie/tokenBuilder.ts: -------------------------------------------------------------------------------- 1 | import { AbstractMermaidTokenBuilder } from '../common/index.js'; 2 | 3 | export class PieTokenBuilder extends AbstractMermaidTokenBuilder { 4 | public constructor() { 5 | super(['pie', 'showData']); 6 | } 7 | } 8 | -------------------------------------------------------------------------------- /packages/parser/src/language/radar/tokenBuilder.ts: -------------------------------------------------------------------------------- 1 | import { AbstractMermaidTokenBuilder } from '../common/index.js'; 2 | 3 | export class RadarTokenBuilder extends AbstractMermaidTokenBuilder { 4 | public constructor() { 5 | super(['radar-beta']); 6 | } 7 | } 8 | -------------------------------------------------------------------------------- /packages/parser/src/language/treemap/tokenBuilder.ts: -------------------------------------------------------------------------------- 1 | import { AbstractMermaidTokenBuilder } from '../common/index.js'; 2 | 3 | export class TreemapTokenBuilder extends AbstractMermaidTokenBuilder { 4 | public constructor() { 5 | super(['treemap']); 6 | } 7 | } 8 | -------------------------------------------------------------------------------- /packages/parser/src/language/gitGraph/reference.langium: -------------------------------------------------------------------------------- 1 | // Alphanumerics with underscores, dashes, slashes, and dots 2 | // Must start with an alphanumeric or an underscore 3 | // Cant end with a dash, slash, or dot 4 | terminal REFERENCE returns string: /\w([-\./\w]*[-\w])?/; -------------------------------------------------------------------------------- /packages/parser/src/language/gitGraph/tokenBuilder.ts: -------------------------------------------------------------------------------- 1 | import { AbstractMermaidTokenBuilder } from '../common/index.js'; 2 | 3 | export class GitGraphTokenBuilder extends AbstractMermaidTokenBuilder { 4 | public constructor() { 5 | super(['gitGraph']); 6 | } 7 | } 8 | -------------------------------------------------------------------------------- /packages/parser/src/language/info/tokenBuilder.ts: -------------------------------------------------------------------------------- 1 | import { AbstractMermaidTokenBuilder } from '../common/index.js'; 2 | 3 | export class InfoTokenBuilder extends AbstractMermaidTokenBuilder { 4 | public constructor() { 5 | super(['info', 'showInfo']); 6 | } 7 | } 8 | -------------------------------------------------------------------------------- /packages/mermaid/src/diagrams/info/infoTypes.ts: -------------------------------------------------------------------------------- 1 | import type { DiagramDB } from '../../diagram-api/types.js'; 2 | 3 | export interface InfoFields { 4 | version: string; 5 | } 6 | 7 | export interface InfoDB extends DiagramDB { 8 | getVersion: () => string; 9 | } 10 | -------------------------------------------------------------------------------- /cypress/platform/exploit.js: -------------------------------------------------------------------------------- 1 | const div = parent.document.createElement('div'); 2 | div.id = 'the-malware'; 3 | div.className = 'malware'; 4 | div.innerHTML = 'XSS Succeeded'; 5 | parent.document.getElementsByTagName('body')[0].appendChild(div); 6 | throw new Error('XSS Succeeded'); 7 | -------------------------------------------------------------------------------- /packages/parser/src/language/architecture/tokenBuilder.ts: -------------------------------------------------------------------------------- 1 | import { AbstractMermaidTokenBuilder } from '../common/index.js'; 2 | 3 | export class ArchitectureTokenBuilder extends AbstractMermaidTokenBuilder { 4 | public constructor() { 5 | super(['architecture']); 6 | } 7 | } 8 | -------------------------------------------------------------------------------- /tests/webpack/public/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 |
4 | 5 |]: RecursiveAstOmit
17 |
8 | graph TD
9 | A --> B["<a href='javascript#9;t#colon;alert(document.location)'>AAA</a>"]
10 |
11 |
15 |
16 |
17 |
--------------------------------------------------------------------------------
/.lintstagedrc.mjs:
--------------------------------------------------------------------------------
1 | export default {
2 | '!(docs/**/*)*.{ts,js,html,md,mts}': [
3 | 'eslint --cache --cache-strategy content --fix',
4 | // don't cache prettier yet, since we use `prettier-plugin-jsdoc`,
5 | // and prettier doesn't invalidate cache on plugin updates"
6 | // https://prettier.io/docs/en/cli.html#--cache
7 | 'prettier --write',
8 | ],
9 | '.cspell/*.txt': ['tsx scripts/fixCSpell.ts'],
10 | '**/*.jison': ['pnpm -w run lint:jison'],
11 | };
12 |
--------------------------------------------------------------------------------
/packages/mermaid/src/dagre-wrapper/intersect/index.js:
--------------------------------------------------------------------------------
1 | /*
2 | * Borrowed with love from dagre-d3. Many thanks to cpettitt!
3 | */
4 |
5 | import node from './intersect-node.js';
6 | import circle from './intersect-circle.js';
7 | import ellipse from './intersect-ellipse.js';
8 | import polygon from './intersect-polygon.js';
9 | import rect from './intersect-rect.js';
10 |
11 | export default {
12 | node,
13 | circle,
14 | ellipse,
15 | polygon,
16 | rect,
17 | };
18 |
--------------------------------------------------------------------------------
/packages/mermaid/src/diagrams/common/populateCommonDb.ts:
--------------------------------------------------------------------------------
1 | import type { DiagramAST } from '@mermaid-js/parser';
2 | import type { DiagramDB } from '../../diagram-api/types.js';
3 |
4 | export function populateCommonDb(ast: DiagramAST, db: DiagramDB) {
5 | if (ast.accDescr) {
6 | db.setAccDescription?.(ast.accDescr);
7 | }
8 | if (ast.accTitle) {
9 | db.setAccTitle?.(ast.accTitle);
10 | }
11 | if (ast.title) {
12 | db.setDiagramTitle?.(ast.title);
13 | }
14 | }
15 |
--------------------------------------------------------------------------------
/cypress/integration/rendering/current.spec.js:
--------------------------------------------------------------------------------
1 | import { imgSnapshotTest } from '../../helpers/util.ts';
2 |
3 | describe('Current diagram', () => {
4 | it('should render a state with states in it', () => {
5 | imgSnapshotTest(
6 | `
7 | stateDiagram
8 | state PersonalizedCockpit {
9 | Other
10 | state Parent {
11 | C
12 | }
13 | }
14 | `,
15 | {
16 | logLevel: 0,
17 | }
18 | );
19 | });
20 | });
21 |
--------------------------------------------------------------------------------
/docs/config/setup/defaultConfig/README.md:
--------------------------------------------------------------------------------
1 | > **Warning**
2 | >
3 | > ## THIS IS AN AUTOGENERATED FILE. DO NOT EDIT.
4 | >
5 | > ## Please edit the corresponding file in [/packages/mermaid/src/docs/config/setup/defaultConfig/README.md](../../../../packages/mermaid/src/docs/config/setup/defaultConfig/README.md).
6 |
7 | [**mermaid**](../README.md)
8 |
9 | ---
10 |
11 | # defaultConfig
12 |
13 | ## Variables
14 |
15 | - [configKeys](variables/configKeys.md)
16 | - [default](variables/default.md)
17 |
--------------------------------------------------------------------------------
/docs/public/icons/open-source.svg:
--------------------------------------------------------------------------------
1 |
12 |
--------------------------------------------------------------------------------
/packages/examples/src/examples/pie.ts:
--------------------------------------------------------------------------------
1 | import type { DiagramMetadata } from '../types.js';
2 |
3 | export default {
4 | id: 'pie',
5 | name: 'Pie Chart',
6 | description: 'Visualize data as proportional segments of a circle',
7 | examples: [
8 | {
9 | title: 'Basic Pie Chart',
10 | isDefault: true,
11 | code: `pie title Pets adopted by volunteers
12 | "Dogs" : 386
13 | "Cats" : 85
14 | "Rats" : 15`,
15 | },
16 | ],
17 | } satisfies DiagramMetadata;
18 |
--------------------------------------------------------------------------------
/packages/mermaid-zenuml/src/detector.ts:
--------------------------------------------------------------------------------
1 | import type { ExternalDiagramDefinition } from 'mermaid';
2 |
3 | const id = 'zenuml';
4 |
5 | const detector = (txt: string) => {
6 | return /^\s*zenuml/.test(txt);
7 | };
8 |
9 | const loader = async () => {
10 | const { diagram } = await import('./zenuml-definition.js');
11 | return { id, diagram };
12 | };
13 |
14 | const plugin: ExternalDiagramDefinition = {
15 | id,
16 | detector,
17 | loader,
18 | };
19 |
20 | export default plugin;
21 |
--------------------------------------------------------------------------------
/packages/mermaid/src/diagrams/flowchart/parser/flowParser.ts:
--------------------------------------------------------------------------------
1 | // @ts-ignore: JISON doesn't support types
2 | import flowJisonParser from './flow.jison';
3 |
4 | const newParser = Object.assign({}, flowJisonParser);
5 |
6 | newParser.parse = (src: string): unknown => {
7 | // remove the trailing whitespace after closing curly braces when ending a line break
8 | const newSrc = src.replace(/}\s*\n/g, '}\n');
9 | return flowJisonParser.parse(newSrc);
10 | };
11 |
12 | export default newParser;
13 |
--------------------------------------------------------------------------------
/packages/mermaid/src/rendering-util/rendering-elements/intersect/index.js:
--------------------------------------------------------------------------------
1 | /*
2 | * Borrowed with love from dagre-d3. Many thanks to cpettitt!
3 | */
4 |
5 | import node from './intersect-node.js';
6 | import circle from './intersect-circle.js';
7 | import ellipse from './intersect-ellipse.js';
8 | import polygon from './intersect-polygon.js';
9 | import rect from './intersect-rect.js';
10 |
11 | export default {
12 | node,
13 | circle,
14 | ellipse,
15 | polygon,
16 | rect,
17 | };
18 |
--------------------------------------------------------------------------------
/packages/mermaid/src/rendering-util/rendering-elements/shapes/state.ts:
--------------------------------------------------------------------------------
1 | import type { Node, RectOptions } from '../../types.js';
2 | import type { D3Selection } from '../../../types.js';
3 | import { drawRect } from './drawRect.js';
4 |
5 | export async function state
4 | graph TB
5 | a --> b
6 | a --> c
7 | b --> d
8 | c --> d
9 |
10 |
11 |
12 |
13 |
14 |
28 |
29 |
30 |
--------------------------------------------------------------------------------
/packages/examples/src/examples/architecture.ts:
--------------------------------------------------------------------------------
1 | import type { DiagramMetadata } from '../types.js';
2 |
3 | export default {
4 | id: 'architecture',
5 | name: 'Architecture Diagram',
6 | description: 'Visualize system architecture and components',
7 | examples: [
8 | {
9 | title: 'Basic System Architecture',
10 | isDefault: true,
11 | code: `architecture-beta
12 | group api(cloud)[API]
13 |
14 | service db(database)[Database] in api
15 | service disk1(disk)[Storage] in api
16 | service disk2(disk)[Storage] in api
17 | service server(server)[Server] in api
18 |
19 | db:L -- R:server
20 | disk1:T -- B:server
21 | disk2:T -- B:db`,
22 | },
23 | ],
24 | } satisfies DiagramMetadata;
25 |
--------------------------------------------------------------------------------
/packages/examples/src/examples/xychart.ts:
--------------------------------------------------------------------------------
1 | import type { DiagramMetadata } from '../types.js';
2 |
3 | export default {
4 | id: 'xychart',
5 | name: 'XY Chart',
6 | description: 'Create scatter plots and line charts with customizable axes',
7 | examples: [
8 | {
9 | title: 'Sales Revenue',
10 | isDefault: true,
11 | code: `xychart-beta
12 | title "Sales Revenue"
13 | x-axis [jan, feb, mar, apr, may, jun, jul, aug, sep, oct, nov, dec]
14 | y-axis "Revenue (in $)" 4000 --> 11000
15 | bar [5000, 6000, 7500, 8200, 9500, 10500, 11000, 10200, 9200, 8500, 7000, 6000]
16 | line [5000, 6000, 7500, 8200, 9500, 10500, 11000, 10200, 9200, 8500, 7000, 6000]`,
17 | },
18 | ],
19 | } satisfies DiagramMetadata;
20 |
--------------------------------------------------------------------------------
/packages/mermaid/src/docs/.vitepress/components/Contributors.vue:
--------------------------------------------------------------------------------
1 |
4 |
5 |
6 |
25 |
26 |
4 | flowchart-elk
5 | a[hello] --> b[world]
6 | b --> c{test}
7 | c --> one
8 | c --> two
9 | c --> three
10 |
11 |
12 |
27 |
28 |
29 |
--------------------------------------------------------------------------------
/packages/mermaid/src/dagre-wrapper/intersect/intersect-ellipse.js:
--------------------------------------------------------------------------------
1 | /**
2 | * @param node
3 | * @param rx
4 | * @param ry
5 | * @param point
6 | */
7 | function intersectEllipse(node, rx, ry, point) {
8 | // Formulae from: https://mathworld.wolfram.com/Ellipse-LineIntersection.html
9 |
10 | var cx = node.x;
11 | var cy = node.y;
12 |
13 | var px = cx - point.x;
14 | var py = cy - point.y;
15 |
16 | var det = Math.sqrt(rx * rx * py * py + ry * ry * px * px);
17 |
18 | var dx = Math.abs((rx * ry * px) / det);
19 | if (point.x < cx) {
20 | dx = -dx;
21 | }
22 | var dy = Math.abs((rx * ry * py) / det);
23 | if (point.y < cy) {
24 | dy = -dy;
25 | }
26 |
27 | return { x: cx + dx, y: cy + dy };
28 | }
29 |
30 | export default intersectEllipse;
31 |
--------------------------------------------------------------------------------
/packages/parser/src/language/architecture/valueConverter.ts:
--------------------------------------------------------------------------------
1 | import type { CstNode, GrammarAST, ValueType } from 'langium';
2 |
3 | import { AbstractMermaidValueConverter } from '../common/index.js';
4 |
5 | export class ArchitectureValueConverter extends AbstractMermaidValueConverter {
6 | protected runCustomConverter(
7 | rule: GrammarAST.AbstractRule,
8 | input: string,
9 | _cstNode: CstNode
10 | ): ValueType | undefined {
11 | if (rule.name === 'ARCH_ICON') {
12 | return input.replace(/[()]/g, '').trim();
13 | } else if (rule.name === 'ARCH_TEXT_ICON') {
14 | return input.replace(/["()]/g, '');
15 | } else if (rule.name === 'ARCH_TITLE') {
16 | return input.replace(/[[\]]/g, '').trim();
17 | }
18 | return undefined;
19 | }
20 | }
21 |
--------------------------------------------------------------------------------
/docs/config/setup/config/functions/getUserDefinedConfig.md:
--------------------------------------------------------------------------------
1 | > **Warning**
2 | >
3 | > ## THIS IS AN AUTOGENERATED FILE. DO NOT EDIT.
4 | >
5 | > ## Please edit the corresponding file in [/packages/mermaid/src/docs/config/setup/config/functions/getUserDefinedConfig.md](../../../../../packages/mermaid/src/docs/config/setup/config/functions/getUserDefinedConfig.md).
6 |
7 | [**mermaid**](../../README.md)
8 |
9 | ---
10 |
11 | # Function: getUserDefinedConfig()
12 |
13 | > **getUserDefinedConfig**(): [`MermaidConfig`](../../mermaid/interfaces/MermaidConfig.md)
14 |
15 | Defined in: [packages/mermaid/src/config.ts:252](https://github.com/mermaid-js/mermaid/blob/master/packages/mermaid/src/config.ts#L252)
16 |
17 | ## Returns
18 |
19 | [`MermaidConfig`](../../mermaid/interfaces/MermaidConfig.md)
20 |
--------------------------------------------------------------------------------
/netlify.toml:
--------------------------------------------------------------------------------
1 | # Settings in the [build] context are global and are applied to
2 | # all contexts unless otherwise overridden by more specific contexts.
3 | [build]
4 | # Directory where the build system installs dependencies
5 | # and runs your build. Store your package.json, .nvmrc, etc here.
6 | # If not set, defaults to the root directory.
7 | base = ""
8 |
9 | # Directory that contains the deploy-ready HTML files and
10 | # assets generated by the build. This is an absolute path relative
11 | # to the base directory, which is the root by default (/).
12 | # This sample publishes the directory located at the absolute
13 | # path "root/project/build-output"
14 |
15 | publish = "mermaid-live-editor/docs"
16 |
17 | # Default build command.
18 | command = "./scripts/editor.bash"
19 |
--------------------------------------------------------------------------------
/packages/mermaid-example-diagram/src/exampleDiagramDb.js:
--------------------------------------------------------------------------------
1 | /** Created by knut on 15-01-14. */
2 | import { log } from './mermaidUtils.js';
3 |
4 | var message = '';
5 | var info = false;
6 |
7 | export const setMessage = (txt) => {
8 | log.debug('Setting message to: ' + txt);
9 | message = txt;
10 | };
11 |
12 | export const getMessage = () => {
13 | return message;
14 | };
15 |
16 | /**
17 | * Sets the info flag
18 | *
19 | * @param {boolean} inf
20 | */
21 | export const setInfo = (inf) => {
22 | info = inf;
23 | };
24 |
25 | export const getInfo = () => {
26 | return info;
27 | };
28 |
29 | export const clear = () => {
30 | message = '';
31 | info = false;
32 | };
33 |
34 | export default {
35 | setMessage,
36 | getMessage,
37 | setInfo,
38 | getInfo,
39 | clear,
40 | };
41 |
--------------------------------------------------------------------------------
/packages/mermaid/src/diagrams/state/stateDetector-V2.ts:
--------------------------------------------------------------------------------
1 | import type {
2 | DiagramDetector,
3 | DiagramLoader,
4 | ExternalDiagramDefinition,
5 | } from '../../diagram-api/types.js';
6 |
7 | const id = 'stateDiagram';
8 |
9 | const detector: DiagramDetector = (txt, config) => {
10 | if (/^\s*stateDiagram-v2/.test(txt)) {
11 | return true;
12 | }
13 | if (/^\s*stateDiagram/.test(txt) && config?.state?.defaultRenderer === 'dagre-wrapper') {
14 | return true;
15 | }
16 | return false;
17 | };
18 |
19 | const loader: DiagramLoader = async () => {
20 | const { diagram } = await import('./stateDiagram-v2.js');
21 | return { id, diagram };
22 | };
23 |
24 | const plugin: ExternalDiagramDefinition = {
25 | id,
26 | detector,
27 | loader,
28 | };
29 |
30 | export default plugin;
31 |
--------------------------------------------------------------------------------
/packages/mermaid/src/diagrams/pie/pieParser.ts:
--------------------------------------------------------------------------------
1 | import type { Pie } from '@mermaid-js/parser';
2 | import { parse } from '@mermaid-js/parser';
3 | import { log } from '../../logger.js';
4 | import type { ParserDefinition } from '../../diagram-api/types.js';
5 | import { populateCommonDb } from '../common/populateCommonDb.js';
6 | import type { PieDB } from './pieTypes.js';
7 | import { db } from './pieDb.js';
8 |
9 | const populateDb = (ast: Pie, db: PieDB) => {
10 | populateCommonDb(ast, db);
11 | db.setShowData(ast.showData);
12 | ast.sections.map(db.addSection);
13 | };
14 |
15 | export const parser: ParserDefinition = {
16 | parse: async (input: string): Promise
and features
20 | On Automatic creation
21 | Uses
22 | Creative techniques
23 | Strategic planning
24 | Argument mapping
25 | Tools
26 | Pen and paper
27 | Mermaid`,
28 | },
29 | ],
30 | } satisfies DiagramMetadata;
31 |
32 | // cspell:ignore Buzan
33 |
--------------------------------------------------------------------------------
/packages/mermaid/src/diagrams/class/svgDraw.spec.js:
--------------------------------------------------------------------------------
1 | import svgDraw from './svgDraw.js';
2 | import { JSDOM } from 'jsdom';
3 |
4 | describe('given a string representing a class, ', function () {
5 | describe('when class name includes generic, ', function () {
6 | it('should return correct text for generic', function () {
7 | const classDef = {
8 | id: 'Car',
9 | type: 'T',
10 | label: 'Car',
11 | };
12 |
13 | let actual = svgDraw.getClassTitleString(classDef);
14 | expect(actual).toBe('CarInfo diagram demos
17 |
18 | info
19 |
20 |
21 |
22 |
23 | info showInfo
24 |
25 |
26 |
34 |
35 |
36 |
--------------------------------------------------------------------------------
/packages/mermaid/src/rendering-util/rendering-elements/intersect/intersect-rect.js:
--------------------------------------------------------------------------------
1 | const intersectRect = (node, point) => {
2 | var x = node.x;
3 | var y = node.y;
4 |
5 | // Rectangle intersection algorithm from:
6 | // https://math.stackexchange.com/questions/108113/find-edge-between-two-boxes
7 | var dx = point.x - x;
8 | var dy = point.y - y;
9 | var w = node.width / 2;
10 | var h = node.height / 2;
11 |
12 | var sx, sy;
13 | if (Math.abs(dy) * w > Math.abs(dx) * h) {
14 | // Intersection is top or bottom of rect.
15 | if (dy < 0) {
16 | h = -h;
17 | }
18 | sx = dy === 0 ? 0 : (h * dx) / dy;
19 | sy = h;
20 | } else {
21 | // Intersection is left or right of rect.
22 | if (dx < 0) {
23 | w = -w;
24 | }
25 | sx = w;
26 | sy = dx === 0 ? 0 : (w * dy) / dx;
27 | }
28 |
29 | return { x: x + sx, y: y + sy };
30 | };
31 |
32 | export default intersectRect;
33 |
--------------------------------------------------------------------------------
/.build/types.ts:
--------------------------------------------------------------------------------
1 | /* eslint-disable no-console */
2 | import { packageOptions } from './common.js';
3 | import { execSync } from 'child_process';
4 |
5 | const buildType = (packageName: string) => {
6 | console.log(`Building types for ${packageName}`);
7 | try {
8 | const out = execSync(`tsc -p ./packages/${packageName}/tsconfig.json --emitDeclarationOnly`);
9 | if (out.length > 0) {
10 | console.log(out.toString());
11 | }
12 | } catch (e) {
13 | if (e.stdout.length > 0) {
14 | console.error(e.stdout.toString());
15 | }
16 | if (e.stderr.length > 0) {
17 | console.error(e.stderr.toString());
18 | }
19 | // Exit the build process if we are in CI
20 | if (process.env.CI) {
21 | throw new Error(`Failed to build types for ${packageName}`);
22 | }
23 | }
24 | };
25 |
26 | for (const { packageName } of Object.values(packageOptions)) {
27 | buildType(packageName);
28 | }
29 |
--------------------------------------------------------------------------------
/.github/ISSUE_TEMPLATE/config.yml:
--------------------------------------------------------------------------------
1 | blank_issues_enabled: true
2 | contact_links:
3 | - name: GitHub Discussions
4 | url: https://github.com/mermaid-js/mermaid/discussions
5 | about: Ask the Community questions or share your own graphs in our discussions.
6 | - name: Discord
7 | url: https://discord.gg/sKeNQX4Wtj
8 | about: Join our Community on Discord for Help and a casual chat.
9 | - name: Documentation
10 | url: https://mermaid.js.org
11 | about: Read our documentation for all that Mermaid.js can offer.
12 | - name: Live Editor
13 | url: https://mermaid.live
14 | about: Try the live editor to preview graphs in no time.
15 | - name: Live Editor - Develop
16 | url: https://develop.git.mermaid.live
17 | about: Try unreleased changes in the develop branch.
18 | - name: Live Editor - Next
19 | url: https://next.git.mermaid.live
20 | about: Try unreleased changes in the next branch.
21 |
--------------------------------------------------------------------------------
/packages/mermaid/src/diagrams/flowchart/flowDetector.ts:
--------------------------------------------------------------------------------
1 | import type {
2 | DiagramDetector,
3 | DiagramLoader,
4 | ExternalDiagramDefinition,
5 | } from '../../diagram-api/types.js';
6 |
7 | const id = 'flowchart';
8 |
9 | const detector: DiagramDetector = (txt, config) => {
10 | // If we have conferred to only use new flow charts this function should always return false
11 | // as in not signalling true for a legacy flowchart
12 | if (
13 | config?.flowchart?.defaultRenderer === 'dagre-wrapper' ||
14 | config?.flowchart?.defaultRenderer === 'elk'
15 | ) {
16 | return false;
17 | }
18 | return /^\s*graph/.test(txt);
19 | };
20 |
21 | const loader: DiagramLoader = async () => {
22 | const { diagram } = await import('./flowDiagram.js');
23 | return { id, diagram };
24 | };
25 |
26 | const plugin: ExternalDiagramDefinition = {
27 | id,
28 | detector,
29 | loader,
30 | };
31 |
32 | export default plugin;
33 |
--------------------------------------------------------------------------------
/packages/mermaid/src/docs/syntax/userJourney.md:
--------------------------------------------------------------------------------
1 | # User Journey Diagram
2 |
3 | > User journeys describe at a high level of detail exactly what steps different users take to complete a specific task within a system, application or website. This technique shows the current (as-is) user workflow, and reveals areas of improvement for the to-be workflow. (Wikipedia)
4 |
5 | Mermaid can render user journey diagrams:
6 |
7 | ```mermaid-example
8 | journey
9 | title My working day
10 | section Go to work
11 | Make tea: 5: Me
12 | Go upstairs: 3: Me
13 | Do work: 1: Me, Cat
14 | section Go home
15 | Go downstairs: 5: Me
16 | Sit down: 5: Me
17 | ```
18 |
19 | Each user journey is split into sections, these describe the part of the task
20 | the user is trying to complete.
21 |
22 | Tasks syntax is `Task name: Example
4 |
5 | %%{init:{"theme":"base", "sequence": {"mirrorActors":false},"themeVariables": {"actorBkg":"red"}}}%%
6 | sequenceDiagram
7 | Bert->>+Ernie: Start looking for the cookie!
8 | Ernie-->>-Bert: Found it!
9 | Note left of Ernie: Cookies are good
10 |
11 |
12 | %%{init:{"theme":"base", "themeVariables": {}}}%%
13 | sequenceDiagram
14 | Bert->>+Ernie: Start looking for the cookie!
15 | Ernie-->>-Bert: Found it!
16 | Note left of Ernie: Cookies are good
17 |
18 |
19 |
31 |
32 |
--------------------------------------------------------------------------------
/packages/mermaid/src/diagrams/class/parser/class.spec.js:
--------------------------------------------------------------------------------
1 | import { parser } from './classDiagram.jison';
2 | import { ClassDB } from '../classDb.js';
3 |
4 | describe('class diagram', function () {
5 | let classDb;
6 | beforeEach(function () {
7 | classDb = new ClassDB();
8 | parser.yy = classDb;
9 | parser.yy.clear();
10 | });
11 |
12 | describe('prototype properties', function () {
13 | it.each(['__proto__', 'constructor'])('should work with a %s property', function (prop) {
14 | expect(() => parser.parse(`classDiagram\nclass ${prop}`)).not.toThrow();
15 | expect(() => parser.parse(`classDiagram\nnamespace ${prop} {\n\tclass A\n}`)).not.toThrow();
16 | });
17 | });
18 |
19 | describe('backtick escaping', function () {
20 | it('should handle backtick-quoted namespace names', function () {
21 | expect(() =>
22 | parser.parse(`classDiagram\nnamespace \`A::B\` {\n\tclass \`IPC::Sender\`\n}`)
23 | ).not.toThrow();
24 | });
25 | });
26 | });
27 |
--------------------------------------------------------------------------------
/packages/mermaid/src/__mocks__/mermaidAPI.ts:
--------------------------------------------------------------------------------
1 | /**
2 | * Mocks for `./mermaidAPI`.
3 | *
4 | * We can't easily use `vi.spyOn(mermaidAPI, "function")` since the object is frozen with `Object.freeze()`.
5 | */
6 | import * as configApi from '../config.js';
7 | import { vi } from 'vitest';
8 | import { mermaidAPI as mAPI } from '../mermaidAPI.js';
9 |
10 | // original version cannot be modified since it was frozen with `Object.freeze()`
11 | export const mermaidAPI = {
12 | render: vi.fn().mockResolvedValue({
13 | svg: '',
14 | }),
15 | parse: mAPI.parse,
16 | initialize: vi.fn(),
17 | getConfig: configApi.getConfig,
18 | setConfig: configApi.setConfig,
19 | getSiteConfig: configApi.getSiteConfig,
20 | updateSiteConfig: configApi.updateSiteConfig,
21 | reset: () => {
22 | configApi.reset();
23 | },
24 | globalReset: () => {
25 | configApi.reset(configApi.defaultConfig);
26 | },
27 | defaultConfig: configApi.defaultConfig,
28 | };
29 |
30 | export default mermaidAPI;
31 |
--------------------------------------------------------------------------------
/packages/mermaid/src/diagrams/class/classDetector-V2.ts:
--------------------------------------------------------------------------------
1 | import type {
2 | DiagramDetector,
3 | DiagramLoader,
4 | ExternalDiagramDefinition,
5 | } from '../../diagram-api/types.js';
6 |
7 | const id = 'classDiagram';
8 |
9 | const detector: DiagramDetector = (txt, config) => {
10 | // If we have configured to use dagre-wrapper then we should return true in this function for classDiagram code thus making it use the new class diagram
11 | if (/^\s*classDiagram/.test(txt) && config?.class?.defaultRenderer === 'dagre-wrapper') {
12 | return true;
13 | }
14 | // We have not opted to use the new renderer so we should return true if we detect a class diagram
15 | return /^\s*classDiagram-v2/.test(txt);
16 | };
17 |
18 | const loader: DiagramLoader = async () => {
19 | const { diagram } = await import('./classDiagram-v2.js');
20 | return { id, diagram };
21 | };
22 |
23 | const plugin: ExternalDiagramDefinition = {
24 | id,
25 | detector,
26 | loader,
27 | };
28 |
29 | export default plugin;
30 |
--------------------------------------------------------------------------------
/cypress/platform/ghsa2.html:
--------------------------------------------------------------------------------
1 |
2 |
5 |
6 | This element does not belong to the SVG but we can style it
8 | Meet The Team
12 | Contributors
16 |
19 | Join the community
20 | and get involved!
21 | {
25 | public records: S;
26 |
27 | /**
28 | * @param init - Function that creates the default state.
29 | */
30 | constructor(private init: () => S) {
31 | this.records = this.init();
32 | }
33 |
34 | reset() {
35 | this.records = this.init();
36 | }
37 | }
38 |
--------------------------------------------------------------------------------
/.github/workflows/update-browserlist.yml:
--------------------------------------------------------------------------------
1 | name: Update Browserslist
2 | on:
3 | schedule:
4 | - cron: '0 7 * * 1'
5 | workflow_dispatch:
6 |
7 | jobs:
8 | update-browser-list:
9 | runs-on: ubuntu-latest
10 | steps:
11 | - uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
12 | - uses: pnpm/action-setup@a7487c7e89a18df4991f7f222e4898a00d66ddda # v4.1.0
13 | - run: npx update-browserslist-db@latest
14 | - name: Commit changes
15 | uses: EndBug/add-and-commit@a94899bca583c204427a224a7af87c02f9b325d5 # v9.1.4
16 | with:
17 | author_name: ${{ github.actor }}
18 | author_email: ${{ github.actor }}@users.noreply.github.com
19 | message: 'chore: update browsers list'
20 | push: false
21 | - name: Create Pull Request
22 | uses: peter-evans/create-pull-request@84ae59a2cdc2258d6fa0732dd66352dddae2a412 # v7.0.9
23 | with:
24 | branch: update-browserslist
25 | title: Update Browserslist
26 |
--------------------------------------------------------------------------------
/docs/config/setup/config/functions/updateCurrentConfig.md:
--------------------------------------------------------------------------------
1 | > **Warning**
2 | >
3 | > ## THIS IS AN AUTOGENERATED FILE. DO NOT EDIT.
4 | >
5 | > ## Please edit the corresponding file in [/packages/mermaid/src/docs/config/setup/config/functions/updateCurrentConfig.md](../../../../../packages/mermaid/src/docs/config/setup/config/functions/updateCurrentConfig.md).
6 |
7 | [**mermaid**](../../README.md)
8 |
9 | ---
10 |
11 | # Function: updateCurrentConfig()
12 |
13 | > **updateCurrentConfig**(`siteCfg`, `_directives`): [`MermaidConfig`](../../mermaid/interfaces/MermaidConfig.md)
14 |
15 | Defined in: [packages/mermaid/src/config.ts:15](https://github.com/mermaid-js/mermaid/blob/master/packages/mermaid/src/config.ts#L15)
16 |
17 | ## Parameters
18 |
19 | ### siteCfg
20 |
21 | [`MermaidConfig`](../../mermaid/interfaces/MermaidConfig.md)
22 |
23 | ### \_directives
24 |
25 | [`MermaidConfig`](../../mermaid/interfaces/MermaidConfig.md)\[]
26 |
27 | ## Returns
28 |
29 | [`MermaidConfig`](../../mermaid/interfaces/MermaidConfig.md)
30 |
--------------------------------------------------------------------------------
/packages/mermaid/src/docs/.vitepress/theme/mermaid.ts:
--------------------------------------------------------------------------------
1 | import mermaid, { type MermaidConfig } from 'mermaid';
2 | import zenuml from '../../../../../mermaid-zenuml/dist/mermaid-zenuml.core.mjs';
3 | import tidyTreeLayout from '../../../../../mermaid-layout-tidy-tree/dist/mermaid-layout-tidy-tree.core.mjs';
4 | import layouts from '../../../../../mermaid-layout-elk/dist/mermaid-layout-elk.core.mjs';
5 |
6 | const init = Promise.all([
7 | mermaid.registerExternalDiagrams([zenuml]),
8 | mermaid.registerLayoutLoaders(layouts),
9 | mermaid.registerLayoutLoaders(tidyTreeLayout),
10 | ]);
11 | mermaid.registerIconPacks([
12 | {
13 | name: 'logos',
14 | loader: () =>
15 | fetch('https://unpkg.com/@iconify-json/logos/icons.json').then((res) => res.json()),
16 | },
17 | ]);
18 |
19 | export const render = async (id: string, code: string, config: MermaidConfig): Promise