Markdown
Markdown
数学公式 LaTeX
网站工具:https://latex.codecogs.com/eqneditor/editor.php
数学公式 LaTeX
行内数学公式:Typora要在偏好设置里开启内联公式(建议同时开启上标、下标、高亮)
基本算式
| 作用 | 符号 | 算式 | markdown |
|---|---|---|---|
| 分数 | \frac | \frac | |
| 下标 | _ | z=z_l | |
| 上标、求方 | ^ | \frac | |
| 开方 | \sqrt{2};\sqrt[n] | ||
| e求方 | e{} | \frac{d}{dx}e{ax}=ae\quad \sum_{i=1}^{n}{(X_i - \overline{X})^2} | |
| 顶线 | \overline | ||
| 矢量 | \vec{} | \vec{a} \cdot \vec{b}=0 | |
| 点乘 | \cdot | \vec{a} \cdot \vec{b}=0 | |
| 省略号 | \cdots | \cdots | |
| 积分 | \int | \int ^2_3 x^2 {\rm d}x | |
| 微元符号 | {\rm d} | \int ^2_3 x^2 {\rm d}x | |
| 求极限 | lim_ | limn→+∞nlimn→+∞n \lim_{n\rightarrow+\infty} n | |
| 右箭头 | \rightarrow | ||
| 无限 | \infty | ||
| 求和符号 | \sum | \sum \frac | |
| 小于等于 | \leq | ||
| 大于等于 | \leqslant |
三角函数
| 算式 | markdown |
|---|---|
| \sin |
对数函数
| 算式 | markdown |
|---|---|
| \ln15 | |
| \log_2 10 | |
| \lg7 |
关系运算符
| 运算符 | markdown |
|---|---|
| \pm;\mp | |
| \times | |
| \div | |
| \sum | |
| \prod | |
| \neq;\not= | |
| \leq;\geq | |
| \bigcap |
希腊字母
| 大写 | markdown | 小写 | markdown |
|---|---|---|---|
| A | \alpha | ||
| B | \beta | ||
| \Gamma | \gamma | ||
| \Delta | \delta | ||
| E | \epsilon | ||
| \varepsilon | |||
| Z | \zeta | ||
| \Theta | \theta | ||
| I | \iota | ||
| K | \kappa | ||
| \Lambda | \lambda | ||
| M | \mu | ||
| N | \nu | ||
| \Xi | \xi | ||
| O | \omicron | ||
| \Pi | \pi | ||
| P | \rho | ||
| \Sigma | \sigma | ||
| N | \nu | ||
| T | \tau | ||
| \Upsilon | \upsilon | ||
| \Phi | \phi | ||
| \varphi | |||
| X | \chi | ||
| \Psi | \psi | ||
| \Omega | \omega |
Mermaid
参考:
Mermaid[1] 是一种简单的类似 Markdown 的脚本语言,通过 JavaScript 编程语言,将文本转换为图片。因此,真正实现画图功能的并不是 Typora 本身,它只是内置了对 Mermaid 的支持。
打印版本
输入 info 就行(其实Typora里报错会直接显示版本,但在Obsidian不行)
流程图
时序图
状态图
类图
甘特图
饼图
画流程图(旧版,新版见上)
详见Mermaid,不知道是不是更新了,早期好像不能画类图这种,现在很多类型了
流程图 - mermaid
方向
【T:Top,B:Bottom,R:Right,L:Left】
TB 从上到下
BT 从下到上(TD同TB)
LR 从左到右
RL 从右到左示例
图形
id + [文字描述]矩形
id + (文字描述)圆角矩形
id + >文字描述]不对称的矩形
id + {文字描述}菱形
id + ((文字描述))圆形效果
连接线与标注
A --> B A带箭头指向B
A --- B A不带箭头指向B
A -.- B A用虚线指向B
A -.-> B A用带箭头的虚线指向B
A ==> B A用加粗的箭头指向B
A -- 描述 --- B A不带箭头指向B并在中间加上文字描述
A -- 描述 --> B A带箭头指向B并在中间加上文字描述
A -. 描述 .-> B A用带箭头的虚线指向B并在中间加上文字描述
A == 描述 ==> B A用加粗的箭头指向B并在中间加上文字描述效果
子流程图
subgraph title
graph definition
end效果
自定义样式
语法:style id 具体样式效果
标准流程图 - flow
竖向
st=>start: 开始框
op=>operation: 处理框
cond=>condition: 判断框(是或否?)
sub1=>subroutine: 子流程
io=>inputoutput: 输入输出框
e=>end: 结束框
st->op->cond
cond(yes)->io->e
cond(no)->sub1(right)->op横向
st=>start: 开始框
op=>operation: 处理框
cond=>condition: 判断框(是或否?)
sub1=>subroutine: 子流程
io=>inputoutput: 输入输出框
e=>end: 结束框
st(right)->op(right)->cond
cond(yes)->io(bottom)->e
cond(no)->sub1(right)->opUML时序图 - sequence
实例(部分)
UML图在线渲染 —— plantUML by Gravize
HTML相关
CVG画函数图像
SVG生成方法
首先用Mathematica/Matlab绘图并导出 SVG
Plot[Sin[x], {x, -4, 4}, PlotPoints -> 2] Export["sin.svg", %]接下来使用 svgo 做一下压缩:
svgo --pretty sin.svg得到的代码直接复制进来即可
示例图像
R代码画图(Rmarkdown软件)
可以直接把R代码和执行结果复制进文档里
CSS拓展
自定义CSS样式方法
创建base.user.css
主题文件配置
文件 > 偏好设置 > 打开主题文件夹 > 将CSS文件放到打开的目录中 > 重启Typora
自动编号功能
版本1
/* 正文标题区: #write */
/* [TOC]目录树区: .md-toc-content */
/* 侧边栏的目录大纲区: .sidebar-content */
/**
* 说明:
* Typora的标题共有6级,从h1到h6。
* 我个人觉得h1级的标题太大,所以我的标题都是从h2级开始。
* 个人习惯每篇文章都有一个总标题,有一个目录,所以h2级的标题前两个都不会计数。
* 一般情况下,我虽然不使用h1级的标题,但是为了以防万一,h1级的标题前两个也都不会计数。
* 若想启用h1级标题,就取消包含“content: counter(h1) "."”项的注释,然后将包含“content: counter(h2) "."”的项注释掉即可。
*/
/** initialize css counter */
#write, .sidebar-content,.md-toc-content{
/* 设置全局计数器的基准 */
/* 因为我喜欢从h2级标题用起,所以这里设置为h2 */
counter-reset: h2
}
#write h1, .outline-h1, .md-toc-item.md-toc-h1 {
counter-reset: h2
}
#write h2, .outline-h2, .md-toc-item.md-toc-h2 {
counter-reset: h3
}
#write h3, .outline-h3, .md-toc-item.md-toc-h3 {
counter-reset: h4
}
#write h4, .outline-h4, .md-toc-item.md-toc-h4 {
counter-reset: h5
}
#write h5, .outline-h5, .md-toc-item.md-toc-h5 {
counter-reset: h6
}
/** put counter result into headings */
#write h1:before,
.outline-h1>.outline-item>.outline-label:before,
.md-toc-item.md-toc-h1>.md-toc-inner:before {
counter-increment: h1;
content: counter(h1) ". "
}
/* 使用h1标题时,去掉前两个h1标题的序号,包括正文标题、目录树和大纲 */
/* nth-of-type中的数字表示获取第几个h1元素,请根据情况自行修改。 */
#write h1:nth-of-type(1):before,
.outline-h1:nth-of-type(1)>.outline-item>.outline-label:before,
.md-toc-item.md-toc-h1:nth-of-type(1)>.md-toc-inner:before,
#write h1:nth-of-type(2):before,
.outline-h1:nth-of-type(2)>.outline-item>.outline-label:before,
.md-toc-item.md-toc-h1:nth-of-type(2)>.md-toc-inner:before{
counter-reset: h1;
content: ""
}
#write h2:before,
.outline-h2>.outline-item>.outline-label:before,
.md-toc-item.md-toc-h2>.md-toc-inner:before {
counter-increment: h2;
content: counter(h2) ". "
}
/* 使用h2标题时,去掉前两个h2标题的序号,包括正文标题、目录树和大纲 */
/* nth-of-type中的数字表示获取第几个h2元素,请根据情况自行修改。 */
#write h2:nth-of-type(1):before,
.outline-h2:nth-of-type(1)>.outline-item>.outline-label:before,
.md-toc-item.md-toc-h2:nth-of-type(1)>.md-toc-inner:before,
#write h2:nth-of-type(2):before,
.outline-h2:nth-of-type(2)>.outline-item>.outline-label:before,
.md-toc-item.md-toc-h2:nth-of-type(2)>.md-toc-inner:before{
counter-reset: h2;
content: ""
}
#write h3:before,
h3.md-focus.md-heading:before, /** override the default style for focused headings */
.outline-h3>.outline-item>.outline-label:before,
.md-toc-item.md-toc-h3>.md-toc-inner:before {
text-decoration: none;
counter-increment: h3;
/* content: counter(h1) "." counter(h2) "." counter(h3) ". " */
content: counter(h2) "." counter(h3) ". "
}
#write h4:before,
h4.md-focus.md-heading:before,
.outline-h4>.outline-item>.outline-label:before,
.md-toc-item.md-toc-h4>.md-toc-inner:before {
text-decoration: none;
counter-increment: h4;
/* content: counter(h1) "." counter(h2) "." counter(h3) "." counter(h4) ". " */
content: counter(h2) "." counter(h3) "." counter(h4) ". "
}
#write h5:before,
h5.md-focus.md-heading:before,
.outline-h5>.outline-item>.outline-label:before,
.md-toc-item.md-toc-h5>.md-toc-inner:before {
text-decoration: none;
counter-increment: h5;
/* content: counter(h1) "." counter(h2) "." counter(h3) "." counter(h4) "." counter(h5) ". " */
content: counter(h2) "." counter(h3) "." counter(h4) "." counter(h5) ". "
}
#write h6:before,
h6.md-focus.md-heading:before,
.outline-h6>.outline-item>.outline-label:before,
.md-toc-item.md-toc-h6>.md-toc-inner:before {
text-decoration: none;
counter-increment: h6;
/* content: counter(h1) "." counter(h2) "." counter(h3) "." counter(h4) "." counter(h5) "." counter(h6) ". " */
content: counter(h2) "." counter(h3) "." counter(h4) "." counter(h5) "." counter(h6) ". "
}
/** override the default style for focused headings */
#write>h3.md-focus:before,
#write>h4.md-focus:before,
#write>h5.md-focus:before,
#write>h6.md-focus:before,
h3.md-focus:before,
h4.md-focus:before,
h5.md-focus:before,
h6.md-focus:before {
color: inherit;
border: inherit;
border-radius: inherit;
position: inherit;
left:initial;
float: none;
top:initial;
font-size: inherit;
padding-left: inherit;
padding-right: inherit;
vertical-align: inherit;
font-weight: inherit;
line-height: inherit;
}版本2
/** initialize css counter */
#write {
counter-reset: h1
}
h1 {
counter-reset: h2
}
h2 {
counter-reset: h3
}
h3 {
counter-reset: h4
}
h4 {
counter-reset: h5
}
h5 {
counter-reset: h6
}
/** put counter result into headings */
#write h1:before {
counter-increment: h1;
content: counter(h1) ". "
}
#write h2:before {
counter-increment: h2;
content: counter(h1) "." counter(h2) ". "
}
#write h3:before,
h3.md-focus.md-heading:before /** override the default style for focused headings */ {
counter-increment: h3;
content: counter(h1) "." counter(h2) "." counter(h3) ". "
}
#write h4:before,
h4.md-focus.md-heading:before {
counter-increment: h4;
content: counter(h1) "." counter(h2) "." counter(h3) "." counter(h4) ". "
}
#write h5:before,
h5.md-focus.md-heading:before {
counter-increment: h5;
content: counter(h1) "." counter(h2) "." counter(h3) "." counter(h4) "." counter(h5) ". "}
#write h6:before,
h6.md-focus.md-heading:before {
counter-increment: h6;
content: counter(h1) "." counter(h2) "." counter(h3) "." counter(h4) "." counter(h5) "." counter(h6) ".
"}
/** override the default style for focused headings */
#write>h3.md-focus:before,
#write>h4.md-focus:before,
#write>h5.md-focus:before,
#write>h6.md-focus:before,
h3.md-focus:before,
h4.md-focus:before,
h5.md-focus:before,
h6.md-focus:before {
color: inherit;
border: inherit;
border-radius: inherit;
position: inherit;
left:initial;
float: none;
top:initial;
font-size: inherit;
padding-left: inherit;
padding-right: inherit;
vertical-align: inherit;
font-weight: inherit;
line-height: inherit;
}MyDiyCSS
- 在该.md文件的文件夹下有备份的css文件
- 在md文件夹下也有
仿mermaid流程图即时解析画UML新方案
比如
graph TB
class Moveable(接口) A
move()
class Car(类) B
move()
class Car2(代理类) C
super.move()
class Car3(代理类) D
car.move()
B t--实现--> A l--实现--> D
B --组合--r> D
C t--继承--r> B注意:空格是重要关键字
代码块语法高亮原理和自定义风格
CodeMirror
链接到当前文件 0
没有文件链接到当前文件