Plantuml
Plantuml
下载安装
下载plantuml.jar或者根据源里面安装
同目录运行
java -jar plantuml.jar -extractstdlib
安装标准库
|
|
然后你就可以include测试了
|
|
C4 related
C4 model官网 https://c4model.com/
由于我们是plantuml,所以使用C4-plantuml 对应网站为 https://github.com/plantuml-stdlib/C4-PlantUML
示例
@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
重要命令
listsprites
列出当前可以展示的icons
@startuml
listsprites
@enduml
注释
使用
' 注释
进行注释
连接线
->
横连
-->
竖着连
布局
together
让这些item 平齐
常用模板
框+图
@startuml
!define osaPuml https://raw.githubusercontent.com/Crashedmind/PlantUML-opensecurityarchitecture2-icons/master
!include osaPuml/Common.puml
!include osaPuml/User/all.puml
!include osaPuml/Hardware/all.puml
!include osaPuml/Misc/all.puml
!include osaPuml/Server/all.puml
!include osaPuml/Site/all.puml
' Users
osa_user_green_developer1: <$osa_user_green_developer>
osa_user_green_operations: <$osa_user_green_operations>
osa_user_green_business_manager: <$osa_user_green_business_manager>
' Devices
osa_desktop: <$osa_desktop>
osa_laptop: <$osa_laptop>
osa_iPhone: <$osa_iPhone>
osa_server: <$osa_server>
' Network
osa_device_wireless_router: <$osa_device_wireless_router>
osa_hub: <$osa_hub>
osa_firewall: <$osa_firewall>
osa_osa_cloud: <$osa_cloud>
footer %filename() rendered with PlantUML version %version()\nThe Hitchhiker’s Guide to PlantUML
@enduml
json图
官方例子
@startjson
<style>
.blue {
BackgroundColor blue
FontColor white
FontStyle italic
}
</style>
#highlight "age"
#highlight "address" / "state"
#highlight "phoneNumbers" <<blue>>
#highlight "phoneNumbers" / "1"
#highlight "phoneNumbers" / "1" / "number"
{
"firstName": "John",
"lastName": "Smith",
"isAlive": true,
"age": 27,
"address": {
"streetAddress": "21 2nd <color:red>Street",
"city": "New York",
"state": "NY",
"postalCode": "10021-3100"
},
"phoneNumbers": [
{
"type": "home",
"number": "212 555-1234"
},
{
"type": "office",
"number": "646 555-4567"
}
],
"children": [],
"spouse": null
}
@endjson
wbs图
@startwbs
<style>
.pink {
BackgroundColor pink
FontColor red
}
</style>
,* 公司
,** 行政部
,** IT部
,** 技术部
,*** 运维部 <<pink>>
,*** 开发部
,*** 测试部
@endwbs