Markdown随手记

Markdown随手记

注1:Markdown实际上是不支持排版的,因此其中一些语法如文字居中等,借助的是HTML语法。

注2:插入目录

[T O C]

(去掉字母间的空格)

注3:用了这么久MD,觉得一个链接和一个技巧非常好:

链接:手写辨识。当你想不起来某个字符的代码时,可以手写识别。

技巧:3个空格,可以进入嵌套字块。例如我想在某个序号下引用:

+ 你好

> 她说。

+ 你好

   > 她说。
  • 你好

她说。

  • 你好

    她说。

显然后者是我们想要的。

注4:推荐强迫症患者和完美主义者使用VSCODE,求方便的使用Typora。

1. 代码段

1.1 简单代码

code上下两行为:'''。

test code1
test code2

1.2 大段代码

空行+4 blanks or Tab+ code

code1
code2

2. 块注释(block quote)

> test1
>
> test2

test1

test2

还可以嵌套:

> test main
>
>> test att
>
> test return

test main

test att

test return

3. 标题设置

# 一级标题
## 二级标题
### 三级标题
#### 四级标题
##### 五级标题
###### 六级标题

4. 字体

4.1 斜体

*test*
_test2_

test
test2

4.2 粗体

**test**
__test2__

test
test2

4.3 下划线

  • 方案1:行内 HTML

    <u>test</u>
    

test

  • 方案2:html的span标签、设置行内CSS的border-bottom属性

    <span style="border-bottom:2px dashed blue;">所添加的需要加下划线的行内文字</span>
    

所添加的需要加下划线的行内文字

4.4 中划线

~~test~~

test

4.5 居中

<center>
test
</center>
test

4.6 红色字体

<font color=#FF0000 face="黑体">test</font>

test

其他颜色参见网络。

4.7 分割线

___(3个"_"或减号"-")

5. 列表

5.1 有序列表

要加空格。

1. test

2. test2

3. test3
  1. test

  2. test2

  3. test3

5.2 无序列表

要加空格。建议一个文档只用一种方法。


* test*
+ test+
- test-
  • test*
  • test+
  • test-

5.3 勾选

- [ ] 不勾选
- [x] 勾选

6.1 内联

类似于超链接。

This is an [example link](http://example.com/)

This is an example link

6.2 引用

I get 10 times more traffic from [Google][1] than from [Yahoo][2] or [MSN][3].  

[1]: http://google.com/ "Google"
[2]: http://search.yahoo.com/ "Yahoo Search"
[3]: http://search.msn.com/ "MSN Search"

I get 10 times more traffic from Google than from Yahoo or MSN.

7. 图片

7.1 本地图片

内联

相对路径和绝对路径都可以。以下用相对路径。

![alt text](Figs/Markdown_1.jpg "Cup")

alt text

引用

![alt text][id]

[id]: Figs/Markdown_1.jpg "cup"

alt text

7.2 网络图片

![scenery](https://images2018.cnblogs.com/blog/1463534/201808/1463534-20180812144902519-1136918827.jpg "scenery")

scenery

7.3 图片格式

参见博客

最常用的:图片居中和按比例缩放:

<center>
<img src="https://images2018.cnblogs.com/blog/1463534/201808/1463534-20180812144902519-1136918827.jpg" width="50%" />
</center>

8. 脚注

hello[^ref 1]
test test
[^ref 1]: also 'hi'

hello^ref 1
test test

脚注在本文最后,有链接返回。【网页可能没有,导出pdf后有】

9. 表格

9.1 一般语法

Name  | Gender  | Age
--|--|-
Ryan  | Male    | 21
Cathy | Female  | 21
Name Gender Age
Ryan Male 21
Cathy Female 21

9.2 内容居中、靠左或靠右

-   默认左对齐
:-  左对齐
-:  右对齐
:-: 居中

-   代表宽度权重(单位比例),但有些编辑器不解析该语法,即所有列都一样宽。
Name  | Gender | Age
:--|:--:|-:
Ryan  | Male   | 21
Cathy | Female | 21
Name Gender Age
Ryan Male 21
Cathy Female 21

10. 公式

行内公式:
两个 $ 之间输入公式,即,$ mathjax公式 $
独占一行公式:
两两 $$ 间输入公式,即,$$ mathjax公式 $$
$$x^{y^z}=(1+{\rm e}^x)^{-2xy^w}$$

\[x^{y^z}=(1+{\rm e}^x)^{-2xy^w} \]

粗体:

$$\mathbf {test}$$

\[\mathbf {test} \]

黑板字:

$$\mathbb {test}$$

\[\mathbb {test} \]

粗斜体:

$$\boldsymbol {test}$$

\[\boldsymbol {test} \]

posted @ 2018-08-08 13:20  RyanXing  阅读(533)  评论(0编辑  收藏  举报