PlantUML+MarkDown学习

在Markdown中可以使用mermaid画图,但是我在网上看到了Plant UML,功能比mermaid强大,所以就学习了一下。

总体说明

支持图形种类

  • Sequence diagram
  • Usecase diagram
  • Class diagram
  • Activity diagram (here is the legacy syntax)
  • Component diagram
  • State diagram
  • Object diagram
  • Deployment diagram
  • Timing diagram
  • Network
  • Wireframe graphical interface
  • Archimate diagram
  • Specification and Description Language (SDL)
  • Ditaa diagram
  • Gantt diagram
  • MindMap diagram
  • Work Breakdown Structure diagram
  • Mathematic with AsciiMath or JLaTeXMath notation
  • Entity Relationship diagram

预处理

所有预处理命令都是以“!”开头,语法类似于C

  • 变量:$a=23local $b="foo"global $c='foo'
  • 条件判断:if ... else ...
  • 函数:function ... return ... endfunction
  • 包含其他文件或URL:import filenameinclude filename!idincludesub filename!id
  • 日志打印:logdump_memoryassert condition : "message"
  • 动态参数名:##
  • 动态函数调用:%invoke_void_func()%call_user_func()
  • 内置函数:%strlen,%substr,%strpos,%intval,%file_exists,function_exists,%variable_exists,%set_variable_value,%get_variable_value,%getenv,%dirpath,%filename,%date,%true,%false,%not,%lower,%upper

通用命令

  • 页眉页脚:[center | left | right] head, footer
  • 缩放:scale
  • 标题:title ... end title
  • 图片标题:caption
  • 图片说明:legend [center | left | right] ... end legend

标准库

参考:https://plantuml.com/zh/stdlib

图形举例

Usecase diagram

  • 用例:(), usecase, as,用例描述分隔:--text--, ==text==, ..text..
  • 角色:::, actor, as
  • 连接
    • 箭头连接:->, -->, <-, <--, <., <.., .>, ..>, -right->, -left->, -down->, -up->
    • 继承:<|--
  • 注释:note [left | right | top | bottom] of () ... end notenote message as ID, ID .. ()
  • 构造类型:<< >>
  • 方向控制:top to bottom directionleft to right direction
  • 显示颜色&字体:skinparam

用例图举例

<img src='https://g.gravizo.com/svg?
@startuml;
left to right direction;
skinparam packageStyle rectangle;
actor customer;
actor clerk;
rectangle checkout {;
  customer -- (checkout);
  (checkout) .> (payment) : include;
  (help) .> (checkout) : extends;
  (checkout) -- clerk;
};
@enduml'
alt="用例图举例">

gravizo不仅支持PlantUML,还支持Graphviz、UMLGraph以及JSON格式的SVG图。

  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值