- [Layout (arrange) elements (without relationships)](#layout-arrange-elements-without-relationships)
- [Layout (arrange) elements (without relationships)](#layout-arrange-elements-without-relationships)
@ -35,21 +37,23 @@ C4-PlantUML includes macros, stereotypes, and other goodies (like VSCode Snippet
## Getting Started
## Getting Started
### Including the C4-PlantUML library
At the top of your C4 PlantUML `.puml` file, you need to include the `C4_Context.puml`, `C4_Container.puml` or `C4_Component.puml` file found in the `root` of this repo.
At the top of your C4 PlantUML `.puml` file, you need to include the `C4_Context.puml`, `C4_Container.puml` or `C4_Component.puml` file found in the `root` of this repo.
### Including the C4-PlantUML library
To be independent of any Internet connectivity, you can download the files found in the `root` and make use of them by supplying the command line argument `-DRELATIVE_INCLUDE="."` to PlantUML:
To be independent of any Internet connectivity, you can download the files found in the `root` and make use of them by supplying the command line argument `-DRELATIVE_INCLUDE="."` to PlantUML:
```bash
```bash
java -jar plantuml.jar -DRELATIVE_INCLUDE="." ...
java -jar plantuml.jar -DRELATIVE_INCLUDE="." ...
```
```
For Visual Studio Code, add the following to your settings.json:
> For Visual Studio Code, add the following to your settings.json:
```json
>
"plantuml.jarArgs": [
> ```json
"-DRELATIVE_INCLUDE=."
> "plantuml.jarArgs": [
]
> "-DRELATIVE_INCLUDE=."
```
> ]
> ```
If you want to use the always up-to-date version of the C4-PlantUML library in this repo (which obviously requires an Internet connection every time you render a document), use the following:
If you want to use the always up-to-date version of the C4-PlantUML library in this repo (which obviously requires an Internet connection every time you render a document), use the following:
@ -57,7 +61,13 @@ If you want to use the always up-to-date version of the C4-PlantUML library in t
If you don't need the up-to-date version, PlantUML includes the last released `C4_...` files as [standard library C4](https://plantuml.com/stdlib#062f75176513a666) \(no additional files or Internet is required). You can use it with following:
```plantuml
!include <C4/C4_Container>
```
### Now let's create a C4 Container diagram
\(If you don't want run PlantUML locally you can use e.g. the [PlantUML Web Server](https://www.plantuml.com/plantuml/uml/ZOxDIWGn48JlUOeufn5qSjcJfvNHsugBFsV99iqcsEc4T0VTjpSCE2AYUAeAgVwgjYosIakevytBBK824bPdaHms3pg85BuofjgtwHWbj4DZg2wJzDpaSZAliRh04ioykToZ9Nc-snbux_yUlEdGkOTj9AXJwJLAxQ5ofh4iSetHyeKUTlO0E7HpNoHcigXlW5sDosiuLojaT9_kn-aJk40Py_7q1-Znn09fv4N-swuU0ByFNbVyZlYQqmbR8DyIVW00) too.)
\(If you don't want run PlantUML locally you can use e.g. the [PlantUML Web Server](https://www.plantuml.com/plantuml/uml/ZOxDIWGn48JlUOeufn5qSjcJfvNHsugBFsV99iqcsEc4T0VTjpSCE2AYUAeAgVwgjYosIakevytBBK824bPdaHms3pg85BuofjgtwHWbj4DZg2wJzDpaSZAliRh04ioykToZ9Nc-snbux_yUlEdGkOTj9AXJwJLAxQ5ofh4iSetHyeKUTlO0E7HpNoHcigXlW5sDosiuLojaT9_kn-aJk40Py_7q1-Znn09fv4N-swuU0ByFNbVyZlYQqmbR8DyIVW00) too.)
@ -184,22 +194,22 @@ SHOW_LEGEND()
## Supported Diagram Types
## Supported Diagram Types
> * `arg`.. argument required (e.g. `alias`)
> * `arg`: argument required (e.g. `alias`)
> * `?arg`.. argument optional (e.g. `?descr`)
> * `?arg`: argument optional (e.g. `?tags`); an optional argument can be directly set via its keyword `$arg=...` (e.g. `$tags="specificTag"`) without the other optional arguments
Take a look at each of the [C4 Model Diagram Samples](samples/C4CoreDiagrams.md).
Take a look at each of the [C4 Model Diagram Samples](samples/C4CoreDiagrams.md).
## Relationship Types
## Relationship Types
* `Rel(from, to, label, ?techn, ?descr, ?sprite, ?tags, $link)`
* `Rel(from, to, label, ?techn, ?descr, ?sprite, ?tags, ?link)`
* `BiRel` (bidirectional relationship)
* `BiRel` (bidirectional relationship)
You can force the direction of a relationship by using:
You can force the direction of a relationship by using:
@ -419,7 +429,7 @@ Additional `$sprite` (images) can be defined with following PlantUML supported o
* OpenIconic via `&{OpenIconicName}`; details see [openiconic](https://plantuml.com/openiconic)
* OpenIconic via `&{OpenIconicName}`; details see [openiconic](https://plantuml.com/openiconic)
Size of the displayed images can be changed with `,scale={factor}`.
Size of the displayed images can be changed with `,scale={factor}`.
Color of the displayed images can be changed with `,color={color}`.
Color of the displayed images can be changed with `,color={color}`.
(If sprites are defined via $tags then the calculated legend is updated too)
(If sprites are defined via $tags then the calculated legend is updated too)
@ -450,9 +460,10 @@ SHOW_LEGEND()


Relationship specific sprites are typically smaller and therefore following options are possible:
Relationship specific sprites are typically smaller and therefore following options are possible:
* use smaller icons (like the $triangle in the following sample)
* use smaller icons (like the $triangle in the following sample)
* use an additional scale factor (direct as part of the argument, or via a variable)
* use an additional scale factor (direct as part of the argument, or via a variable)
* if sprite argument starts with `&` an OpenIconic name can be used too (details see https://useiconic.com/open)
* if sprite argument starts with `&` an OpenIconic name can be used too (details see <https://useiconic.com/open>)
```plantuml
```plantuml
@startuml
@startuml
@ -528,15 +539,19 @@ Multiple tags can be combined with `+`, like `Container(api, "API", $tags="v1.0+
### Element specific tag definitions
### Element specific tag definitions
Sometimes an added element tag is element specific and all element specific colors should be used, e.g. a specific user role should be defined as element tag with the specific colors `...PERSON_...` like
Sometimes an added element tag is element specific and all element specific colors should be used, e.g. a specific user role should be defined as element tag with the specific colors `...PERSON_...` like