Skip to content

Latest commit

 

History

History
266 lines (246 loc) · 6.46 KB

plantuml-cheat-sheet.md

File metadata and controls

266 lines (246 loc) · 6.46 KB

PlantUML

Links

Free alternatives

local start

docker run -d --name plantuml_local -p 3344:8080 plantuml/plantuml-server:jetty

plantuml inside VisualCode

"plantuml.fileExtensions": ".wsd,.pu,.puml,.plantuml,.iuml,.md",
# "plantuml.server": "https://plantuml-mci.bmwgroup.net/",
"plantuml.server": "http://localhost:3344",
"plantuml.render": "PlantUMLServer",    

guide excerpts

elements

allowmixing
scale 500 width
' participant participant
actor       [actor\n<b><color:blue>Vasya</color></b> and Co]
boundary    boundary   #yellow
control     control    #ff0
entity      entity     #ffaa00
database    database   
collections collections
queue       queue

usecase usecase

json doc_json{
    "key":"bbb","key2":"bbb"
}

component component{
    port port1
    portin port2
    portout port3
}

action action
actor actor
actor/ "actor/"
agent agent
artifact artifact
boundary boundary
card card
circle circle
cloud cloud
collections collections
component component
control control
database database
entity entity
file file        #lightgreen
folder folder
frame frame
hexagon hexagon
interface interface
label label
node node
package package
person person
process process
queue queue
rectangle rectangle
stack stack
storage storage
usecase usecase
usecase/ "usecase/"

archimate

listsprite
rectangle "Information" <<$archimate/business-collaboration>> #Business
rectangle "File" <<$archimate/technology-artifact>> #Technology

include elements from standard libraries

git clone https://github.com/plantuml/plantuml-stdlib.git
cd plantuml-stdlib
# components
grep -r '^!define' | grep archimate

archimate

' https://github.com/plantuml/plantuml-stdlib/blob/master/archimate/Archimate.puml  
'                                                         archimate/Archimate.puml
!include <archimate/Archimate>
Application_Component(c1, "app1")
Technology_Artifact(f1, "file1")
Rel_Access_r(c1,f1)

c4 diagram

!include https://raw.githubusercontent.com/plantuml-stdlib/C4-PlantUML/master/C4_Container.puml

!define FONTAWESOME https://raw.githubusercontent.com/tupadr3/plantuml-icon-font-sprites/master/font-awesome-5
 
!define DEVICONS https://raw.githubusercontent.com/tupadr3/plantuml-icon-font-sprites/master/devicons
!include FONTAWESOME/users.puml
!include DEVICONS/angular.puml
!include DEVICONS/java.puml
!include DEVICONS/msql_server.puml

include symbols add sprites

git clone https://github.com/plantuml/plantuml-stdlib.git
cd plantuml-stdlib
# components
grep -r '^sprite' | grep database
' it doesn't work
!include tupadr3/font-awesome-6/database
listsprite
' https://github.com/tupadr3/plantuml-icon-font-sprites/blob/main/icons/font-awesome/index.md
'
' https://github.com/plantuml/plantuml-stdlib/blob/master/tupadr3/font-awesome-6/database.puml
'                                                         tupadr3/font-awesome-6/database
!include <tupadr3/font-awesome-6/database>
a ==right=> b #red :<s><size:20><color:green> question <$database>
b -up-> c : question 👀

custom sprites

@startuml
sprite foo1 <svg viewBox="0 0 36 36">
<path fill="#77B255" d="M36 32c0 2.209-1.791 4-4 4H4c-2.209 0-4-1.791-4-4V4c0-2.209 1.791-4 4-4h28c2.209 0 4 1.791 4 4v28z"/>
<path fill="#FFF" d="M21.529 18.006l8.238-8.238c.977-.976.977-2.559 0-3.535-.977-.977-2.559-.977-3.535 0l-8.238 8.238-8.238-8.238c-.976-.977-2.56-.977-3.535 0-.977.976-.977 2.559 0 3.535l8.238 8.238-8.258 8.258c-.977.977-.977 2.559 0 3.535.488.488 1.128.732 1.768.732s1.28-.244 1.768-.732l8.258-8.259 8.238 8.238c.488.488 1.128.732 1.768.732s1.279-.244 1.768-.732c.977-.977.977-2.559 0-3.535l-8.24-8.237z"/>
</svg>

Converter1  ==> Converter2 : "     symbol <$foo1*0.5> "

@enduml

hide elements, remove elements

node node1 as n1
interface a
' remove node1
' hide node1
n1 --> a

elements position

a .down.>> b          :down
b ~right~* c         :right
c -up[hidden]-> d    :up  /' hide connection '/
d =left=o a          :left

connection arrow style

a -right[#red,dashed,thickness=5]-> b  :<s><b><i><size:15><color:green><font:arial> down <$database>

comments

/' 
multi line
comment 
'/
component a
' note example
note top of a: hello 
' multiline note example 
note right of a /' top, left, right, bottom, '/
  multi 
  line
  description
end note

colors

colors

directions

left to right direction /' try to comment this line '/

actor User
User -- guc
User -- fuc

themes

help themes
!theme black-knight
actor a
interface b 
a -right-> b

skins

fonts, text

skinparam actorFontSize 20
skinparam actorFontName arial
skinparam actorFontStyle bold
skinparam actorFontColor red
skinparam interfaceFontColor blue

actor A
interface B

color, highlight element

left to right direction
skinparam backgroundColor lightblue
skinparam handwritten true

skinparam component {    
    BorderColor red
    LineColor black
    LineThickness 5
    LineType dashed
    BackgroundColor gold
    BackgroundColor<<Anchor1>> yellow
    ArrowFontName arial
    ArrowFontColor #777777
    ArrowColor white 
    ArrowHeadColor purple
    ArrowStyle dashed /' dotted '/
    FontColor lightblue    
} 
component Orion as A #red-green 
component Sirius as B <<Anchor1>>
A --> B : hello
skinparameters