# Usage

## Mermaid UML Diagrams Macro

The **Render Mermaid UML Diagrams** macro (<https://mermaid-js.github.io/mermaid/#/>) uses Mermaid to render UML diagrams. It allows you to define UML diagrams in plain-text format just like Markdown.

For a live editor to draft your diagrams, please try <https://mermaidjs.github.io/mermaid-live-editor>.

In the Confluence editor, open the **Select macro** dialog. The macro name is **Render Mermaid UML Diagrams**.

![Mermaid UML Diagrams and Graphviz Diagrams for Confluence Cloud](https://3588362646-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-Ma7ua4NoSptEMaVrDMS%2F-MkUmqmP2tthaej48rDr%2F-MkUpZEJm9Cn79WVgL7I%2Fimage.png?alt=media\&token=ed3b1d3b-b29c-4d8c-ae8b-e4581f0b4d50)

Alternatively, type / (**slash**) and select the macro.

![Mermaid UML Diagrams and Graphviz Diagrams for Confluence Cloud](https://3588362646-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-Ma7ua4NoSptEMaVrDMS%2F-MkUmqmP2tthaej48rDr%2F-MkUouybkR0GsW4lQCVv%2Fimage.png?alt=media\&token=e114ab55-725a-4de0-8373-555402961671)

A dialog will appear. Type the content of the UML diagram into the macro editor. Here is an example:

```
sequenceDiagram
    participant Alice
    participant Bob
    Alice->>John: Hello John, how are you?
    loop Healthcheck
        John->>John: Fight against hypochondria
    end
    Note right of John: Rational thoughts <br/>prevail!
    John-->>Alice: Great!
    John->>Bob: How about you?
    Bob-->>John: Jolly good!
```

![Mermaid UML Diagrams and Graphviz Diagrams for Confluence Cloud](https://3588362646-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-Ma7ua4NoSptEMaVrDMS%2F-MkUmqmP2tthaej48rDr%2F-MkUq01ClfLhF74YdYPm%2Fimage.png?alt=media\&token=c72b37ec-a0da-44a4-96fa-48935ce2d17d)

While editing, you can click **Show preview** to see the result. You can also click **Full Screen Editor** to open the Mermaid editor that will help you design new diagrams easily.

![Mermaid UML Diagrams and Graphviz Diagrams for Confluence Cloud](https://3588362646-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-Ma7ua4NoSptEMaVrDMS%2F-MkUmqmP2tthaej48rDr%2F-MkUqJQW_e_LTREul1YO%2Fimage.png?alt=media\&token=74232e73-af67-406e-b11c-b9925fd3cfd5)

Save the page, and the UML diagram will be rendered.

![Mermaid UML Diagrams and Graphviz Diagrams for Confluence Cloud](https://3588362646-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-Ma7ua4NoSptEMaVrDMS%2Fsync%2F364b3279ec8b5b00c9f6d01a54add9b0d3f504cf.png?generation=1621504370913308\&alt=media)

## PlantUML Diagrams Macro

The **Render PlantUML Diagrams** macro (<https://plantuml.com/>) uses PlantUML to render UML diagrams. It allows you to define UML diagrams in plain-text format just like Markdown.

For a live editor to draft your diagrams, please try <http://www.plantuml.com/plantuml>.

In the Confluence editor, open the **Select macro** dialog. The macro name is **Render PlantUML Diagrams**.

<figure><img src="https://3588362646-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-Ma7ua4NoSptEMaVrDMS%2Fuploads%2FJ5Wqpo6wCczGjmxW5wAh%2Fimage.png?alt=media&#x26;token=73c81b6c-5521-47d9-8ce0-03b8f6b0e76d" alt=""><figcaption><p>UML for Confluence</p></figcaption></figure>

A dialog will appear. Type the content of the UML diagram into the macro editor. Here is an example:

```plant-uml
@startuml C4_Elements
!include https://raw.githubusercontent.com/plantuml-stdlib/C4-PlantUML/master/C4_Container.puml

Person(personAlias, "Label", "Optional Description")
Container(containerAlias, "Label", "Technology", "Optional Description")
System(systemAlias, "Label", "Optional Description")

Rel(personAlias, containerAlias, "Label", "Optional Technology")
@enduml
```

You can find more examples here <https://plantuml.com/>. The PDF guideline can be downloaded here <https://plantuml.com/guide>.

Save the macro, and the UML diagram will be rendered.

<figure><img src="https://3588362646-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-Ma7ua4NoSptEMaVrDMS%2Fuploads%2F1pg4z2J07D5apCGl5YDL%2Fimage.png?alt=media&#x26;token=a450a6b5-f616-4d56-bac4-5a7a4d33ecdf" alt=""><figcaption><p>UML for Confluence</p></figcaption></figure>

## Graphviz Diagrams Macro

The Graphviz layout programs (<https://www.graphviz.org/>) take descriptions of graphs in a simple text language, and make diagrams in useful formats, such as images and SVG for web pages; PDF or Postscript for inclusion in other documents; or display in an interactive graph browser. Graphviz has many useful features for concrete diagrams, such as options for colors, fonts, tabular node layouts, line styles, hyperlinks, and custom shapes.

You can find more Graphviz examples [here](https://graphs.grevian.org/example).

In the Confluence editor, open the **Select macro** dialog. The macro name is **Render Graphviz Diagrams**.

![Mermaid UML Diagrams and Graphviz Diagrams for Confluence Cloud](https://3588362646-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-Ma7ua4NoSptEMaVrDMS%2Fsync%2F675c1716db3d9cab21c56465eb9335eecf8cd6bf.png?generation=1621504370867363\&alt=media)

Select the macro, then click **Insert**.

![Mermaid UML Diagrams and Graphviz Diagrams for Confluence Cloud](https://3588362646-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-Ma7ua4NoSptEMaVrDMS%2Fsync%2F50043f7644629439eadaa0fbf399b28809d0c34c.png?generation=1621504371001052\&alt=media)

Type the content of the Graphviz diagram into the macro editor. Here is an example:

```
graph {
  a -- b;
  b -- c;
  a -- c;
  d -- c;
  e -- c;
  e -- a;
}
```

![Mermaid UML Diagrams and Graphviz Diagrams for Confluence Cloud](https://3588362646-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-Ma7ua4NoSptEMaVrDMS%2Fsync%2Ff0bd8766b218835680ffbc8fae25a5941a2f607a.png?generation=1621504370803263\&alt=media)

Save the page, and the Graphviz diagram will be rendered.

![Mermaid UML Diagrams and Graphviz Diagrams for Confluence Cloud](https://3588362646-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-Ma7ua4NoSptEMaVrDMS%2Fsync%2Faa8d8862a99c9f892bdde87013fd7b079b93e75e.png?generation=1621504370817946\&alt=media)

## Examples

### Flowchart

Flowcharts can be rendered with Mermaid. See more <https://mermaid-js.github.io/mermaid/#/flowchart>.

![Input](https://3588362646-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-Ma7ua4NoSptEMaVrDMS%2F-MfQKak3knB--HwYWCJF%2F-MfRk3r-aZ5wr1KNon7F%2Fimage.png?alt=media\&token=96e5c582-3e0f-4a81-b27f-f1f6aa3fa38f)

![Render](https://3588362646-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-Ma7ua4NoSptEMaVrDMS%2F-MfQKak3knB--HwYWCJF%2F-MfRm7-zDyDMDPaGRBU4%2Fimage.png?alt=media\&token=96d7d112-e259-4ad0-a65f-892480d51157)

### Sequence diagram

Sequence diagrams can be rendered with Mermaid. See more <https://mermaid-js.github.io/mermaid/#/sequenceDiagram>.

![Input](https://3588362646-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-Ma7ua4NoSptEMaVrDMS%2F-MfQKak3knB--HwYWCJF%2F-MfRkuCcrDHX912SRYh-%2Fimage.png?alt=media\&token=2d59f595-793b-479d-bbab-faefd6f17172)

![Render](https://3588362646-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-Ma7ua4NoSptEMaVrDMS%2F-MfQKak3knB--HwYWCJF%2F-MfRmf6Yp0CIrgp0v1iN%2Fimage.png?alt=media\&token=e14dd05f-88ac-4580-aa1e-4cc5b018e08b)

### Class diagram

Class diagrams can be rendered with Mermaid. See more <https://mermaid-js.github.io/mermaid/#/classDiagram>.

![Input](https://3588362646-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-Ma7ua4NoSptEMaVrDMS%2F-MfQKak3knB--HwYWCJF%2F-MfRn3mlJrz1YqR05FCh%2Fimage.png?alt=media\&token=a7cca6f2-440a-447e-a94b-5434c7e116c6)

![Render](https://3588362646-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-Ma7ua4NoSptEMaVrDMS%2F-MfQKak3knB--HwYWCJF%2F-MfRnPR5JDnBDLWJvXg1%2Fimage.png?alt=media\&token=6a12a53e-4f91-4a0f-a02e-a9f388a6c5f9)

### State diagram

State diagrams can be rendered with Mermaid. See more <https://mermaid-js.github.io/mermaid/#/stateDiagram>.

![Input](https://3588362646-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-Ma7ua4NoSptEMaVrDMS%2F-MfQKak3knB--HwYWCJF%2F-MfRp3169SHX4uJdp1Yc%2Fimage.png?alt=media\&token=fe008351-774c-4a4b-a882-ca121dc86f95)

![Render](https://3588362646-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-Ma7ua4NoSptEMaVrDMS%2F-MfQKak3knB--HwYWCJF%2F-MfRpBynG2viGNz43rej%2Fimage.png?alt=media\&token=5e2001c6-a3ff-4efb-bd68-9e9840a99ba6)

### Entity Relationship diagram

Entity Relationship diagrams can be rendered with Mermaid. See more <https://mermaid-js.github.io/mermaid/#/entityRelationshipDiagram>.

![Input](https://3588362646-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-Ma7ua4NoSptEMaVrDMS%2F-MfQKak3knB--HwYWCJF%2F-MfRpqQjT8zOQQf8Q3nk%2Fimage.png?alt=media\&token=93949ea7-a718-4f5e-bc08-b9629c025c22)

![Render](https://3588362646-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-Ma7ua4NoSptEMaVrDMS%2F-MfQKak3knB--HwYWCJF%2F-MfRpwIKfFDyRigQSJtG%2Fimage.png?alt=media\&token=90736037-91d4-4422-b756-34f92e03c1d6)

### User Journey

User Journey can be rendered with Mermaid. See more <https://mermaid-js.github.io/mermaid/#/user-journey>.

![Render](https://3588362646-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-Ma7ua4NoSptEMaVrDMS%2F-MfQKak3knB--HwYWCJF%2F-MfRqQFLOuW7X7WTD9sp%2Fimage.png?alt=media\&token=70a9f359-c3ad-48a3-8d07-d81f4470096f)

![Input](https://3588362646-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-Ma7ua4NoSptEMaVrDMS%2F-MfQKak3knB--HwYWCJF%2F-MfRqXGELy3h4DHIgEZr%2Fimage.png?alt=media\&token=2b384ae5-7c8a-41a2-a0a2-8d8416bd441b)

### Gantt chart

Gantt charts can be rendered with Mermaid. See more <https://mermaid-js.github.io/mermaid/#/gantt>.

![Input](https://3588362646-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-Ma7ua4NoSptEMaVrDMS%2F-MfQKak3knB--HwYWCJF%2F-MfRrtD1vjpuuDNkExc4%2Fimage.png?alt=media\&token=056c825d-665a-4151-920d-08c7b04174b8)

![Render](https://3588362646-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-Ma7ua4NoSptEMaVrDMS%2F-MfQKak3knB--HwYWCJF%2F-MfRrxiC78rgOrLGKNrA%2Fimage.png?alt=media\&token=ada082e3-9934-4e79-98e8-1224640a9e08)

### Pie chart

Pie charts can be rendered with Mermaid. See more <https://mermaid-js.github.io/mermaid/#/pie>.

![Input](https://3588362646-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-Ma7ua4NoSptEMaVrDMS%2F-MfQKak3knB--HwYWCJF%2F-MfRsgjEHSnhzr0UTnqv%2Fimage.png?alt=media\&token=15472b4d-4781-43b1-9893-e646ac44da9e)

![Render](https://3588362646-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-Ma7ua4NoSptEMaVrDMS%2F-MfQKak3knB--HwYWCJF%2F-MfRsyf_O8ESY4dlkk2Z%2Fimage.png?alt=media\&token=e0a58aa1-9403-4f8b-8b5e-81f7a0f3bf10)

### Graphviz

This diagram is rendered with Graphviz.

![Input](https://3588362646-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-Ma7ua4NoSptEMaVrDMS%2F-MfRwWqR-mEWO8dowhcO%2F-MfS1gUzu9gFC53VoOAz%2Fimage.png?alt=media\&token=546eaca7-90ca-44dc-ba53-b18184cadbeb)

![Render](https://3588362646-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-Ma7ua4NoSptEMaVrDMS%2F-MfRwWqR-mEWO8dowhcO%2F-MfS26jOEd1zEFuyuxWj%2Fimage.png?alt=media\&token=601e857b-8967-4780-83dc-3f9411c9e2a5)
