Mermaid Flowchart - swkim0128/PARA GitHub Wiki


type: Mermaid archive: false

Flowcharts - Basic Syntax

A node (default)

A node with text

Graph

Flowchart Orientation

Node shapes

A node with round edges

A stadium-shaped node

A node in a subroutine shape

A node in a cylindrical shape

A node in the form of a circle

A node in an asymmetric shape

A node (rhombus)

A hexagon node

Parallelogram

Parallelogram alt

Trapezoid

Trapezoid alt

Double circle

Links between nodes

A link with arrow head

An open link

Text on links

A link with arrow head and text

Dotted link

Dotted link with text

Thick link

Thick link with text

An invisible link

Chaining of links

New arrow types

Multi directional arrows

Minimum length of a link

Special characters that break syntax

Entity codes to escape characters

Subgraphs

flowcharts

Direction in subgraphs

Interaction

Comments

Styling and classes

Styling links

Styling line curves

Styling a node

Css classes

Default class

Basic support for fontawesome

Graph declarations with spaces between vertices and link and without semicolon

Configuration

Renderer

Width

Flowcharts - Basic Syntax

λͺ¨λ“  ν”Œλ‘œμš°μ°¨νŠΈλŠ” κΈ°ν•˜ν•™μ  λͺ¨μ–‘인 λ…Έλ“œμ™€ ν™”μ‚΄ν‘œ λ˜λŠ” 선인 μ—£μ§€λ‘œ κ΅¬μ„±λ©λ‹ˆλ‹€. Mermaid μ½”λ“œλŠ” μ΄λŸ¬ν•œ λ…Έλ“œμ™€ μ—£μ§€κ°€ λ§Œλ“€μ–΄μ§€κ³  μƒν˜Έ μž‘μš©ν•˜λŠ” 방식을 μ •μ˜ν•©λ‹ˆλ‹€.

λ˜ν•œ λ‹€μ–‘ν•œ ν™”μ‚΄ν‘œ μœ ν˜•, 닀쀑 λ°©ν–₯ ν™”μ‚΄ν‘œ 및 μ„œλΈŒκ·Έλž˜ν”„μ—μ„œμ˜ 링크 연결도 κ°€λŠ₯ν•©λ‹ˆλ‹€.

μ€‘μš” 사항: Flowchart λ…Έλ“œλ‘œ "end"λΌλŠ” 단어λ₯Ό μž…λ ₯ν•˜μ§€ λ§ˆμ‹­μ‹œμ˜€. ν”Œλ‘œμš°μ°¨νŠΈκ°€ 망가지지 μ•Šλ„λ‘ λͺ¨λ“  문자λ₯Ό λŒ€λ¬Έμžλ‘œ μž…λ ₯ν•˜μ‹­μ‹œμ˜€. 예λ₯Ό λ“€μ–΄ "End" λ˜λŠ” "END"μž…λ‹ˆλ‹€. λ˜λŠ” 이 ν•΄κ²° 방법을 μ μš©ν•  수 μžˆμŠ΅λ‹ˆλ‹€.

A node (default)

Code:

---
title: Node
---
flowchart LR
    id

A node with text

μƒμž μ•ˆμ— ν‘œμ‹œλ˜λŠ” ν…μŠ€νŠΈμ™€ idκ°€ λ‹€λ₯Ό μˆ˜λ„ μžˆμŠ΅λ‹ˆλ‹€. 이 경우, μ—¬λŸ¬ 번 μ„€μ •ν•˜λ©΄ λ§ˆμ§€λ§‰ μ„ μ–Έλœ ν…μŠ€νŠΈκ°€ μ‚¬μš©λ©λ‹ˆλ‹€. λ˜ν•œ, λ‚˜μ€‘μ— λ…Έλ“œμ˜ μ—£μ§€λ₯Ό μ •μ˜ν•  λ•Œ ν…μŠ€νŠΈλ₯Ό μ •μ˜ν•˜μ§€ μ•Šμ•„λ„ λ©λ‹ˆλ‹€. λ Œλ”λ§ν•  λ•Œ 이전에 μ •μ˜λœ ν…μŠ€νŠΈκ°€ μ‚¬μš©λ©λ‹ˆλ‹€.

Code:

---
title: Node with text
---
flowchart LR
    id1[This is the text in the box]

Graph

이 λ¬Έμž₯은 Flowchart의 λ°©ν–₯을 μ„ μ–Έν•©λ‹ˆλ‹€.

μ΄λŠ” flowchartκ°€ μœ„μ—μ„œ μ•„λž˜λ‘œ (TD λ˜λŠ” TB) λ°©ν–₯으둜 μ •λ ¬λ˜μ–΄ μžˆλ‹€λŠ” 것을 μ„ μ–Έν•©λ‹ˆλ‹€.

Code:

flowchart TD
    Start --> Stop

이것은 ν”Œλ‘œμš°μ°¨νŠΈκ°€ μ™Όμͺ½μ—μ„œ 였λ₯Έμͺ½(LR)으둜 μ •λ ¬λ˜μ–΄ μžˆλ‹€λŠ” 것을 μ„ μ–Έν•©λ‹ˆλ‹€.

Code:

flowchart LR
    Start --> Stop

Flowchart Orientation

Possible FlowChart orientations are:

  • TB - top to bottom
  • TD - top-down/ same as top to bottom
  • BT - bottom to top
  • RL - right to left
  • LR - left to right

Node shapes

A node with round edges

Code:

flowchart LR
    id1(This is the text in the box)

A stadium-shaped node

Code:

flowchart LR
    id1([This is the text in the box])

A node in a subroutine shape

Code:

flowchart LR
    id1[[This is the text in the box]]

A node in a cylindrical shape

Code:

flowchart LR
    id1[(Database)]

A node in the form of a circle

Code:

flowchart LR
    id1((This is the text in the circle))

A node in an asymmetric shape

Code:

flowchart LR
    id1>This is the text in the box]

Currently only the shape above is possible and not its mirror. This might change with future releases.

A node (rhombus)

Code:

flowchart LR
id1{This is the text in the box}

A hexagon node

Code:

flowchart LR
    id1{{This is the text in the box}}

Render:

Code:

flowchart LR
    id1{{This is the text in the box}}

Parallelogram

Code:

flowchart TD
    id1[/This is the text in the box/]

Parallelogram alt

Code:

flowchart TD
    id1[\This is the text in the box\]

Trapezoid

Code:

flowchart TD
    A[/Christmas\]

Trapezoid alt

Code:

flowchart TD
    B[\Go shopping/]

Double circle

Code:

flowchart TD
    id1(((This is the text in the circle)))

Links between nodes

λ…Έλ“œλŠ” 링크/μ—£μ§€λ‘œ 연결될 수 μžˆμŠ΅λ‹ˆλ‹€. λ‹€λ₯Έ μœ ν˜•μ˜ 링크λ₯Ό κ°€μ§ˆ 수 μžˆκ±°λ‚˜ 링크에 ν…μŠ€νŠΈ λ¬Έμžμ—΄μ„ 첨뢀할 μˆ˜λ„ μžˆμŠ΅λ‹ˆλ‹€.

A link with arrow head

Code:

flowchart LR
    A-->B

An open link

Code:

flowchart LR
    A --- B

Text on links

Code:

flowchart LR
    A-- This is the text! ---B

or

Code:

flowchart LR
    A---|This is the text|B

A link with arrow head and text

Code:

flowchart LR
    A-->|text|B

or

Code:

flowchart LR
    A-- text -->B

Dotted link

Code:

flowchart LR
   A-.->B;

Dotted link with text

Code:

flowchart LR
   A-. text .-> B

Thick link

Code:

flowchart LR
   A ==> B

Thick link with text

Code:

flowchart LR
   A == text ==> B

An invisible link

μ΄λŠ” λ…Έλ“œμ˜ κΈ°λ³Έ μœ„μΉ˜λ₯Ό λ³€κ²½ν•˜λ €λŠ” κ²½μš°μ— μœ μš©ν•œ 도ꡬ일 수 μžˆμŠ΅λ‹ˆλ‹€.

Code:

flowchart LR
    A ~~~ B

Chaining of links

μ•„λž˜μ™€ 같이 ν•œ 쀄에 μ—¬λŸ¬ 링크λ₯Ό μ„ μ–Έν•  수 μžˆμŠ΅λ‹ˆλ‹€:

Code:

flowchart LR
   A -- text --> B -- text2 --> C

μ•„λž˜μ™€ 같이 같은 쀄에 μ—¬λŸ¬ λ…Έλ“œ 링크λ₯Ό μ„ μ–Έν•˜λŠ” 것도 κ°€λŠ₯ν•©λ‹ˆλ‹€:

Code:

flowchart LR
   a --> b & c--> d

그런 λ‹€μŒ μ•„λž˜μ˜ ν•œ μ€„μ²˜λŸΌ 맀우 ν‘œν˜„λ ₯있게 쒅속성을 μ„€λͺ…ν•  수 μžˆμŠ΅λ‹ˆλ‹€:

Code:

flowchart TB
    A & B--> C & D

λ§Œμ•½ κΈ°λ³Έ ꡬ문을 μ‚¬μš©ν•˜μ—¬ λ™μΌν•œ λ‹€μ΄μ–΄κ·Έλž¨μ„ μ„€λͺ…ν•˜λ©΄ 4 쀄이 μ†Œμš”λ©λ‹ˆλ‹€. μ£Όμ˜ν•  점은 λ§ˆν¬λ‹€μš΄ ν˜•μ‹μ—μ„œ 흐름도λ₯Ό 더 μ–΄λ ΅κ²Œ λ§Œλ“€ 수 μžˆμŠ΅λ‹ˆλ‹€. μŠ€μ›¨λ΄μ–΄ 단어 'lagom'이 λ– μ˜€λ¦…λ‹ˆλ‹€. μ΄λŠ” λ„ˆλ¬΄ λ§Žμ§€λ„ μ•Šκ³  λ„ˆλ¬΄ 적지도 μ•ŠμŒμ„ μ˜λ―Έν•©λ‹ˆλ‹€. 이것은 ν‘œν˜„μ μΈ ꡬ문에도 μ μš©λ©λ‹ˆλ‹€.

Code:

flowchart TB
    A --> C
    A --> D
    B --> C
    B --> D

New arrow types

μ•„λž˜μ™€ 같이 μƒˆλ‘œμš΄ μ’…λ₯˜μ˜ ν™”μ‚΄ν‘œκ°€ μ§€μ›λ©λ‹ˆλ‹€:

Code:

flowchart LR
    A --o B
    B --x C

Multi directional arrows

λ‹€λ°©ν–₯ ν™”μ‚΄ν‘œλ₯Ό μ‚¬μš©ν•  수 μžˆμŠ΅λ‹ˆλ‹€.

Code:

flowchart LR
    A o--o B
    B <--> C
    C x--x D

Minimum length of a link

νλ¦„λ„μ˜ 각 λ…Έλ“œλŠ” μ—°κ²°λœ λ…Έλ“œμ— κΈ°λ°˜ν•˜μ—¬ λ Œλ”λ§λœ κ·Έλž˜ν”„μ—μ„œ μ΅œμ’…μ μœΌλ‘œ 수직 λ˜λŠ” μˆ˜ν‰ λ ˆλ²¨μ— ν• λ‹Ήλ©λ‹ˆλ‹€(흐름도 λ°©ν–₯에 따라 λ‹€λ¦…λ‹ˆλ‹€). 기본적으둜 λ§ν¬λŠ” μ–΄λ–€ 수의 랭크λ₯Ό 거쳐도 μƒκ΄€μ—†μ§€λ§Œ, 링크 μ •μ˜μ— μΆ”κ°€ λŒ€μ‹œλ₯Ό μΆ”κ°€ν•˜μ—¬ λ‹€λ₯Έ 링크보닀 길게 μš”μ²­ν•  수 μžˆμŠ΅λ‹ˆλ‹€.

λ‹€μŒ μ˜ˆμ œμ—μ„œ λ…Έλ“œ _B_μ—μ„œ λ…Έλ“œ _E_둜의 링크에 μΆ”κ°€λ‘œ 두 개의 λŒ€μ‹œκ°€ μΆ”κ°€λ˜μ–΄ 일반적인 링크보닀 두 개의 랭크λ₯Ό 더 κ°–κ²Œ λ©λ‹ˆλ‹€:

Code:

flowchart TD
    A[Start] --> B{Is it?}
    B -->|Yes| C[OK]
    C --> D[Rethink]
    D --> B
    B ---->|No| E[End]

μ°Έκ³ : λ Œλ”λ§ 엔진은 λ‹€λ₯Έ μš”μ²­μ„ μˆ˜μš©ν•˜κΈ° μœ„ν•΄ μš”μ²­ν•œ μˆœμœ„ μˆ˜λ³΄λ‹€ 링크λ₯Ό 더 길게 λ§Œλ“€ 수 μžˆμŠ΅λ‹ˆλ‹€.

링크 라벨이 링크 쀑간에 μž‘μ„±λ  λ•Œ, μΆ”κ°€ λŒ€μ‹œλŠ” 링크 였λ₯Έμͺ½μ— μΆ”κ°€λ˜μ–΄μ•Ό ν•©λ‹ˆλ‹€. λ‹€μŒ μ˜ˆμ‹œλŠ” 이전 μ˜ˆμ‹œμ™€ λ™μΌν•©λ‹ˆλ‹€:

Code:

flowchart TD
    A[Start] --> B{Is it?}
    B -- Yes --> C[OK]
    C --> D[Rethink]
    D --> B
    B -- No ----> E[End]

μ μ„ μ΄λ‚˜ λ‘κΊΌμš΄ 링크λ₯Ό μœ„ν•΄μ„œλŠ”, μΆ”κ°€ν•΄μ•Ό ν•  λ¬ΈμžλŠ” λ“±ν˜Έ λ˜λŠ” 점으둜 μš”μ•½λœ ν‘œμ— λ‚˜μ™€ μžˆμŠ΅λ‹ˆλ‹€:

Length 1 2 3
Normal --- ---- -----
Normal with arrow --> ---> ---->
Thick === ==== =====
Thick with arrow ==> ===> ====>
Dotted -.- -..- -...-
Dotted with arrow -.-> -..-> -...->

Special characters that break syntax

λ¬Έμ œκ°€ λ˜λŠ” 문자λ₯Ό λ Œλ”λ§ν•˜κΈ° μœ„ν•΄ λ”°μ˜΄ν‘œ μ•ˆμ— ν…μŠ€νŠΈλ₯Ό 넣을 수 μžˆμŠ΅λ‹ˆλ‹€. μ•„λž˜ μ˜ˆμ‹œμ™€ 같이:

Code:

flowchart LR
    id1["This is the (text) in the box"]

Entity codes to escape characters

μ—¬κΈ°μ—μ„œ μ„€λͺ…λœ ꡬ문을 μ‚¬μš©ν•˜μ—¬ 문자λ₯Ό μ΄μŠ€μΌ€μ΄ν”„ν•  수 μžˆμŠ΅λ‹ˆλ‹€.

Code:

flowchart LR
        A["A double quote:\#quot;"] -->B["A dec char:\#9829;"]

μ£Όμ–΄μ§„ μˆ«μžλŠ” 10μ§„λ²•μ΄λ―€λ‘œ #λŠ” \#35;으둜 인코딩될 수 μžˆμŠ΅λ‹ˆλ‹€. λ˜ν•œ HTML 문자 이름을 μ‚¬μš©ν•˜λŠ” 것도 μ§€μ›λ©λ‹ˆλ‹€.

Subgraphs

subgraph title
    graph definition
end

An example below:

Code:

flowchart TB
    c1-->a2
    subgraph one
    a1-->a2
    end
    subgraph two
    b1-->b2
    end
    subgraph three
    c1-->c2
    end

μ„œλΈŒκ·Έλž˜ν”„μ— λͺ…μ‹œμ μΈ idλ₯Ό μ„€μ •ν•  μˆ˜λ„ μžˆμŠ΅λ‹ˆλ‹€.

Code:

flowchart TB
    c1-->a2
    subgraph ide1 [one]
    a1-->a2
    end

flowcharts

κ·Έλž˜ν”„ μœ ν˜• flowchartλ₯Ό μ‚¬μš©ν•˜λ©΄ μ•„λž˜ flowchartμ—μ„œμ™€ 같이 ν•˜μœ„ κ·Έλž˜ν”„λ‘œλΆ€ν„° 에지λ₯Ό μ„€μ •ν•  μˆ˜λ„ μžˆμŠ΅λ‹ˆλ‹€.

Code:

flowchart TB
    c1-->a2
    subgraph one
    a1-->a2
    end
    subgraph two
    b1-->b2
    end
    subgraph three
    c1-->c2
    end
    one --> two
    three --> two
    two --> c2

Direction in subgraphs

κ·Έλž˜ν”„ μœ ν˜•μ΄ flowcharts인 κ²½μš°μ—λŠ” direction 문을 μ‚¬μš©ν•˜μ—¬ μ„œλΈŒκ·Έλž˜ν”„κ°€ λ Œλ”λ§λ  λ°©ν–₯을 μ„€μ •ν•  수 μžˆμŠ΅λ‹ˆλ‹€. λ‹€μŒ μ˜ˆμ‹œμ™€ κ°™μŠ΅λ‹ˆλ‹€.

Code:

flowchart LR
  subgraph TOP
    direction TB
    subgraph B1
        direction RL
        i1 -->f1
    end
    subgraph B2
        direction BT
        i2 -->f2
    end
  end
  A --> TOP --> B
  B1 --> B2

Interaction

λ…Έλ“œμ— 클릭 이벀트λ₯Ό λ°”μΈλ”©ν•˜μ—¬ μžλ°”μŠ€ν¬λ¦½νŠΈ 콜백 λ˜λŠ” μƒˆλ‘œμš΄ λΈŒλΌμš°μ € νƒ­μ—μ„œ μ—΄λ¦¬λŠ” 링크둜 μ΄μ–΄μ§ˆ 수 μžˆμŠ΅λ‹ˆλ‹€. μ°Έκ³ : securityLevel='strict'λ₯Ό μ‚¬μš©ν•  λ•ŒλŠ” 이 κΈ°λŠ₯이 λΉ„ν™œμ„±ν™”λ˜κ³ , securityLevel='loose'λ₯Ό μ‚¬μš©ν•  λ•ŒλŠ” ν™œμ„±ν™”λ©λ‹ˆλ‹€.

click nodeId callback
click nodeId call callback()
  • nodeIdλŠ” λ…Έλ“œμ˜ idμž…λ‹ˆλ‹€.
  • callback은 κ·Έλž˜ν”„λ₯Ό ν‘œμ‹œν•˜λŠ” νŽ˜μ΄μ§€μ—μ„œ μ •μ˜λœ JavaScript ν•¨μˆ˜μ˜ μ΄λ¦„μž…λ‹ˆλ‹€. ν•΄λ‹Ή ν•¨μˆ˜λŠ” nodeIdλ₯Ό 맀개 λ³€μˆ˜λ‘œ ν˜ΈμΆœλ©λ‹ˆλ‹€.

Examples of tooltip usage below:

<script>
  const callback = function () {
    alert('A callback was triggered');
  };
</script>

툴팁 ν…μŠ€νŠΈλŠ” κ²Ήλ”°μ˜΄ν‘œλ‘œ λ‘˜λŸ¬μ‹Έμ—¬ μžˆμŠ΅λ‹ˆλ‹€. 툴팁의 μŠ€νƒ€μΌμ€ .mermaidTooltip 클래슀둜 μ„€μ •λ©λ‹ˆλ‹€.

Code:

flowchart LR
    A-->B
    B-->C
    C-->D
    click A callback "Tooltip for a callback"
    click B "https://www.github.com" "This is a tooltip for a link"
    click A call callback() "Tooltip for a callback"
    click B href "https://www.github.com" "This is a tooltip for a link"

성곡 - 버전 0.5.2λΆ€ν„° 툴팁 κΈ°λŠ₯κ³Ό URL 링크 κΈ°λŠ₯을 μ‚¬μš©ν•  수 μžˆμŠ΅λ‹ˆλ‹€.

?> Docsifyκ°€ JavaScript 콜백 ν•¨μˆ˜λ₯Ό μ²˜λ¦¬ν•˜λŠ” λ°©μ‹μ˜ μ œν•œμœΌλ‘œ 인해, μœ„ μ½”λ“œμ˜ λŒ€μ²΄ μž‘λ™ 데λͺ¨λŠ” **이 jsfiddle**μ—μ„œ λ³Ό 수 μžˆμŠ΅λ‹ˆλ‹€.

λ§ν¬λŠ” 기본적으둜 λ™μΌν•œ λΈŒλΌμš°μ € νƒ­ / μ°½μ—μ„œ μ—΄λ¦½λ‹ˆλ‹€. 클릭 μ •μ˜μ— 링크 λŒ€μƒμ„ μΆ”κ°€ν•˜μ—¬ 이λ₯Ό λ³€κ²½ν•  수 μžˆμŠ΅λ‹ˆλ‹€ (_self, _blank, _parent 및 _top이 지원됨) :

Code:

flowchart LR
    A-->B
    B-->C
    C-->D
    D-->E
    click A "https://www.github.com" _blank
    click B "https://www.github.com" "Open this in a new tab" _blank
    click C href "https://www.github.com" _blank
    click D href "https://www.github.com" "Open this in a new tab" _blank

HTML μ»¨ν…μŠ€νŠΈμ—μ„œ λŒ€ν™”ν˜• 링크λ₯Ό μ‚¬μš©ν•˜λŠ” 전체 μ˜ˆμ‹œ - 초보자 팁:

<body>
  <pre class="mermaid">
    flowchart LR
        A-->B
        B-->C
        C-->D
        click A callback "Tooltip"
        click B "https://www.github.com" "This is a link"
        click C call callback() "Tooltip"
        click D href "https://www.github.com" "This is a link"
  </pre>

  <script>
    const callback = function () {
      alert('A callback was triggered');
    };
    const config = {
      startOnLoad: true,
      flowchart: { useMaxWidth: true, htmlLabels: true, curve: 'cardinal' },
      securityLevel: 'loose',
    };
    mermaid.initialize(config);
  </script>
</body>

Comments

흐름도 λ‚΄μ—μ„œ 주석을 μž…λ ₯ν•  수 μžˆμŠ΅λ‹ˆλ‹€. 이 주석은 ꡬ문 λΆ„μ„κΈ°μ—μ„œ λ¬΄μ‹œλ©λ‹ˆλ‹€. 주석은 자체 쀄에 μžˆμ–΄μ•Όν•˜λ©° %% (이쀑 νΌμ„ΌνŠΈ 기호)둜 μ‹œμž‘ν•΄μ•Όν•©λ‹ˆλ‹€. 주석 μ‹œμž‘λΆ€ν„° λ‹€μŒ κ°œν–‰κΉŒμ§€μ˜ λͺ¨λ“  ν…μŠ€νŠΈλŠ” μ£Όμ„μœΌλ‘œ 처리되며, 흐름 ꡬ문을 ν¬ν•¨ν•˜μ—¬ λͺ¨λ“  ν…μŠ€νŠΈκ°€ μ£Όμ„μœΌλ‘œ μ²˜λ¦¬λ©λ‹ˆλ‹€.

Code:

flowchart LR
%% this is a comment A -- text --> B{node}
   A -- text --> B -- text2 --> C

Styling and classes

Styling links

링크λ₯Ό μŠ€νƒ€μΌλ§ ν•  수 μžˆμŠ΅λ‹ˆλ‹€. 예λ₯Ό λ“€μ–΄, 흐름을 거꾸둜 κ°€λŠ” 링크λ₯Ό μŠ€νƒ€μΌλ§ν•˜κ³  싢을 수 μžˆμŠ΅λ‹ˆλ‹€. λ§ν¬λŠ” λ…Έλ“œμ™€ λ§ˆμ°¬κ°€μ§€λ‘œ idκ°€ μ—†μœΌλ―€λ‘œ, 링크에 적용될 μŠ€νƒ€μΌμ„ κ²°μ •ν•˜κΈ° μœ„ν•œ λ‹€λ₯Έ 방법이 ν•„μš”ν•©λ‹ˆλ‹€. id λŒ€μ‹  κ·Έλž˜ν”„μ—μ„œ 링크가 μ •μ˜λœ μˆœμ„œ 번호λ₯Ό μ‚¬μš©ν•˜κ±°λ‚˜, λͺ¨λ“  링크에 μ μš©ν•˜λ €λ©΄ 기본값을 μ‚¬μš©ν•©λ‹ˆλ‹€. μ•„λž˜ μ˜ˆμ œμ—μ„œλŠ” linkStyle λ¬Έμ—μ„œ μ •μ˜λœ μŠ€νƒ€μΌμ΄ κ·Έλž˜ν”„μ—μ„œ λ„€ 번째 링크에 μ†ν•©λ‹ˆλ‹€:

linkStyle 3 stroke:\#ff3,stroke-width:4px,color:red;

Styling line curves

κΈ°λ³Έ 방법이 μš”κ΅¬ 사항을 μΆ©μ‘±ν•˜μ§€ λͺ»ν•˜λŠ” 경우 ν•­λͺ© κ°„ 라인에 μ‚¬μš©λ˜λŠ” 곑선 μœ ν˜•μ„ μŠ€νƒ€μΌλ§ν•˜λŠ” 것이 κ°€λŠ₯ν•©λ‹ˆλ‹€. μ‚¬μš© κ°€λŠ₯ν•œ 곑선 μŠ€νƒ€μΌμ€ basis, bumpX, bumpY, cardinal, catmullRom, linear, monotoneX, monotoneY, natural, step, stepAfter 및 stepBeforeκ°€ μžˆμŠ΅λ‹ˆλ‹€.

이 μ˜ˆμ‹œμ—μ„œ μ™Όμͺ½μ—μ„œ 였λ₯Έμͺ½μœΌλ‘œ κ·Έλ €μ§€λŠ” κ·Έλž˜ν”„λŠ” stepBefore 곑선 μŠ€νƒ€μΌμ„ μ‚¬μš©ν•©λ‹ˆλ‹€:

%%{ init: { 'flowchart': { 'curve': 'stepBefore' } } }%%
graph LR

μ‚¬μš© κ°€λŠ₯ν•œ λͺ¨λ“  κ³‘μ„ μ˜ 전체 λͺ©λ‘ 및 μ‚¬μš©μž μ§€μ • 곑선에 λŒ€ν•œ μ„€λͺ…을 ν¬ν•¨ν•œ μžμ„Έν•œ λ‚΄μš©μ€ d3-shape ν”„λ‘œμ νŠΈμ˜ Shapes λ¬Έμ„œλ₯Ό μ°Έμ‘°ν•˜μ‹­μ‹œμ˜€.

Styling a node

λ…Έλ“œμ— 더 λ‘κΊΌμš΄ ν…Œλ‘λ¦¬λ‚˜ λ‹€λ₯Έ 배경색과 같은 ꡬ체적인 μŠ€νƒ€μΌμ„ μ μš©ν•˜λŠ” 것이 κ°€λŠ₯ν•©λ‹ˆλ‹€.

Code:

flowchart LR
    id1(Start)-->id2(Stop)
    style id1 fill:\#f9f,stroke:\#333,stroke-width:4px
    style id2 fill:\#bbf,stroke:\#f66,stroke-width:2px,color:\#fff,stroke-dasharray: 5 5

Classes

맀번 μŠ€νƒ€μΌμ„ μ •μ˜ν•˜λŠ” κ²ƒλ³΄λ‹€λŠ” μŠ€νƒ€μΌ 클래슀λ₯Ό μ •μ˜ν•˜κ³  λ‹€λ₯Έ λͺ¨μŠ΅μ΄ ν•„μš”ν•œ λ…Έλ“œμ— 이 클래슀λ₯Ό μ μš©ν•˜λŠ” 것이 더 νŽΈλ¦¬ν•©λ‹ˆλ‹€.

μ•„λž˜ μ˜ˆμ‹œμ™€ 같이 클래슀 μ •μ˜λŠ” λ‹€μŒκ³Ό κ°™μŠ΅λ‹ˆλ‹€:

    classDef className fill:\#f9f,stroke:\#333,stroke-width:4px;

λ…Έλ“œμ— 클래슀λ₯Ό μ²¨λΆ€ν•˜λŠ” 방법은 λ‹€μŒκ³Ό κ°™μŠ΅λ‹ˆλ‹€:

    class nodeId1 className;

λ…Έλ“œ λͺ©λ‘μ— 클래슀λ₯Ό ν•œ λ²ˆμ— μΆ”κ°€ν•˜λŠ” 것도 κ°€λŠ₯ν•©λ‹ˆλ‹€:

    class nodeId1,nodeId2 className;

클래슀λ₯Ό μΆ”κ°€ν•˜λŠ” 더 짧은 방법은 μ•„λž˜μ™€ 같이 ::: μ—°μ‚°μžλ₯Ό μ‚¬μš©ν•˜μ—¬ λ…Έλ“œμ— 클래슀 이름을 λΆ™μ΄λŠ” κ²ƒμž…λ‹ˆλ‹€:

Code:

flowchart LR
    A:::someclass --> B
    classDef someclass fill:\#f96

Css classes

css μŠ€νƒ€μΌμ—μ„œ 미리 μ •μ˜λœ 클래슀λ₯Ό κ·Έλž˜ν”„ μ •μ˜μ—μ„œ μ•„λž˜ μ˜ˆμ‹œμ™€ 같이 μ μš©ν•  μˆ˜λ„ μžˆμŠ΅λ‹ˆλ‹€:

Example style

<style>
  .cssClass > rect {
    fill: \#ff0000;
    stroke: \#ffff00;
    stroke-width: 4px;
  }
</style>

Example definition

Code:

flowchart LR
    A-->B[AAA<span>BBB</span>]
    B-->D
    class A cssClass

Default class

λ§Œμ•½ 클래슀의 이름이 "default"이면, νŠΉμ • 클래슀 μ •μ˜ 없이 λͺ¨λ“  ν΄λž˜μŠ€μ— ν• λ‹Ήλ©λ‹ˆλ‹€.

    classDef default fill:\#f9f,stroke:\#333,stroke-width:4px;

Basic support for fontawesome

ν°νŠΈμ–΄μΈμ—μ„œ μ•„μ΄μ½˜μ„ μΆ”κ°€ν•  수 μžˆμŠ΅λ‹ˆλ‹€.

μ•„μ΄μ½˜μ€ fa:#μ•„μ΄μ½˜ 클래슀λͺ…# ꡬ문을 톡해 μ•‘μ„ΈμŠ€λ©λ‹ˆλ‹€.

Code:

flowchart TD
    B["fab:fa-twitter for peace"]
    B-->C[fa:fa-ban forbidden]
    B-->D(fa:fa-spinner)
    B-->E(A fa:fa-camera-retro perhaps?)

MermaidλŠ” Font Awesome 버전 4와 5μ™€λ§Œ ν˜Έν™˜λ©λ‹ˆλ‹€. μ˜¬λ°”λ₯Έ λ²„μ „μ˜ Font Awesomeλ₯Ό μ‚¬μš© 쀑인지 ν™•μΈν•˜μ„Έμš”.

Graph declarations with spaces between vertices and link and without semicolon

  • κ·Έλž˜ν”„ μ„ μ–Έμ—μ„œ λ¬Έμž₯이 μ„Έλ―Έμ½œλ‘  없이 끝날 μˆ˜λ„ μžˆμŠ΅λ‹ˆλ‹€. 0.2.16 버전 μ΄ν›„μ—λŠ” κ·Έλž˜ν”„ λ¬Έμž₯을 μ„Έλ―Έμ½œλ‘ μœΌλ‘œ λλ‚΄λŠ” 것이 μ„ νƒμ‚¬ν•­μž…λ‹ˆλ‹€. λ”°λΌμ„œ μ•„λž˜ κ·Έλž˜ν”„ 선언은 μ˜ˆμ „μ˜ κ·Έλž˜ν”„ μ„ μ–Έκ³Ό ν•¨κ»˜ μœ νš¨ν•˜λ©°, 이전 ꡬ문도 계속 μ‚¬μš© κ°€λŠ₯ν•©λ‹ˆλ‹€.
  • λ…Έλ“œμ™€ μ—°κ²° μ‚¬μ΄μ—λŠ” 곡백을 ν•˜λ‚˜λ§Œ ν—ˆμš©ν•©λ‹ˆλ‹€. κ·ΈλŸ¬λ‚˜ λ…Έλ“œμ™€ ν…μŠ€νŠΈ, μ—°κ²°κ³Ό ν…μŠ€νŠΈ μ‚¬μ΄μ—λŠ” 곡백이 μ—†μ–΄μ•Ό ν•©λ‹ˆλ‹€. μ΄μ „μ˜ κ·Έλž˜ν”„ μ„ μ–Έ ꡬ문도 계속 μž‘λ™ν•˜λ―€λ‘œ, 이 μƒˆλ‘œμš΄ κΈ°λŠ₯은 선택사항이며 가독성을 ν–₯μƒμ‹œν‚€κΈ° μœ„ν•΄ λ„μž…λ˜μ—ˆμŠ΅λ‹ˆλ‹€.

μ•„λž˜λŠ” κ·Έλž˜ν”„ μ—£μ§€μ˜ μƒˆλ‘œμš΄ μ„ μ–Έ λ°©μ‹μœΌλ‘œ, 이전 κ·Έλž˜ν”„ μ—£μ§€μ˜ μ„ μ–Έ 방식과 ν•¨κ»˜ μœ νš¨ν•©λ‹ˆλ‹€.

Code:

flowchart LR
    A[Hard edge] -->|Link text| B(Round edge)
    B --> C{Decision}
    C -->|One| D[Result one]
    C -->|Two| E[Result two]

Configuration

Renderer

λ‹€μ΄μ–΄κ·Έλž¨ λ ˆμ΄μ•„μ›ƒμ€ λ Œλ”λŸ¬λ‘œ μ²˜λ¦¬λ©λ‹ˆλ‹€. κΈ°λ³Έ λ Œλ”λŸ¬λŠ” dagreμž…λ‹ˆλ‹€.

Mermaid 버전 9.4λΆ€ν„°λŠ” elkλΌλŠ” λŒ€μ²΄ λ Œλ”λŸ¬λ₯Ό μ‚¬μš©ν•  수 μžˆμŠ΅λ‹ˆλ‹€. elk λ Œλ”λŸ¬λŠ” 더 크고/λ˜λŠ” λ³΅μž‘ν•œ λ‹€μ΄μ–΄κ·Έλž¨μ— μ ν•©ν•©λ‹ˆλ‹€.

elk λ Œλ”λŸ¬λŠ” μ‹€ν—˜μ μΈ κΈ°λŠ₯μž…λ‹ˆλ‹€. elk λ Œλ”λŸ¬λ‘œ λ³€κ²½ν•˜λ €λ©΄ λ‹€μŒ μ§€μ‹œλ¬Έμ„ μΆ”κ°€ν•˜λ©΄ λ©λ‹ˆλ‹€:

%%{init: {"flowchart": {"defaultRenderer": "elk"}} }%%

이 μ‚¬μ΄νŠΈμ—μ„œλŠ” 이 κΈ°λŠ₯을 μ‚¬μš©ν•˜λ €λ©΄ mermaid 버전 9.4+λ₯Ό μ‚¬μš©ν•˜κ³  lazy-loading κ΅¬μ„±μ—μ„œ 이 κΈ°λŠ₯을 ν™œμ„±ν™”ν•΄μ•Όν•©λ‹ˆλ‹€.

Width

λ Œλ”λ§λœ ν”Œλ‘œμš° 차트의 λ„ˆλΉ„λ₯Ό μ‘°μ •ν•˜λŠ” 것이 κ°€λŠ₯ν•©λ‹ˆλ‹€.

μ΄λŠ” mermaid.flowchartConfigλ₯Ό μ •μ˜ν•˜κ±°λ‚˜, CLIλ₯Ό μ‚¬μš©ν•˜μ—¬ JSON 파일둜 ꡬ성을 μ„€μ •ν•¨μœΌλ‘œμ¨ μˆ˜ν–‰ν•  수 μžˆμŠ΅λ‹ˆλ‹€. CLI의 μ‚¬μš© 방법은 mermaidCLI νŽ˜μ΄μ§€μ—μ„œ μ„€λͺ…λ˜μ–΄ μžˆμŠ΅λ‹ˆλ‹€. mermaid.flowchartConfigλŠ” ꡬ성 맀개 λ³€μˆ˜λ₯Ό ν¬ν•¨ν•˜λŠ” JSON λ¬Έμžμ—΄ λ˜λŠ” ν•΄λ‹Ή 객체둜 μ„€μ •ν•  수 μžˆμŠ΅λ‹ˆλ‹€.

mermaid.flowchartConfig = {
    width: 100%
}
⚠️ **GitHub.com Fallback** ⚠️