-->
flowchart LR
A[Hard] -->|Text| B(Round)
B --> C{Decision}
C -->|One| D[Result 1]
C -->|Two| E[Result 2]
mermaid
flowchart LR
A[Hard] -->|Text| B(Round)
B --> C{Decision}
C -->|One| D[Result 1]
C -->|Two| E[Result 2]
sequenceDiagram
Alice->>John: Hello John, how are you?
loop HealthCheck
John->>John: Fight against hypochondria
end
Note right of John: Rational thoughts!
John-->>Alice: Great!
John->>Bob: How about you?
Bob-->>John: Jolly good!
mermaid
sequenceDiagram
Alice->>John: Hello John, how are you?
loop HealthCheck
John->>John: Fight against hypochondria
end
Note right of John: Rational thoughts!
John-->>Alice: Great!
John->>Bob: How about you?
Bob-->>John: Jolly good!
gantt
section Section
Completed :done, des1, 2014-01-06,2014-01-08
Active :active, des2, 2014-01-07, 3d
Parallel 1 : des3, after des1, 1d
Parallel 2 : des4, after des1, 1d
Parallel 3 : des5, after des3, 1d
Parallel 4 : des6, after des4, 1d
mermaid
gantt
section Section
Completed :done, des1, 2014-01-06,2014-01-08
Active :active, des2, 2014-01-07, 3d
Parallel 1 : des3, after des1, 1d
Parallel 2 : des4, after des1, 1d
Parallel 3 : des5, after des3, 1d
Parallel 4 : des6, after des4, 1d
classDiagram
Class01 <|-- AveryLongClass : Cool
<<Interface>> Class01
Class09 --> C2 : Where am I?
Class09 --* C3
Class09 --|> Class07
Class07 : equals()
Class07 : Object[] elementData
Class01 : size()
Class01 : int chimp
Class01 : int gorilla
class Class10 {
<<service>>
int id
size()
}
mermaid
classDiagram
Class01 <|-- AveryLongClass : Cool
<<Interface>> Class01
Class09 --> C2 : Where am I?
Class09 --* C3
Class09 --|> Class07
Class07 : equals()
Class07 : Object[] elementData
Class01 : size()
Class01 : int chimp
Class01 : int gorilla
class Class10 {
<<service>>
int id
size()
}
stateDiagram-v2
[*] --> Still
Still --> [*]
Still --> Moving
Moving --> Still
Moving --> Crash
Crash --> [*]
mermaid
stateDiagram-v2
[*] --> Still
Still --> [*]
Still --> Moving
Moving --> Still
Moving --> Crash
Crash --> [*]
pie
"Dogs" : 386
"Cats" : 85
"Rats" : 15
mermaid
pie
"Dogs" : 386
"Cats" : 85
"Rats" : 15
Git 图 [实验特性 - 在线编辑器]
journey
title My working day
section Go to work
Make tea: 5: Me
Go upstairs: 3: Me
Do work: 1: Me, Cat
section Go home
Go downstairs: 5: Me
Sit down: 3: Me
mermaid
journey
title My working day
section Go to work
Make tea: 5: Me
Go upstairs: 3: Me
Do work: 1: Me, Cat
section Go home
Go downstairs: 5: Me
Sit down: 3: Me
C4 图 [文档]
```
C4Context
title System Context diagram for Internet Banking System
Person(customerA, "Banking Customer A", "A customer of the bank, with personal bank accounts.")
Person(customerB, "Banking Customer B")
Person_Ext(customerC, "Banking Customer C")
System(SystemAA, "Internet Banking System", "Allows customers to view information about their bank accounts, and make payments.")
Person(customerD, "Banking Customer D", "A customer of the bank,
with personal bank accounts.")
Enterprise_Boundary(b1, "BankBoundary") {
SystemDb_Ext(SystemE, "Mainframe Banking System", "Stores all of the core banking information about customers, accounts, transactions, etc.")
System_Boundary(b2, "BankBoundary2") {
System(SystemA, "Banking System A")
System(SystemB, "Banking System B", "A system of the bank, with personal bank accounts.")
}
System_Ext(SystemC, "E-mail system", "The internal Microsoft Exchange e-mail system.")
SystemDb(SystemD, "Banking System D Database", "A system of the bank, with personal bank accounts.")
Boundary(b3, "BankBoundary3", "boundary") {
SystemQueue(SystemF, "Banking System F Queue", "A system of the bank, with personal bank accounts.")
SystemQueue_Ext(SystemG, "Banking System G Queue", "A system of the bank, with personal bank accounts.")
}
}
BiRel(customerA, SystemAA, "Uses")
BiRel(SystemAA, SystemE, "Uses")
Rel(SystemAA, SystemC, "Sends e-mails", "SMTP")
Rel(SystemC, customerA, "Sends e-mails to")
```
```mermaid
C4Context
title System Context diagram for Internet Banking System
Person(customerA, "Banking Customer A", "A customer of the bank, with personal bank accounts.")
Person(customerB, "Banking Customer B")
Person_Ext(customerC, "Banking Customer C")
System(SystemAA, "Internet Banking System", "Allows customers to view information about their bank accounts, and make payments.")
Person(customerD, "Banking Customer D", "A customer of the bank,
with personal bank accounts.")
Enterprise_Boundary(b1, "BankBoundary") {
SystemDb_Ext(SystemE, "Mainframe Banking System", "Stores all of the core banking information about customers, accounts, transactions, etc.")
System_Boundary(b2, "BankBoundary2") {
System(SystemA, "Banking System A")
System(SystemB, "Banking System B", "A system of the bank, with personal bank accounts.")
}
System_Ext(SystemC, "E-mail system", "The internal Microsoft Exchange e-mail system.")
SystemDb(SystemD, "Banking System D Database", "A system of the bank, with personal bank accounts.")
Boundary(b3, "BankBoundary3", "boundary") {
SystemQueue(SystemF, "Banking System F Queue", "A system of the bank, with personal bank accounts.")
SystemQueue_Ext(SystemG, "Banking System G Queue", "A system of the bank, with personal bank accounts.")
}
}
BiRel(customerA, SystemAA, "Uses")
BiRel(SystemAA, SystemE, "Uses")
Rel(SystemAA, SystemC, "Sends e-mails", "SMTP")
Rel(SystemC, customerA, "Sends e-mails to")
```
发布
对于有权限的同学来说,你可以通过以下步骤来完成发布操作:
更新 package.json 中的版本号,然后执行如下命令:
sh
npm publish
以上的命令会将文件打包到 dist 目录并发布至 https://www.npmjs.com.
相关项目
贡献者

Mermaid 是一个不断发展中的社区,并且还在接收新的贡献者。有很多不同的方式可以参与进来,而且我们还在寻找额外的帮助。如果你想知道如何开始贡献,请查看 这个 issue。
关于如何贡献的详细信息可以在 贡献指南 中找到。
安全
对于公开网站来说,从互联网上的用户处检索文本、存储供后续在浏览器中展示的内容可能是不安全的,理由是用户的内容可能嵌入一些数据加载完成之后就会运行的恶意脚本,这些对于 Mermaid 来说毫无疑问是一个风险,尤其是 mermaid 图表还包含了许多在 html 中使用的字符,这意味着我们难以使用常规的手段来过滤不安全代码,因为这些常规手段会造成图表损坏。我们仍然在努力对获取到的代码进行安全过滤并不断完善我们的程序,但很难保证没有漏洞。
作为拥有外部用户的网站的额外安全级别,我们很高兴推出一个新的安全级别,其中的图表在沙盒 iframe 中渲染,防止代码中的 javascript 被执行,这是在安全性方面迈出的一大步。
很不幸的是,鱼与熊掌不可兼得,在这个场景下它意味着在可能的恶意代码被阻止时,也会损失部分交互能力。
报告漏洞
如果想要报告漏洞,请发送邮件到 security@mermaid.live, 并附上问题的描述、复现问题的步骤、受影响的版本,以及解决问题的方案(如果有的话)。
鸣谢
来自 Knut Sveidqvist:
特别感谢 d3 和 dagre-d3 这两个优秀的项目,它们提供了图形布局和绘图工具库! > 同样感谢 js-sequence-diagram 提供了时序图语法的使用。 感谢 Jessica Peter 提供了甘特图渲染的灵感。 > 感谢 Tyler Long 从 2017 年四月开始成为了项目的合作者。
感谢越来越多的 贡献者们,没有你们,就没有这个项目的今天!
Mermaid 是由 Knut Sveidqvist 创建,它为了更简单的文档编写而生。
-
Login: amin2312
-
Kind: user
cff-version: 1.2.0
title: 'Mermaid: Generate diagrams from markdown-like text'
message: >-
If you use this software, please cite it using the metadata from this file.
type: software
authors:
- family-names: Sveidqvist
given-names: Knut
- name: 'Contributors to Mermaid'
repository-code: 'https://github.com/mermaid-js/mermaid'
date-released: 2014-12-02
url: 'https://mermaid.js.org/'
abstract: >-
JavaScript based diagramming and charting tool that renders Markdown-inspired
text definitions to create and modify diagrams dynamically.
license: MIT
GitHub Events
Total
-
Push event: 4
-
Fork event: 1
-
Create event: 2
Last Year
-
Push event: 4
-
Fork event: 1
-
Create event: 2
Last synced: over 1 year ago
Dependencies
-
node
22.12.0-alpine3.19@sha256
build
-
@applitools/eyes-cypress
^3.44.9
development
-
@argos-ci/cypress
^3.2.0
development
-
@changesets/changelog-github
^0.5.1
development
-
@changesets/cli
^2.27.12
development
-
@cspell/eslint-plugin
^8.8.4
development
-
@cypress/code-coverage
^3.12.49
development
-
@eslint/js
^9.4.0
development
-
@rollup/plugin-typescript
^12.1.2
development
-
@types/cors
^2.8.17
development
-
@types/express
^5.0.0
development
-
@types/js-yaml
^4.0.9
development
-
@types/jsdom
^21.1.7
development
-
@types/lodash
^4.17.15
development
-
@types/mdast
^4.0.4
development
-
@types/node
^22.13.5
development
-
@types/rollup-plugin-visualizer
^5.0.3
development
-
@vitest/coverage-v8
^3.0.6
development
-
@vitest/spy
^3.0.6
development
-
@vitest/ui
^3.0.6
development
-
ajv
^8.17.1
development
-
chokidar
^4.0.3
development
-
concurrently
^9.1.2
development
-
cors
^2.8.5
development
-
cpy-cli
^5.0.0
development
-
cross-env
^7.0.3
development
-
cspell
^8.6.1
development
-
cypress
^14.0.3
development
-
cypress-image-snapshot
^4.0.1
development
-
cypress-split
^1.24.14
development
-
esbuild
^0.25.0
development
-
eslint
^9.20.1
development
-
eslint-config-prettier
^10.0.0
development
-
eslint-plugin-cypress
^4.1.0
development
-
eslint-plugin-html
^8.1.2
development
-
eslint-plugin-jest
^28.6.0
development
-
eslint-plugin-jsdoc
^50.0.1
development
-
eslint-plugin-json
^4.0.1
development
-
eslint-plugin-lodash
^8.0.0
development
-
eslint-plugin-markdown
^5.1.0
development
-
eslint-plugin-no-only-tests
^3.3.0
development
-
eslint-plugin-tsdoc
^0.4.0
development
-
eslint-plugin-unicorn
^57.0.0
development
-
express
^4.19.2
development
-
globals
^16.0.0
development
-
globby
^14.0.2
development
-
husky
^9.1.7
development
-
jest
^29.7.0
development
-
jison
^0.4.18
development
-
js-yaml
^4.1.0
development
-
jsdom
^26.0.0
development
-
langium-cli
3.3.0
development
-
lint-staged
^15.2.11
development
-
markdown-table
^3.0.4
development
-
nyc
^17.1.0
development
-
path-browserify
^1.0.1
development
-
prettier
^3.5.2
development
-
prettier-plugin-jsdoc
^1.3.2
development
-
rimraf
^6.0.1
development
-
rollup-plugin-visualizer
^5.14.0
development
-
start-server-and-test
^2.0.10
development
-
tslib
^2.8.1
development
-
tsx
^4.7.3
development
-
typescript
~5.7.3
development
-
typescript-eslint
^8.24.1
development
-
vite
^6.1.1
development
-
vite-plugin-istanbul
^7.0.0
development
-
vitest
^3.0.6
development
-
@adobe/jsonschema2md
^8.0.2
development
-
@iconify/types
^2.0.0
development
-
@types/cytoscape
^3.21.9
development
-
@types/cytoscape-fcose
^2.2.4
development
-
@types/d3-sankey
^0.12.4
development
-
@types/d3-scale
^4.0.9
development
-
@types/d3-scale-chromatic
^3.1.0
development
-
@types/d3-selection
^3.0.11
development
-
@types/d3-shape
^3.1.7
development
-
@types/jsdom
^21.1.7
development
-
@types/katex
^0.16.7
development
-
@types/lodash-es
^4.17.12
development
-
@types/micromatch
^4.0.9
development
-
@types/stylis
^4.2.7
development
-
@types/uuid
^10.0.0
development
-
ajv
^8.17.1
development
-
chokidar
^4.0.3
development
-
concurrently
^9.1.2
development
-
csstree-validator
^4.0.1
development
-
globby
^14.0.2
development
-
jison
^0.4.18
development
-
js-base64
^3.7.7
development
-
jsdom
^26.0.0
development
-
json-schema-to-typescript
^15.0.4
development
-
micromatch
^4.0.8
development
-
path-browserify
^1.0.1
development
-
prettier
^3.5.2
development
-
remark
^15.0.1
development
-
remark-frontmatter
^5.0.0
development
-
remark-gfm
^4.0.1
development
-
rimraf
^6.0.1
development
-
start-server-and-test
^2.0.10
development
-
type-fest
^4.35.0
development
-
typedoc
^0.27.8
development
-
typedoc-plugin-markdown
^4.4.2
development
-
typescript
~5.7.3
development
-
unist-util-flatmap
^1.0.0
development
-
unist-util-visit
^5.0.0
development
-
vitepress
^1.0.2
development
-
vitepress-plugin-search
1.0.4-alpha.22
development
-
@braintree/sanitize-url
^7.0.4
-
@iconify/utils
^2.1.33
-
@mermaid-js/parser
workspace:^
-
@types/d3
^7.4.3
-
cytoscape
^3.29.3
-
cytoscape-cose-bilkent
^4.1.0
-
cytoscape-fcose
^2.2.0
-
d3
^7.9.0
-
d3-sankey
^0.12.3
-
dagre-d3-es
7.0.11
-
dayjs
^1.11.13
-
dompurify
^3.2.4
-
katex
^0.16.9
-
khroma
^2.1.0
-
lodash-es
^4.17.21
-
marked
^15.0.7
-
roughjs
^4.6.6
-
stylis
^4.3.6
-
ts-dedent
^2.2.0
-
uuid
^11.1.0
-
@iconify-json/carbon
^1.1.37
development
-
@unocss/reset
^66.0.0
development
-
@vite-pwa/vitepress
^0.5.3
development
-
@vitejs/plugin-vue
^5.0.5
development
-
fast-glob
^3.3.3
development
-
https-localhost
^4.7.1
development
-
pathe
^2.0.3
development
-
unocss
^66.0.0
development
-
unplugin-vue-components
^28.4.0
development
-
vite
^6.1.1
development
-
vite-plugin-pwa
^0.21.1
development
-
vitepress
1.6.3
development
-
workbox-window
^7.3.0
development
-
@mdi/font
^7.4.47
-
@vueuse/core
^12.7.0
-
font-awesome
^4.7.0
-
jiti
^2.4.2
-
mermaid
workspace:^
-
vue
^3.4.38
-
concurrently
^9.1.2
development
-
mermaid
workspace:*
development
-
rimraf
^6.0.1
development
-
@braintree/sanitize-url
^7.0.4
-
d3
^7.9.0
-
khroma
^2.1.0
-
@types/d3
^7.4.3
development
-
mermaid
workspace:^
development
-
d3
^7.9.0
-
elkjs
^0.9.3
-
mermaid
workspace:^
development
-
@zenuml/core
^3.23.28
-
chevrotain
^11.0.3
development
-
langium
3.3.1
-
webpack
^5.91.0
development
-
webpack-cli
^4.10.0
development
-
webpack-dev-server
^4.15.2
development
-
@mermaid-js/mermaid-example-diagram
workspace:*
-
mermaid
workspace:*