Typora常用操作
折叠typora大纲
- mac上使用command+, 打开偏好设置,或者点击菜单栏 Typora-偏好设置
- 在外观配置中勾选大纲视图的折叠和展开
使用Typora画流程图
Typora支持的画图格式种类
-
mermaid 标准图形语言
- sequenceDiagram 时序图
- graph LR 横向流程图
- graph TD 纵向流程图
- stateDiagram 状态图
- classDiagram 类图
- gantt 甘特图
- pie 饼图
-
flow 流程图
-
sequence UML时序图
与mermaid相比,sequence可以创建没有连接的对象,箭头可以为实心也可以为空心,但不箭头不能缺失
-
graphviz图(不能直接支持,需要其他方法)
mermaid
sequenceDiagram 时序图
时序图元素
时序图主要有一下几个元素:角色,对象,生命线,激活器和消息
- 1、角色(Actor)
任何主体都可以是角色,角色对外发布消息。示例中,客户端,打印机,数据库都是角色。 - 2,对象(Object)
对象代表时序图中的对象在交互中所扮演的角色,位于时序图顶部和对象代表类角色。有的时候可能有多个打印机 ,那么这些打印机都是同一角色的不同对象 - 3,生命线(Lifeline)
生命线代表时序图中的对象在一段时期内的存在。时序图中每个对象和底部中心都有一条垂直的线,这就是对象的生命线,对象间 的消息存在于两条虚线间。 - 4,激活期(Activation)
激活期代表时序图中的对象执行一项操作的时期,在时序图中每条生命线上的窄的矩形代表活动期。它可以被理解成C语言语义中一对花括号“{}”中的内容。csdn的Markdown中并没有这一举行,只能以右侧或左侧的注解来表示“` python - 5,消息(Message)
消息是定义交互和协作中交换信息的类,用于对实体间的通信内容建模,信息用于在实体间传递信息。允许实体请求其他的服务,类角色通过发送和接受信息进行通信。
sequenceDiagram 是一种带样式的时序图
graph LR 横向流程图
graph LR 横向,graph TD 纵向
- 元素的形状定义:
- id[描述] 以直角矩形绘制
- id(描述) 以圆角矩形绘制
- id{描述} 以菱形绘制
- id>描述] 以不对称矩形绘制
- id((描述)) 以圆形绘制
- 线条定义:
- A
-->B
带箭头指向 - A
---B
不带箭头连接 - A
-.-B
虚线连接 - A
-.->B
虚线指向 - A
==>B
加粗箭头指向 - A
--
描述---B
不带箭头指向并在线段中间添加描述 - A
--
描述-->B
带描述的箭头指向 - A
-.
描述.->B
带描述的虚线连指向 - A
==
描述==>B
带描述的加粗箭头指向
- A
stateDiagram 状态图
第二版本:
classDiagram 类图
https://mermaid-js.github.io/mermaid/#/classDiagram
对类的注解,在单独行声明
<<interface>>
接口类<<abstract>>
抽象类<<service>>
服务类<<enumeration>>
枚举
类成员的可见性有四种:
-
- public
-
- private
-
protected
- ~ package/internal
行程图journey
描述都干了什么,干的好不好
gantt 甘特图
基本语法:
-
使用
mermaid
解析语言,在开头使用关键字gantt
指明 -
deteFormat
格式 指明日期的显示格式 -
title
标题 设置图标的标题 -
section
描述 定义纵向上的一个环节 -
定义步骤:每个步骤有两种状态done
(已完成)/active(执行中)- 描述: 状态,
id
,开始日期,结束日期/持续时间 - 描述: 状态
[,id],after id2
,持续时间 crit
:可用于标记该步骤需要被修正,将高亮显示- 如果不指定具体的开始时间或在某个步骤之后,将默认依次顺序排列
- 描述: 状态,
pie 饼图
注意数字后面不能有空格
数字支持两位小数,百分比是按照数字总量自动计算的
线上画图工具:https://mermaid-js.github.io/mermaid-live-editor
flow流程图
st=>start: 海信广告SDK
op1=>operation: 调用命令调用
e=>end: 承接apk
st->op1->e
完整示例:
start=>start: 开始
input=>inputoutput: 输入
operation=>operation: 操作
condition=>condition: 操作出错?
output=>inputoutput: 输出
error=>operation: 请重新输入
end=>end: 结束
start->input
input->operation
operation->condition
condition(no, bottom)->output
condition(yes)->error(top)->input
output->end
Hey Jude示例:
start=>start: Start
end=>end: End
heyJude=>operation: hey Jude
doNot=>operation: don't
makeItBad=>condition: make it bad
beAfraid=>condition: be afraid
letMeDown=>condition: let me down
takeASadSong=>operation: take a sad song and make it better
youWereMade=>operation: you were made to go out and get her
youHaveFound=>operation: you have found her, now go and get her
rememberTo=>operation: remember to
letHerInto=>condition: let her into your heart
letHerUnder=>operation: let her under your skin
thenYou=>operation: then you
canStart=>condition: can start
begin=>operation: begin
toMakeItBetter=>operation: to make it better
betterbetter=>operation: better better better better better waaaaa
na=>operation: na
start->heyJude->doNot->end
doNot->makeItBad
makeItBad(no)->beAfraid
makeItBad(yes)->takeASadSong
beAfraid(no)->letMeDown
beAfraid(yes)->youWereMade
letMeDown(yes)->youHaveFound
takeASadSong->rememberTo
youWereMade->rememberTo
youHaveFound->rememberTo
rememberTo->letHerInto
letHerInto(no)->letHerUnder
letHerInto(yes)->thenYou
letHerUnder->thenYou
thenYou->canStart
canStart(no)->begin
canStart(yes)->toMakeItBetter
begin->toMakeItBetter
toMakeItBetter->betterbetter
betterbetter->na
na->end
加入url的流程图:
st=>start: Start|past:>http://www.baidu.com
e=>end: End|future:>http://www.baidu.com
op1=>operation: My Operation
st->op1->e
sequence 时序图
-
Title
:标题 :指定时序图的标题 -
Note direction of
对象:描述 : 在对象的某一侧添加描述,direction
可以为right/left/over
, 对象 可以是多个对象,以 , 作为分隔符 -
participant
对象 :创建一个对象 -
loop...end
:创建一个循环体 -
对象A->对象B
:描述 : 绘制A与B之间的对话,以实线连接
->
实线实心箭头指向-->
虚线实心箭头指向->>
实线小箭头指向-->>
虚线小箭头指向
客户端->打印机: 打印请求(id)
打印机->数据库: 请求数据(id)
Note right of 数据库: 执行SQL获取数据
数据库-->打印机: 返回数据信息
Note right of 打印机:使用数据打印
打印机-->>客户端: 返回打印结果
客户端->客户端: 等待提取结果
graphviz 图
在typora中不能直接使用graphviz,需要转换成其他方式展示
1 在typora中嵌入在线方式的图
- 地址链接

- img标签
- 线上图片
- 本地svg图片
画图地址:
http://dreampuf.github.io/GraphvizOnline/
http://www.plantuml.com/plantuml/uml/SyfFKj2rKt3CoKnELR1Io4ZDoSa70000
typora的markdown文件转换成思维导图
图形转换工具:
将typora文件导出未opml文件,导入xmid或幕布,即可转换成思维导图
typora在文档中间添加锚点
同一文档中添加锚点 折叠 跳转只需要用#标识即可,不管几级标题都可以跳转,#与字符之间不需要空格
不同文档中添加锚点:
跳转到任意位置,使用a标签 a标签跳转