Como criar diagramas e gráficos com Markdown?
Mermaid te permite criar diagramas e visualizações usando texto e código.
Fluxograma
Formas de nós
simples
flowchart LR nodequadrado
flowchart LR square[square node]redondo
flowchart LR round(round node)pílula
flowchart LR stadium([pill node])de sub-rotina
flowchart LR subroutine[[subroutine node]]cilíndrico
flowchart LR cylindrical[(cylindrical node)]circular
flowchart LR circular((circular node))assimétrico
flowchart LR asymmetric>asymmetric node]losango
flowchart LR rhombus{rhombus node}hexágono
flowchart LR hexagon{{hexagon node}}paralelogramo direito
flowchart LR parallelogram_right[/right parallelogram node/]paralelogramo esquerdo
flowchart LR parallelogram_left[\left parallelogram node\]trapézio para baixo
flowchart LR trapezoid_down[/down trapezoid node\]trapézio para cima
flowchart LR trapezoid_up[\up trapezoid node/]circular duplo
flowchart LR double_circular(((double circular node)))Conexões de nós
Tipos de links
Sólido
flowchart LR A --- BPontilhado
flowchart LR A -.- BEspesso
flowchart LR A === BCom descrição
Sintaxe com pipe
flowchart LR A --->|description| BSintaxe entre setas
flowchart LR A --description-> BPontas de flecha
Padrão
flowchart LR A --> BInício
flowchart LR A --o BFim
flowchart LR A --x BMulti directional
flowchart LR A <--> B C o--o D E x--x FSubgráficos
flowchart TB subgraph one[Label] A --> B end subgraph two C --> D end one --> twoInterações
flowchart LR A-->B B-->C C-->D click A href "http://localhost:3000" click B href "https://www.github.com"Sequência
Sintaxe
Participants
sequenceDiagram participant Alice participant Bob Alice->>Bob: Hi Bob Bob->>Alice: Hi AliceAtores
sequenceDiagram actor Alice actor Bob Alice->>Bob: Hi Bob Bob->>Alice: Hi AliceApelidos
sequenceDiagram participant A as Alice participant J as John A->>J: Hello John, how are you? J->>A: Great!Setas
sequenceDiagram A->B: Solid line without arrow A-->B: Dotted line without arrow A->>B: Solid line with arrowhead A-->>B: Dotted line with arrowhead A-xB: Solid line with a cross at the end A--xB: Dotted line with a cross at the end A-)B: Solid line with an open arrow at the end (async) A--)B: Dotted line with a open arrow at the end (async)Ativações
sequenceDiagram A->>B: B activate B B->>+A: B B->>-A: B A->>B: B deactivate AClasse
Sintaxe
classDiagram class BankAccount BankAccount : string owner BankAccount : number balance BankAccount : deposit(amount) BankAccount : withdrawal(amount)Visibilidade
classDiagram class Visibility Visibility: +string public Visibility: -string private Visibility: #string protected Visibility: ~string internal Visibility: string static$ Visibility: getStatic()$ Visibility: getAbstract()*Relacionamentos
classDiagram classA --|> classB : Inheritance classC --* classD : Composition classE --o classF : Aggregation classG --> classH : Association classI -- classJ : Link(Solid) classK ..> classL : Dependency classM ..|> classN : Realization classO .. classP : Link(Dashed)Cardinalidade / Multiplicidade nas relações
classDiagram Customer "1" --> "*" Ticket Student "1" --> "1..*" Course Galaxy --> "many" Star : ContainsEstado
Sintaxe
stateDiagram-v2direction LR [*] --> stateNode: transition stateNode --> [*]Composição
stateDiagram-v2direction LR [*] --> mainState: transition state mainState { direction LR [*] --> subState state subState { direction LR [*] --> subSubState subSubState --> [*] } subState --> [*] } mainState --> [*]Choice
stateDiagram-v2 state choice <<choice>> [*] --> condition condition --> choice choice --> false choice --> trueForks
stateDiagram-v2 state fork <<fork>> state join <<join>> [*] --> fork fork --> A fork --> B A --> join B --> join join --> [*]Anotações
stateDiagram-v2 State1: The state with a note note right of State1 Important information! You can write notes. end note State1 --> State2 note left of State2 : This is the note to the left.Concorrência
stateDiagram-v2direction LR[*] --> concurrencystate concurrency { direction TB [*] --> stateNode1: transition stateNode1 --> [*] -- direction TB [*] --> stateNode2: transition stateNode2 --> [*]}concurrency --> [*]Relacionamento de entidade
Sintaxe
erDiagram CAR ||--o{ NAMED-DRIVER : allows PERSON ||--o{ NAMED-DRIVER : isRelacionamentos
Um para um
erDiagram one ||--|| to-one : relationshipZero ou um
erDiagram zero-one |o--o| to-zero-one : relationshipZero ou mais
erDiagram zero-more }o--o{ to-zero-more : relationshipUm ou mais
erDiagram one-more }|--|{ to-one-more : relationshipAtributos
erDiagram CAR ||--o{ NAMED-DRIVER : allows CAR { string registrationNumber string make string model } PERSON ||--o{ NAMED-DRIVER : is PERSON { string firstName string lastName int age }Jornada do usuário
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: 5: MeGantt
Sintaxe
gantt default :a, 2022-10-08, 1w critical :crit, b, 2022-10-08, 1d active :active, c, after b a, 1d critical active :crit, active, ca, after c, 1d milestone : milestone, m1, 17:49, 2min milestone : milestone, m2, 18:14, 1dGráfico de pizza
pie showData title Key elements in Product X "Calcium" : 42.96 "Potassium" : 50.05 "Magnesium" : 10.01 "Iron" : 5Requisitos
Sintaxe
requirementDiagram requirement test_req { id: 1 text: the test text. risk: high verifymethod: test } element test_entity { type: simulation } test_entity - satisfies -> test_reqRequisito
requirementDiagram requirement test_req { id: 1 text: the test text. risk: high verifymethod: test }Types:
- requirement
- functionalRequirement
- interfaceRequirement
- performanceRequirement
- physicalRequirement
- designConstraint
Risk:
- Low
- Medium
- High
Verification Method:
- Analysis
- Inspection
- Test
- Demonstration
Gráfico do Git
%%{ init: { 'logLevel': 'debug', 'theme': 'dark' } }%%gitGraph commit id: "initial commit"
branch hom branch feat/button
checkout feat/button commit id: "create button" commit id: "finish button"
checkout hom merge feat/button
checkout feat/button commit id: "fix hover"
checkout hom merge feat/button
checkout feat/button commit id: "fix accessibility"
checkout hom merge feat/button
checkout main merge hom