Markdown 初学总结

Markdown Tutorial(Typora-Specific)

1. Headers

最多可有六级标题,在标题前加 # 作为标记。注意标记与标题内容之间有空格:

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

显示如下:

这是一级标题

这是二级标题

这是三级标题

这是四级标题

这是五级标题
这是六级标题

2. 段落与换行

段内换行:

  1. 2空格加回车(Typora不可用),Typora使用 Shift + Enter 可实现换行。

  2. 使用br

    This is<br>
    paragraph one.
    And this is paragraph two.

    显示如下:

    This is
    paragraph one.

    And this is paragraph two.

段落:段与段间隔一个或多个空行,如下所示

This is Paragraph1

Here is Another

显示如下

This is Paragraph1

Here is Another

3. 引用(Blockquotes)

在行首使用 \> 标记,下一行不加 \> 也会继续引用:

> This is a comment
This is another comment

显示如下:

This is a comment
This is a comment too

多级引用:

> This is a comment
> This is another comment
> Blabla

显示如下:

This is a comment

This is another comment

Blablabla

4. 列表

无序列表

使用 -+* 作为标记(等价):

- use '-' as mark
+ or use '+' as mark
* or use '*' as mark

显示如下:

  • use '-' as mark

  • or use '+' as mark

  • or use '*' as mark

被嵌套的标目标记前加四个spaces或一个tab,可使用嵌套的列表:

+ 1
    + 2
        + 3

显示如下:

  • 1
    • 2
      • 3

有序列表

使用数字作为标记:

1. item1
2. item1
    1. item 2.1
    2. item 2.2
  1. item1
  2. item2
    1. item 2.1
    2. item 2.2

Task List

此为Markdown拓展语法,并不是所有浏览软件都能够支持。效果为生成一个可以勾选的列表:

- [ ] Eat
- [x] Code
  - [x] HTML
  - [x] CSS
  - [x] JavaScript
- [ ] Sleep

效果如下(Typora中的截图):

5. 分割线

使用三个或更多的 *+_ 绘制分割线:

***
+++
___

+++


也可以直接使用HTML标记 <hr>

6. 字体及文字标记

使用 *_ 包围文字是文字变为斜体,使用 **__ 包围文字实现黑体,二者可同时使用。成对使用二者并且需要显示原内容时,使用转义 \*\_

*This text will be italic*
_This will also be italic_

**This text will be bold**
__This will also be bold__

_You **can** combine them_

效果如下:

This text will be italic
This will also be italic

This text will be bold
This will also be bold

You can combine them

下划线、删除线

Markdown不支持此类标记原生语法,但可以使用由Github等提供的拓展的Markdown或者直接使用HTML提供的语法:

<u>Underlined Text</u>
~~DELETED~~

Underlined Text
DELETED

字体设置

在Markdown内使用HTML tag是可以接受的,通过设置 <font> 来进一步设置字体:

<font size="5" color="red">This is some text!</font>

This is some text!

7. 超链接

格式为 [link text](URL "Optional title") ,可用 '" 。例如:

[MyBlog](https://www.cnblogs.com/wyzersblog/ "ddkk64")
[icon.png](./images/icon.png)

MyBlog

[Google][]
这样可以使代码更加整洁
[Google]: http://google.com/

使用 <> 包括的 URL 或邮箱地址会被自动转换为超链接,会使用 URL 作为链接文字。

<http://example.com/>

http://example.com/

对于e-mail地址,Markdown会做一些随机编码处理以防止垃圾邮件机器人收集信息1

<[email protected]>

8. 图片

内联型语法

![Alt text](https://pic.cnblogs.com/avatar/1611794/20191201214317.png)
![Alt text](/path/to/img.jpg "Optional title")

icoin

引用型语法

![Alt text][id]
这样可以使代码更加整洁
[id]: url/to/image  "Optional title attribute"

icoin
这样可以使代码更加整洁

图片属性

标准markdown语法没有提供图片属性的修改,但可以使用HTML的 <img> 属性进行修改。

9. Latex数学公式输入

Markdown本身并不支持数学公式渲染生成 ,要在Markdown文档内使用数学公式,有但不限于以下几种选择:

  • 支持Latex公式输入的编辑器,如Typora等。本文就是在Typora中撰写。
  • 引用外链进行渲染,如GitHub上就需要用此方式

博客园Markdown支持Latex数学输入:

内联的公式 $\sin(\alpha+\beta)=\sin\alpha\cos\beta+\cos\alpha\sin\beta$

内联的公式 \(\sin(\alpha+\beta)=\sin\alpha\cos\beta+\cos\alpha\sin\beta\)

**(算数-均值不等式)**设$a_1,a_2,...,a_n$为正数,有
$$
\frac{n}{\sum_{k=1}^{n}\frac{1}{a_k}}  \le  \sqrt[n]{a_1a_2...a_n}  \le  \frac{1}{n}\sum_{k=1}^{n}a_k  \tag{1.1}
$$
当且仅当 $a_1=a_2=..=a_n$ 取等号。

(算数-均值不等式)\(a_1,a_2,...,a_n\)为正数,有
\[ \frac{n}{\sum_{k=1}^{n}\frac{1}{a_k}} \le \sqrt[n]{a_1a_2...a_n} \le \frac{1}{n}\sum_{k=1}^{n}a_k \tag{1.1} \]
当且仅当 \(a_1=a_2=..=a_n\) 取等号。

10. 表格

表格也属于拓展语法。

使用 | 来分隔不同的单元格,使用 - 来分隔表头和其他行:

First Header | Second Header
------------ | -------------
Content from cell 1 | Content from cell 2
Content in the first column | Content in the second column
First Header Second Header
Content from cell 1 Content from cell 2
Content in the first column Content in the second column1

11. 代码

//TODO


  1. 我用博客园的Markdown预览试了下,并没有发现任何的加密。

猜你喜欢

转载自www.cnblogs.com/wyzersblog/p/11968204.html