[toc]
# 一级标题
## 二级标题
### 三级标题
#### 四级标题
##### 五级标题
###### 六级标题a
ba
b
- [ ] 跑步
- [ ] 骑车
- [x] 吃饭
- [ ] 睡觉- 跑步
- 骑车
- 吃饭
- 睡觉
*斜体*
_斜体_
**粗体**
__粗体__
___粗斜体___斜体 斜体 粗体 粗体 粗斜体
***
* * *
******
- - -
----------~~删除线~~ 删除线
<u>下划线</u>下划线
* 无序列表1
+ 无序列表2
- 无序列表3
1. 有序列表
1. 列表嵌套
- 嵌套- 无序列表1
- 无序列表2
- 无序列表3
-
有序列表
-
列表嵌套
- 嵌套
> 普通区块
> 嵌套区块1层
>
> > 嵌套区块2层普通区块
嵌套区块1层
嵌套区块2层
```c++
#inclue <iostream>
int main(void) {
std::cout << "hello world" << std::endl;
}
```#inclue <iostream>
int main(void) {
std::cout << "hello world" << std::endl;
}这个链接用 1 作为网址变量 [Google][1]
这个链接用 runoob 作为网址变量 [Runoob][runoob]
[1]: http://www.google.com/
[runoob]: http://www.runoob.com/这个链接用 1 作为网址变量 Google
这个链接用 runoob 作为网址变量 Runoob
这是正文,在这里引用锚点[<sup>[1]</sup>](#refer-anchor-1)
<div id="refer-anchor-1">[1] 作者. 文献名. 页码 起始-结束. 年份</div>这是正文,在这里引用锚点[1](#refer-anchor-1)
注意:非标准语法,但typora支持
这里添加脚注[^1]
[^1]: 这里是脚注说明这里添加脚注1
无对齐方式:
| 表头 | 表头 |
|--------|--------|
| 单元格 | 单元格 |
| 单元格 | 单元格 || 表头 | 表头 |
|---|---|
| 单元格 | 单元格 |
| 单元格 | 单元格 |
对齐方式:
| 左对齐 | 居中 | 右对齐 |
| :----- | :----: | -----: |
| 单元格 | 单元格 | 单元格 |
| 单元格 | 单元格 | 单元格 || 左对齐 | 居中 | 右对齐 |
|---|---|---|
| 单元格 | 单元格 | 单元格 |
| 单元格 | 单元格 | 单元格 |
<span style='background-color:yellow'>黄色</span>黄色
<pre>
int main(void) {
...
}
</pre>int main(void) {
...
}
<table>
<caption> 标题 </caption>
<tr align = "left">
<th> 表头1 </th>
<th> 表头2 </th>
</tr>
<tr align = "left">
<td rowspan = "2"> 单元格1 </td>
<td align = "left"> 单元格2 </td>
</tr>
<tr>
<td align = "center"> 单元格3 </td>
</tr>
<tr align = "right">
<td colspan = "2"> 单元格4 </td>
</tr>
</table>| 表头1 | 表头2 |
|---|---|
| 单元格1 | 单元格2 |
| 单元格3 | |
| 单元格4 | |
<div style="width: 50%; float:left;">左侧</div>
<div style="width: 50%; float:left;">右侧</div>| 效果 | 源码 | 效果 | 源码 | 效果 | 源码 | 效果 | 源码 | 效果 | 源码 | 效果 | 源码 |
|---|---|---|---|---|---|---|---|---|---|---|---|
$\alpha$ |
$\kappa$ |
$\psi$ |
$\digamma$ |
$\Delta$ |
$\Theta$ |
||||||
$\beta$ |
$\lambda$ |
$\rho$ |
$\varepsilon$ |
$\Gamma$ |
$\Upsilon$ |
||||||
$\chi$ |
$\mu$ |
$\sigma$ |
$\varkappa$ |
$\Lambda$ |
$\Xi$ |
||||||
$\delta$ |
$\nu$ |
$\tau$ |
$\varphi$ |
$\Omega$ |
$\ell$ |
||||||
$\epsilon$ |
$o$ |
$\theta$ |
$\varpi$ |
$\Phi$ |
$\aleph$ |
||||||
$\eta$ |
$\omega$ |
$\upsilon$ |
$\varrho$ |
$\Pi$ |
$\beth$ |
||||||
$\gamma$ |
$\phi$ |
$\xi$ |
$\varsigma$ |
$\Psi$ |
$\daleth$ |
||||||
$\iota$ |
$\pi$ |
$\zeta$ |
$\vartheta$ |
$\Sigma$ |
$\gimel$ |
$$\mathbb{ABCdef}$$$$\text{hello world}$$Ⅰ, Ⅱ, Ⅲ, Ⅳ, Ⅴ, Ⅵ, Ⅶ, Ⅷ, Ⅸ, Ⅹ, Ⅺ, Ⅻ, ⅩⅢ, ⅩⅣ, ⅩⅤ, ⅩⅥ, ⅩⅦ, ⅩⅧ, ⅩⅨ, ⅩⅩ, ⅩⅩⅩ, ⅩⅬ, Ⅼ, ⅬⅩ, ⅬⅩⅩ, ⅬⅩⅩⅩ, ⅩⅭ, ⅩⅭⅨⅠ, Ⅱ, Ⅲ, Ⅳ, Ⅴ, Ⅵ, Ⅶ, Ⅷ, Ⅸ, Ⅹ, Ⅺ, Ⅻ, ⅩⅢ, ⅩⅣ, ⅩⅤ, ⅩⅥ, ⅩⅦ, ⅩⅧ, ⅩⅨ, ⅩⅩ, ⅩⅩⅩ, ⅩⅬ, Ⅼ, ⅬⅩ, ⅬⅩⅩ, ⅬⅩⅩⅩ, ⅩⅭ, ⅩⅭⅨ
| 效果 | 源码 | 效果 | 源码 | 效果 | 源码 | 效果 | 源码 |
|---|---|---|---|---|---|---|---|
$\arccos$ |
$\arcsin$ |
$\arctan$ |
$\arg$ |
||||
$\cos(x)$ |
$\cosh$ |
$\cot(x)$ |
$\coth$ |
||||
$\csc$ |
$\deg$ |
$\det$ |
$\dim$ |
||||
$\exp$ |
$\gcd$ |
$\hom$ |
$\inf$ |
||||
$\ker$ |
$\lg x$ |
$\lim^{x \to \infty}_{y \to 0}$ |
$\liminf$ |
||||
$\limsup$ |
$\ln x$ |
$\log_x y$ |
$\max$ |
||||
$\min$ |
$\Pr$ |
$\sec$ |
$\sin(x)$ |
||||
$\sinh$ |
$\sup$ |
$\tan(x)$ |
$\tanh$ |
| 效果 | 源码 | 效果 | 源码 | 效果 | 源码 | 效果 | 源码 |
|---|---|---|---|---|---|---|---|
$x \pm y$ |
$x \mp y$ |
$x \times y$ |
$x \cdot y$ |
||||
$x \ast y$ |
$x \div y$ |
$x/y$ |
$x \quad y$ |
||||
$x \mid y$ |
$x \nmid y$ |
$x \parallel y$ |
$x \nparallel y$ |
| 效果 | 源码 | 效果 | 源码 | 效果 | 源码 | 效果 | 源码 |
|---|---|---|---|---|---|---|---|
$\forall$ |
$\exists$ |
$\because$ |
$\therefore$ |
||||
$\neg$ |
$\infty$ |
$\emptyset$ |
|||||
$x \in y$ |
$x \notin y$ |
$x \subset y$ |
$x \not\subset y$ |
||||
$x \subseteq y$ |
$x \subsetneq y$ |
$x \supset y$ |
$x \not\supset y$ |
||||
$x \supseteq y$ |
$x \supsetneq y$ |
||||||
$x \cup y$ |
$x \cap y$ |
$x \bigcup y$ |
$x \bigcap y$ |
||||
$x \setminus y$ |
$x \bigvee y$ |
$x \bigwedge y$ |
|||||
$x \geq y$ |
$x \leq y$ |
$x \leqslant y$ |
$x \geqslant y$ |
||||
$x < y$ |
$x > y$ |
$x \ll y$ |
$x \gg y$ |
||||
$x \neq y$ |
$x \sim y$ |
$x \approx y$ |
$x \equiv y$ |
||||
$x \not\equiv y$ |
|||||||
$x \odot y$ |
$x \oplus y$ |
$x \circ y$ |
$x \ominus$y | $x \ominus y$ |
|||
$x \bullet y$ |
$x \otimes y$ |
||||||
$(s, \preccurlyeq)$ |
x \prec y |
||||||
$(\mathcal{P}, \mathcal{C}, \mathcal{K}, \mathcal{E}, \mathcal{D})$ |
| 效果 | 源码 | 效果 | 源码 | 效果 | 源码 | 效果 | 源码 |
|---|---|---|---|---|---|---|---|
$\{$ |
$\}$ |
$\left [ \right ]$ |
$\left ( \right )$ |
||||
$\langle$ |
$\rangle$ |
||||||
$|$ |
$\Vert$ |
||||||
$\Uparrow$ |
$\Downarrow$ |
$\uparrow$ |
$\downarrow$ |
||||
$\updownarrow$ |
$\Updownarrow$ |
||||||
$\Leftarrow$ |
$\Rightarrow$ |
$\leftrightarrow$ |
$\Leftrightarrow$ |
||||
$\llcorner$ |
$\lrcorner$ |
$\ulcorner$ |
$\urcorner$ |
| 效果 | 源码 | 效果 | 源码 |
|---|---|---|---|
$\lfloor x \rfloor$ |
$\lceil x \rceil$ |
||
$\dot x$ |
$\ddot x$ |
||
$\dot {\dot x}$ |
|||
$\hat x$ |
$\widehat {xy}$ |
||
$\widetilde{x}$ |
|||
$x \leftarrow y$ |
$x \rightarrow y$ |
||
$x \mapsto y$ |
|||
$\underleftarrow{a+b}$ |
\underrightarrow{a+b} |
||
$\overleftarrow{a+b}$ |
$\overrightarrow{a+b}$ |
||
$\underline{a+b}$ |
$\overline{a+b}$ |
||
$\underleftrightarrow{a+b}$ |
$\overleftrightarrow{a + b}$ |
||
$\overbrace{a+\underbrace{b+c}_{1.0}+d}^{2.0}$ |
$\underbrace{a\cdot a\cdots a}_{b\text{ times}}$ |
||
$a^b$ |
$\angle{abc}$ |
||
$\lbrace \frac{a}{b} \rbrace$ |
$\left \langle \frac{a}{b} \right \rangle$ |
||
$\left [ a,b \right )$ |
|||
$A^* = \bigcup_{k=0}^{\infty} A^k$ |
|||
$\sqrt{x}$ |
$\sqrt[n]{y}$ |
||
$\sum_{r=1}^n$ |
|||
$\prod_{i=1}^{K}$ |
$\coprod$ |
||
$\int^{\infty}_{0}$ |
$\oint$ |
||
$\iint$ |
$\iiint$ |
||
$\Bigg(\bigg(\Big(\big((x)\big)\Big)\bigg)\Bigg)$ |
$\Bigg[\bigg[\Big[\big[[x]\big]\Big]\bigg]\Bigg]$ |
||
$\Bigg \langle \bigg \langle \Big \langle\big\langle\langle x \rangle \big \rangle\Big\rangle\bigg\rangle\Bigg\rangle$ |
$\Bigg\lvert\bigg\lvert\Big\lvert\big\lvert\lvert x \rvert\big\rvert\Big\rvert\bigg\rvert\Bigg\rvert$ |
||
$\Bigg\lVert\bigg\lVert\Big\lVert\big\lVert\lVert x \rVert\big\rVert\Big\rVert\bigg\rVert\Bigg\rVert$ |
|||
$\cdots$ |
$\vdots$ |
||
$60 \%$ |
|||
$O(n \log n)$ |
|||
$\aleph_0$ |
|||
$\vartheta_i$ |
|||
$\mathbb{R}^n$ |
|||
$\nabla_{x_t}$ |
| 效果 | 源码 |
|---|---|
$f(x)$ |
|
$\overset{a,b}{f(x)}$ |
|
$\underset{ab}{f(x)}$ |
|
| $ f\left(\left[\frac{1+\left{x,y\right}}{\left(\frac xy + \frac yx \right)(u+1)}+a \right]^{3/2} \right) \tag {行标} $ | $ f\left(\left[\frac{1+\left\{x,y\right\}}{\left(\frac xy + \frac yx \right)(u+1)}+a \right]^{3/2} \right) \tag {行标} $ |
$\sum_{k_0,k_1,\ldots>0 \atop k_0+k_1+\cdots=n}$ |
|
${n+1 \choose k}={n \choose k}+{n \choose k-1}$ |
|
$\frac{\partial x}{\partial y}$ |
|
$a \overset{b}{=} c$ |
|
| $a_{\left.{\overline{,2,}}!\right | i}$ |
| $\ddot{a}^{(m)}_{\left.{\overline{,2,}}!\right | i}$ |
$x=a_0 + \cfrac {1^2}{a_1 + \cfrac {2^2}{a_2 + \cfrac {3^2}{a_3 + \cfrac {4^2}{a_4 + ...}}}}$ |
|
$\boxed{E=mc^2}$ |
|
$c = m^e \bmod n$ |
矩阵(matrix)的表示:
$$
\begin{matrix}
x_{_{11} } & x_{_{12} } & \dots & x_{_{1n} } \\
x_{_{21} } & x_{_{22} } & \dots & x_{_{2n} } \\
\vdots & \vdots & \ddots & \vdots \\
x_{_{m1} } & x_{_{m2} } & \dots & x_{_{mn} } \\
\end{matrix}
$$矩阵(bmatrix)的表示:
$$
\begin{bmatrix}
1 & 2 & 3 \\
4 & 5 & 6 \\
7 & 8 & 9
\end{bmatrix}
$$矩阵(Bmatrix)的表示:
$$
\begin{Bmatrix}
1 & 2 & 3 \\
4 & 5 & 6 \\
7 & 8 & 9
\end{Bmatrix}
$$矩阵(pmatrix)的表示:
$\begin{pmatrix}1 & 2 \\ 3 & 4\\ \end{pmatrix}$$\begin{pmatrix}1 & 2 \ 3 & 4\ \end{pmatrix}$
矩阵(vmatrix)的表示:
$\begin{vmatrix}1 & 2 \\ 3 & 4\\ \end{vmatrix}$$\begin{vmatrix}1 & 2 \ 3 & 4\ \end{vmatrix}$
矩阵(Vmatrix)的表示:
$\begin{Vmatrix}1 & 2 \\ 3 & 4\\ \end{Vmatrix}$$\begin{Vmatrix}1 & 2 \ 3 & 4\ \end{Vmatrix}$
增广矩阵(Augmented Matrix)的表示:
$$
\left[\begin{array}{ccc|c}
1 & 2 & 3 & 0\\
4 & 5 & 6 & 0\\
7 & 8 & 9 & 0
\end{array}\right]
$$行向量 $$ \vec{x} = (x_1, x_2, x_3, x_4) $$
$$
$\vec{x} = (x_1, x_2, x_3, x_4)$
$$分类表达式1:
$$
f(n)
\begin{cases}
\cfrac n2, &\text{if n is even} \\
3n + 1, &\text{if n is odd}
\end{cases}
\qquad (1)f(n)
$$分类表达式2:
$$
L(Y,f(X)) =
\begin{cases}
0, & \text{Y = f(X)} \\
1, & \text{Y $\neq$ f(X)}
\end{cases}
$$$$
\begin{equation}\begin{split}
a&=b+c-d \\
&\quad +e-f\\
&=g+h\\
& =i
\end{split}\end{equation}
\qquad (1)
$$$$
\left \{
\begin{array}{c}
a_1x+b_1y+c_1z=d_1 \\
a_2x+b_2y+c_2z=d_2 \\
a_3x+b_3y+c_3z=d_3
\end{array}
\right.
$$$$
\begin{array}{c|lcr}
n & \text{左对齐} & \text{居中对齐} & \text{右对齐} \\
\hline
1 & 0.24 & 1 & 125 \\
2 & -1 & 189 & -8 \\
3 & -20 & 2000 & 1+10i \\
\end{array}
$$交换图表1:
$\require{AMScd}$
$$
\begin{CD}
A @>a>> B\\
@V b V V\# @VV c V\\
C @>>d> D
\end{CD}
$$交换图表2:
$$
\begin{CD}
A @>>> B @>{\text{very long label}}>> C \\
@. @AAA @| \\
D @= E @<<< F
\end{CD}
$$基本语法:
-
graph 指定流程图方向:
graph LR从左到右(left right)graph TD从上到下(top bottom)graph RL从右到左(right left)graph BT从下到上(bottom top)
-
元素的形状定义
id[描述]以直角矩形绘制id(描述)以圆角矩形绘制id{描述}以菱形绘制id>描述]以不对称矩形绘制id((描述))以圆形绘制
-
线条定义
A-->B带箭头指向A---B不带箭头连接A-.-B虚线连接A-.->B虚线指向A==>B加粗箭头指向A--描述---B不带箭头指向并在线段中间添加描述A--描述-->B带描述的箭头指向A-.描述.->B带描述的虚线连指向A==描述==>B带描述的加粗箭头指向
-
子流程图定义
subgraph title graph direction end
例:
```mermaid
graph LR
A(开始) -->B(起床)
B --天气不好--- C>干活]
C ==> D{休息时间到了}
D -.yes.-> E((休息))
D -.no.-> C
E --> F(吃饭)
subgraph one
F(吃饭)-->G(吃菜)-->H(夹菜)
endgraph LR
A(开始) -->B(起床)
B --天气不好--- C>干活]
C ==> D{休息时间到了}
D -.yes.-> E((休息))
D -.no.-> C
E --> F(吃饭)
subgraph one
F(吃饭)-->G(吃菜)-->H(夹菜)
end
基本语法:
-
定义模块
id=>关键字: 描述 (“描述”的前面必须有空格,“=>” 两端不能有空格) -
关键字:
- start 流程开始,以圆角矩形绘制
- opearation 操作,以直角矩形绘制
- condition 判断,以菱形绘制
- subroutine 子流程,以左右带空白框的矩形绘制
- inputoutput 输入输出,以平行四边形绘制
- end 流程结束,以圆角矩形绘制
-
定义模块间的流向:
-
模块1 id->模块2 id:一般的箭头指向 -
条件模块id (描述)->模块id(direction):条件模块跳转到对应的执行模块,并指定对应分支的布局方向
-
例:
```flow
st=>start: 开始框
op=>operation: 处理框
cond=>condition: 判断框(是或否?)
sub1=>subroutine: 子流程
io=>inputoutput: 输入输出框
e=>end: 结束框
st->op->cond
cond(yes)->io->e
cond(no)->sub1(right)->opst=>start: 开始框
op=>operation: 处理框
cond=>condition: 判断框(是或否?)
sub1=>subroutine: 子流程
io=>inputoutput: 输入输出框
e=>end: 结束框
st->op->cond
cond(yes)->io->e
cond(no)->sub1(right)->op
基本语法:
-
Title:标题:指定时序图的标题 -
Note direction of 对象:描述:在对象的某一侧添加描述,direction可以为right/left/over,对象可以是多个对象,以,作为分隔符 -
participant 对象:创建一个对象 -
loop...end:创建一个循环体 -
对象A->对象B:描述: 绘制A与B之间的对话,以实线连接线条:
->实线实心箭头指向-->虚线实心箭头指向->>实线小箭头指向-->>虚线小箭头指向
例:
```sequence
Title:时序图示例
客户端->服务端: 我想找你拿下数据 SYN
服务端-->客户端: 我收到你的请求啦 ACK+SYN
客户端->>服务端: 我收到你的确认啦,我们开始通信吧 ACK
Note right of 服务端: 我是一个服务端
Note left of 客户端: 我是一个客户端
Note over 服务端,客户端: TCP 三次握手
participant 观察者Title:时序图示例
客户端->服务端: 我想找你拿下数据 SYN
服务端-->客户端: 我收到你的请求啦 ACK+SYN
客户端->>服务端: 我收到你的确认啦,我们开始通信吧 ACK
Note right of 服务端: 我是一个服务端
Note left of 客户端: 我是一个客户端
Note over 服务端,客户端: TCP 三次握手
participant 观察者
基本语法同标准时序图,不同的是
-
需要使用
mermaid解析,并在开头使用关键字sequenceDiagram指明 -
线段的样式遵循
mermaid的解析方式:->: 实线连接-->:虚线连接->>:实线箭头指向-->>:虚线箭头指向
例:
```mermaid
sequenceDiagram
对象A->对象B:中午吃什么?
对象B->>对象A: 随便
loop 思考
对象A->对象A: 努力搜索
end
alt 选择1
对象A->>对象B: 选择1
else 选择2
对象A->>对象C: 选择2
end
opt 可选
对象A->>对象C: 可选项
end
par 并发
对象A->>对象A: 并发1
and
对象A->>对象B: 并发2
end
对象A-->>对象B: 火锅?
对象B->>对象A: 可以
Note left of 对象A: 我是一个对象A
Note right of 对象B: 我是一个对象B
participant 对象C
Note over 对象A,对象C: 汇总sequenceDiagram
对象A->对象B:中午吃什么?
对象B->>对象A: 随便
loop 思考
对象A->对象A: 努力搜索
end
alt 选择1
对象A->>对象B: 选择1
else 选择2
对象A->>对象C: 选择2
end
opt 可选
对象A->>对象C: 可选项
end
par 并发
对象A->>对象A: 并发1
and
对象A->>对象B: 并发2
end
对象A-->>对象B: 火锅?
对象B->>对象A: 可以
Note left of 对象A: 我是一个对象A
Note right of 对象B: 我是一个对象B
participant 对象C
Note over 对象A,对象C: 汇总
基本语法:
-
使用
mermaid解析语言,在开头使用关键字gantt指明 -
deteFormat 格式指明日期的显示格式 -
title 标题设置图标的标题 -
section 描述定义纵向上的一个环节 -
定义步骤:每个步骤有两种状态
done(已完成)/active(执行中)描述: 状态,id,开始日期,结束日期/持续时间描述: 状态[,id],after id2,持续时间crit:可用于标记该步骤需要被修正,将高亮显示- 如果不指定具体的开始时间或在某个步骤之后,将默认依次顺序排列
例:
```mermaid
gantt
dateFormat YYYY-MM-DD
title 软件开发甘特图
section 设计
需求:done,des1, 2019-01-06,2019-01-08
原型:active,des2, 2019-01-09, 3d
UI设计:des3, after des2, 5d
未来任务:des4, after des3, 5d
section 开发
学习准备理解需求:crit, done, 2019-01-06,24h
设计框架:crit, done, after des2, 2d
开发:crit, active, 3d
未来任务:crit, 5d
休息时间:2d
section 测试
功能测试:active, a1, after des3, 3d
压力测试:after a1, 20h
测试报告: 48hgantt
dateFormat YYYY-MM-DD
title 软件开发甘特图
section 设计
需求:done,des1, 2019-01-06,2019-01-08
原型:active,des2, 2019-01-09, 3d
UI设计:des3, after des2, 5d
未来任务:des4, after des3, 5d
section 开发
学习准备理解需求:crit, done, 2019-01-06,24h
设计框架:crit, done, after des2, 2d
开发:crit, active, 3d
未来任务:crit, 5d
休息时间:2d
section 测试
功能测试:active, a1, after des3, 3d
压力测试:after a1, 20h
测试报告: 48h
-
<|--继承 -
*__组合 -
o--聚合 -
-->关联 -
--连接(实线) -
..>依赖 -
..|>实现 -
..链接(虚线) -
<<interface>>接口 -
<<abstract>>抽象类 -
<<service>>服务类 -
<<enumeration>>枚举 -
class普通类 -
+public -
-private -
#protected -
$静态 -
不带符号表示 default
-
~包/内部类 -
类图的画法
- 抽象类的类名以及抽象方法的名字都用斜体字表示
- 接口在类图中的第一层顶端用构造型
<<interface>>表示,下面是接口的名字,第二层是方法
classDiagram
父类 <|-- 具体类
class 父类{
+public_func() bool
}
class 具体类{
~ package ~
+bool public_value
#int protected_value
-string private_value
+public_func() bool
#protected_func(num) int
-private_func(str) string
}classDiagram
父类 <|-- 具体类
class 父类{
+public_func() bool
}
class 具体类{
~ package ~
+bool public_value
#int protected_value
-string private_value
+public_func() bool
#protected_func(num) int
-private_func(str) string
}
classDiagram
class 抽象类{
<<abstract>>
~ package ~
+bool public_value
#int protected_value
-string private_value
+public_func() bool
#protected_func(num) int
-private_func(str) string
}classDiagram
class 抽象类{
<<abstract>>
~ package ~
+bool public_value
#int protected_value
-string private_value
+public_func() bool
#protected_func(num) int
-private_func(str) string
}
classDiagram
class 接口{
<<interface>>
~ package ~
+public_func() bool
#protected_func(num) int
-private_func(str) string
}classDiagram
class 接口{
<<interface>>
~ package ~
+public_func() bool
#protected_func(num) int
-private_func(str) string
}
classDiagram
class 枚举{
<<enumeration>>
ELEM1
ELEM2
ELEM3
}classDiagram
class 枚举{
<<enumeration>>
ELEM1
ELEM2
ELEM3
}
classDiagram
class 模版类~T~{
+List~T~ public_value
}
模版类 : -List~T~ private_value
模版类 : +public_func(List~T~ messages)classDiagram
class 模版类~T~{
+List~T~ public_value
}
模版类 : -List~T~ private_value
模版类 : +public_func(List~T~ messages)
classDiagram
classA --|> classB : Inheritance
classA1 o--|> classB1
classC --* classD : Composition
classE --o classF : Aggregation
classG --> classH : Association
classI -- classJ : Link(Solid)
classK ..> classL : Dependency
classM ..|> classN : Realization
classO .. classP : Link(Dashed)
classDiagram
classA --|> classB : Inheritance
classA1 o--|> classB1
classC --* classD : Composition
classE --o classF : Aggregation
classG --> classH : Association
classI -- classJ : Link(Solid)
classK ..> classL : Dependency
classM ..|> classN : Realization
classO .. classP : Link(Dashed)
classDiagram
Customer "1" --> "*" Ticket
Student "1" --> "1..*" Course
Galaxy --> "many" Star : ContainsclassDiagram
Customer "1" --> "*" Ticket
Student "1" --> "1..*" Course
Galaxy --> "many" Star : Contains
classDiagram
class Shape
<<interface>> ShapeclassDiagram
class Shape
<<interface>> Shape
pie
title Key elements in Product X
"Calcium" : 42.96
"Potassium" : 50.05
"Magnesium" : 10.01
"Iron" : 5pie
title Key elements in Product X
"Calcium" : 42.96
"Potassium" : 50.05
"Magnesium" : 10.01
"Iron" : 5
(需要安装vidtor)
{
"title" : {
"text": "简单的折线图",
"subtext": "纯属虚构"
},
"tooltip" : {
"trigger": "axis"
},
"toolbox": {
"show" : true,
"feature" : {
"mark" : {"show": true},
"dataView" : {"show": true, "readOnly": false},
"magicType" : {"show": true, "type": ["line", "bar"]},
"restore" : {"show": true},
"saveAsImage" : {"show": true}
}
},
"calculable" : true,
"xAxis": {
"type": "category",
"data": ["Mon", "Tue", "Wed", "Thu", "Fri", "Sat", "Sun"]
},
"yAxis": {
"type": "value"
},
"series": [{
"data": [820, 932, 901, 934, 1290, 1330, 1320],
"type": "line"
}]
}
stateDiagram-v2
%% 注释
%% 状态
s1: 状态
s1 --> s2: 状态转换
%% 状态转换
[*] --> s3: 初始状态转换到其它
%% 合成状态
合成状态1 --> 合成状态2
合成状态1 --> 合成状态3
state 合成状态1 {
[*] --> fir
fir --> [*]
}
state 合成状态2 {
[*] --> sec
sec --> [*]
}
state 合成状态3 {
[*] --> thi
thi --> [*]
}
%% 分支与组合
state 分支状态 <<fork>>
分支状态 --> stat2: 分支
分支状态 --> stat3: 分支
state 组合状态 <<join>>
stat2 --> 组合状态: 组合
stat3 --> 组合状态: 组合
%% 标记状态
stat5: 状态标记
note left of stat5: 标记在左边
%% 并发
state 多线程 {
[*] --> unlock1
unlock1 --> lock1
lock1 --> unlock1
--
[*] --> unlock2
unlock2 --> lock2
lock2 --> unlock2
--
[*] --> unlock3
unlock3 --> lock3
lock3 --> unlock3
}stateDiagram-v2
%% 注释
%% 状态
s1: 状态
s1 --> s2: 状态转换
%% 状态转换
[*] --> s3: 初始状态转换到其它
%% 合成状态
合成状态1 --> 合成状态2
合成状态1 --> 合成状态3
state 合成状态1 {
[*] --> fir
fir --> [*]
}
state 合成状态2 {
[*] --> sec
sec --> [*]
}
state 合成状态3 {
[*] --> thi
thi --> [*]
}
%% 分支与组合
state 分支状态 <<fork>>
分支状态 --> stat2: 分支
分支状态 --> stat3: 分支
state 组合状态 <<join>>
stat2 --> 组合状态: 组合
stat3 --> 组合状态: 组合
%% 标记状态
stat5: 状态标记
note left of stat5: 标记在左边
%% 并发
state 多线程 {
[*] --> unlock1
unlock1 --> lock1
lock1 --> unlock1
--
[*] --> unlock2
unlock2 --> lock2
lock2 --> unlock2
--
[*] --> unlock3
unlock3 --> lock3
lock3 --> unlock3
}
(typora等其他不支持graphviz的工具,可以使用这个网站:https://g.gravizo.com/svg 作为图床)

(如果工具如vnote等,支持graphviz,直接使用dot语法)
digraph demo { bgcolor="beige" node [shape="record", height=.1] node0[label=" | G | "] node1[label=" | E | "] node2[label=" | B | "] node0:f0 -> node1:f1 node0:f2 -> node2:f1 a [label="{a | b | c}"] }
- LATEX Mathematical Symbols
- Markdown: Syntax
- markdown 绘制流程图、时序图、甘特图
- 使用 Typora 画图(类图、流程图、时序图)
- Class diagrams
- markdown 由简入繁,上手跟我做(十)echarts 图表 - 折线(面积)图
- Markdown 中 LaTex 数学公式命令
- Cmd Markdown 公式指导手册
- Markdown 文件中绘制甘特图
- 一份 Markdown,输出中英双语两份文件
Footnotes
-
这里是脚注说明 ↩
