note(便签, Note [right of | left of | over] [participant])
Note right of John: Foo12345
Note left of Alice: An note
Note over Alice,John: Cross the world
loop(循环)
alt(分支,选择,相当于 if else )
opt(可选,相当于 if)
sequenceDiagram
participant John
participant A as Alice
A ->> John : Hi,John
Note left of John: Foo12345
John -->> A: Alice..I
Note right of A : An note
activate A
A ->>+ John : 1
John -->> A : 2
deactivate A
A -x- John : 3
John --x A :4
loop Every 30 seconds
John -->> A : heart bits
A -->> John : ACK
end
A ->> John : Are you ok?
alt is ok
John -->>A: Ok啊
else so so
John -->>A: 还活着
else
John -->>A: 还不错
end
Note over A, John: Over!
sequenceDiagram
participant John
participant A as Alice
A ->> John : Hi,John
Note left of John: Foo12345
John -->> A: Alice..I
Note right of A : An note
activate A
A ->>+ John : 1
John -->> A : 2
deactivate A
A -x- John : 3
John --x A :4
loop Every 30 seconds
John -->> A : 还在么?(heart bits)
alt is ok
A ->> John : 在呢,我还在,莫担心
else 没反应
John -->> John : Alice is lose,释放他的资源
end
end
A ->> John : Are you ok?
alt is ok
John -->>A: Ok啊
else so so
John -->>A: 还活着
else
John -->>A: 还不错
end
opt 心情好
A -->> Tom : 出来撸串
end
Note over A, John: Over!
graph TB
c1-->a2
subgraph one
a1-->a2
end
subgraph two
b1-->b2
end
subgraph three
c1-->c2
end
graph LR
A1 --> B1
A2 --- B2
C --text in the link --- B3
D ---|text_on_link| B4
E -->|text| B5
F -.-> B6
F -.->|text in line| Te
H -.->|text| Note
N1 ==>|text| N3
Node["dd#quot\;"]
Node1["#quot;A dec char:#9829;"]
Node === Node1
graph TB
c1-->a2
subgraph one
a1-->a2
end
subgraph two
b1-->b2
end
subgraph three
c1-->c2
end
graph TB
c1-->a2
subgraph one
a1-->a2
end
subgraph two
b1-->b2
end
subgraph three
c1-->c2
end
graph LR
A1 --> B1
A2 --- B2
C --text in the link --- B3
D ---|text_on_link| B4
E -->|text| B5
F -.-> B6
F -.->|text in line| Te
H -.->|text| Note
N1 ==>|text| N3
Node["dd#quot\;"]
Node1["#quot;A dec char:#9829;"]
Node === Node1
graph TB
c1-->a2
subgraph one
a1-->a2
end
subgraph two
b1-->b2
end
subgraph three
c1-->c2
end
call vundle#begin()
......
Plugin 'previm/previm' " 添加到vundle的调用之间
......
call vundle#end()
......
let g:previm_open_cmd = 'google-chrome -a' " 用chrome预览
" let g:previm_open_cmd = 'firefox -a' " 用firefox预览
" 为了避免.md被理解为modula2文件,添加以下说明
augroup PrevimSettings
autocmd!
autocmd BufNewFile,BufRead *.{md,mdwn,mkd,mkdn,mark*} set filetype=markdown
augroup END
一点小改动
文档上的previm_open_cmd不合适,需要改成如上
:h g:previm_open_cmd
# open by FireFox
let g:previm_open_cmd = 'open -a Firefox'
# open with Google Chrome
let g:previm_open_cmd = 'open -a Google\ Chrome'
使用
编辑一个md文档,需要预览文件时,输入:PrevimOpen 打开浏览器预览
修改文件后,预览文件会动态更新
对mermaid的支持
sequenceDiagram
participant Alice
participant Bob
Alice->>John: Hello John, how are you?
loop Healthcheck
John->>John: Fight against hypochondria
end
Note right of John: Rational thoughts<br/>prevail...
John-->>Alice: Great!
John->>Bob: How about you?
Bob-->>John: Jolly good!