Mermaid
Generation of diagrams like flowcharts or sequence diagrams from text in a ...
README
mermaid
Whoa, what's going on here?
We use pnpm now
The source code has moved


About
Doc-Rot is a Catch-22 that Mermaid helps to solve.
Mermaid addresses this problem by enabling users to create easily modifiable diagrams. It can also be made part of production scripts (and other pieces of code).
Examples
- ```
- 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.9
- "Rats" : 15
- ```
- ```mermaid
- pie
- "Dogs" : 386
- "Cats" : 85.9
- "Rats" : 15
- ```
- ```
- 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
- ```
- ```
- 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, <br/> 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, <br/> 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")
- ```
Release
- ```sh
- npm publish
- ```
Related projects
Security and safe diagrams
Reporting vulnerabilities
Appreciation
_Many thanks to the d3 and dagre-d3 projects for providing the graphical layout and drawing libraries!_ >_Thanks also to the js-sequence-diagram project for usage of the grammar for the sequence diagrams. Thanks to Jessica Peter for inspiration and starting point for gantt rendering._ >_Thank you to Tyler Long who has been a collaborator since April 2017._
_Thank you to the ever-growing list of contributors that brought the project this far!_