当前位置:网站首页>Markdown绘图mermaid实用教程
Markdown绘图mermaid实用教程
2022-06-28 19:03:00 【落子无悔!】
Mermaid 是一个用于画流程图、状态图、时序图、甘特图的库,使用 JS 进行本地渲染,广泛集成于许多 Markdown 编辑器中。
Mermaid 作为一个使用 JS 渲染的库,生成的不是一个“图片”,而是一段 HTML 代码。
1. mermaid 定义

2. 流程图
语法格式如下:
graph LR; # 其中LR指的是方向 A --> B # 不同的箭头表示
a. 方向和箭头含义
| 用词 graph x; | 含义 | 箭头 | 含义 |
|---|---|---|---|
TB | 从上到下 | > | 添加尾部箭头 |
BT | 从下到上 | - | 不添加尾部箭头 |
RL | 从左到右 | -- | 单线 |
LR | 从右到左 | --text-- | 单线加文字 |
== | 粗线 | ||
==text== | 粗线加文字 | ||
-.- | 虚线 | ||
-.text.- | 虚线加文字 |
b. 节点含义
默认方形
id1[方形]
id2(圆边矩形)
id3([体育场形])
id4[[子程序形]]
id5[(圆柱形)]
id6((圆形))
id1{
菱形}
id2{
{
六角形}}
id3[/平行四边形/]
id4[\反向平行四边形\]
id5[/梯形\]
id6[\反向梯形/]
c. 示例
graph LR;
A>"Ubuntu<br>(Linux)"] -.soft.-> C{
TV}
B["MAC"] ==> D((ARM64))
D--> C
A --> B
graph LR
a---b
b--文本1!---c
c---|文本2|d
d===e
e==文本3===f
f-.-g
g-.文本.-h
- 延长连线:
增加相应字符即可,如下图中的B到E,连线中增加了一个-。字符可多次添加。
graph LR
A[Start] --> B{
Is it?};
B -->|Yes| C[OK];
C --> D[Rethink];
D --> B;
B --->|No| E[End];
- 多重链
graph LR
a --> b & c--> d
A & B--> C & D
X --> M
X --> N
Y --> M
Y --> N
- 注释
%%这是一条注释,在渲染图中不可见 - 子图
%%这是一条注释,在渲染图中不可见
flowchart TB
c1-->a2
subgraph one
a1-->a2
end
subgraph two
b1-->b2
end
subgraph three
c1-->c2
end
one --> two
three --> two
two --> c2
边栏推荐
猜你喜欢

毕业设计-基于Unity的餐厅经营游戏的设计与开发(附源码、开题报告、论文、答辩PPT、演示视频,带数据库)

In which industries did the fire virtual human start to make efforts?

try except 添加辅助新列
![[unity3d] emission (raycast) physical ray (Ray)](/img/46/a9fda743f597db9584c982b10c191c.png)
[unity3d] emission (raycast) physical ray (Ray)

Idea merge other branches into dev branch
![[C #] explain the difference between value type and reference type](/img/23/5bcbfc5f9cc6e8f4d647acf9219b08.png)
[C #] explain the difference between value type and reference type

C# 41. int与string互转

Memory leak

应用实践 | 10 亿数据秒级关联,货拉拉基于 Apache Doris 的 OLAP 体系演进(附 PPT 下载)

进阶高级-业务事务设计 开发入门
随机推荐
使用.NetCore自带的后台作业,出入队简单模拟生产者消费者处理请求响应的数据
new String(“hello“)之后,到底创建了几个对象?
深入解析kubernetes中的选举机制
Advanced - Introduction to business transaction design and development
Michael Wooldridge, professeur à l'Université d'Oxford: comment la communauté de l'IA voit les réseaux neuronaux depuis près de 40 ans
Anonymous function this pointing and variable promotion
Business layer modification - reverse modification based on the existing framework
async-validator.js数据校验器
基于管线的混合渲染
数字化转型的1个目标,3大领域,6大因素和9个环节
[unity3d] camera follow
leetcode 1423. Maximum points you can obtain from cards
Graduation project - Design and development of restaurant management game based on unity (with source code, opening report, thesis, defense PPT, demonstration video and database)
Jenkins Pipeline 对Job参数的处理
How many objects are created after new string ("hello")?
Render function parsing
matlab 二维或三维三角剖分
论文3 VScode&texlive&SumatraPDF打造完美书写论文工具
Get the timestamp of 0:00 and 23:59 of the current date
深度学习需要多强的数学基础?