MarkDown

Markdown

简介

  • Markdown(标记向下)是一种轻量级标记语言,创始人为约翰·格鲁伯

  • Markdown使人们能使用纯文本的方式来控制文档的格式,简化并统一了文档的内容和形式。

  • 在AI中,Markdown格式让大模型的训练和用户输出的交换变得更加便捷。

语法

1. 标题

1
2
3
4
5
6
7
8
9
# 一级标题
## 二级标题
### 三级标题
#### 四级标题

一级标题
=======
二级标题
-------

2. 文本

1
2
3
4
5
6
7
**粗体**
_斜体_
<u>下划线</u>
~~删除线~~
<mark>高亮</mark>
`int i = 0;`
[超链接](http://www.github.com)

粗体

斜体

<u>下划线 </u>

删除线

<mark>高亮 </mark>

行内代码:int i = 0;

超链接

3. 列表

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
* 无序列表项1
* 无序列表项2
    - 子列表项1
    - 子列表项2

1. 有序列表项1
2. 有序列表项2

- [ ] 检查项1
- [ ] 检查项2 
  • 无序列表项 1

  • 无序列表项 2

    • 子列表项 1

    • 子列表项 2

  1. 有序列表项 1

  2. 有序列表项 2

  • 检查项 1

  • 检查项 2

4. 代码块

1
2
3
void main(void){
    print("hello world!");
}

5. 引用

1
> 引用内容

引用内容

6. 表格

1
2
3
4
5
|列1  | 左对齐列  |中间对齐列:|右对齐列:|
|-----|:--------|:--------:|--------:|
| 1   |  left   |   center |  right  |
| 2   |     |    |    |
| 3   |     |    |    |
列 1左对齐列中间对齐列右对齐列
1leftcenterright
2
3

7. 图片

1
![图片](https://imagesbytk.com/product_images/uploaded_images/early-morning-sunrise-shiprock-new-mexico-update.jpg "图片提示")

图片◎ 图片提示

8. 超链接

这是一个链接

这是一个带tip链接

这使一个站内链接

1
2
3
这是一个[超链接](https://markdown.com.cn)
这是一个[带tip的超链接](https://markdown.com.cn "最好的markdown教程")
这使一个[站内链接](./markdown.md)

9. 图形

流程图

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
graph LR
  st=>start: Start|past
  e=>end: End|future
  op1=>operation: My Operation|past
  op2=>operation: Stuff|current
  sub1=>subroutine: My Subroutine|invalid
  cond=>condition: Yes or No?|approved:>http://www.google.com
  c2=>condition: Good idea|rejected
  io=>inputoutput: catch something...|future

  st->op1(right)->cond
  cond(yes, right)->c2
  cond(no)->sub1(left)->op1
  c2(yes)->io->e
  c2(no)->op2->e

流程图 2

1
2
3
4
5
graph TD;
    A-->B;
    A-->C;
    B-->D;
    C-->D;

甘特图

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
gantt
dateFormat  YYYY-MM-DD
title Adding GANTT diagram to mermaid
excludes weekdays 2014-01-10

section A section
Completed task            :done,    des1, 2014-01-06,2014-01-08
Active task               :active,  des2, 2014-01-09, 3d
Future task               :         des3, after des2, 5d
Future task2               :         des4, after des3, 5d

类图

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
classDiagram
Class01 <|-- AveryLongClass : Cool
Class03 *-- Class04
Class05 o-- Class06
Class07 .. Class08
Class09 --> C2 : Where am i?
Class09 --* C3
Class09 --|> Class07
Class07 : equals()
Class07 : Object[] elementData
Class01 : size()
Class01 : int chimp
Class01 : int gorilla
Class08 <--> C2: Cool label

实体关系图

1
2
3
4
erDiagram
    CUSTOMER ||--o{ ORDER : places
    ORDER ||--|{ LINE-ITEM : contains
    CUSTOMER }|..|{ DELIVERY-ADDRESS : uses

时序图

1
2
3
4
5
sequenceDiagram
    participant Executor
    participant Reactor
    activate Executor
    Executor->>Reactor: Pending Future

10. 数学公式

1
2
3
4
5
6
行内公式: $ a = x^2 $

公式块:
$$
\int_0^{\infty} \frac{1}{x}\, dx
$$
  • 行内数学公式:$a=x^2$

  • 向量

$$ \begin{matrix} x^2 & a_H \
\frac{1}{2} & d^2 \end{matrix} $$

  • 微积分

$$ \int_0^{\infty} \frac{1}{x}, dx $$

  • 行列式

$$ \overrightarrow{\mathbf{x}} = \left[ \begin{array} {c} {x_{1}} \
{x_{2}} \
{\vdots} \
{x_{n}} \end{array} \right] $$

11.内嵌HTML

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
This **word** is bold. This <em>word</em> is italic.

This is a regular paragraph.

<table>
    <tr>
        <td>Foo</td>
    </tr>
</table>

This is another regular paragraph.

This word is bold. This word is italic.

This is a regular paragraph.

Foo

This is another regular paragraph.

参考

  1. Markdown 内嵌 HTML 标签 | Markdown 教程
  2. Markdown - 维基百科,自由的百科全书