Markdown语法

Markdown

基本语法

支持 CommonMark​ 所有语法

参考 CommonMark Spec

标题段落

1
2
3
4
5
6
# 一级标题
## 二级标题
### 三级标题
#### 四级标题
##### 五级标题
###### 六级标题

空一行分段落

1
2
3
4
5
Paragraphs are separated
by a blank line.

Two spaces at the end of a line
produces a line break.
  • 分割线
---
***


  • 引用
1
> 冬天到了,春天还会远吗?

冬天到了,春天还会远吗?

文字效果

*斜体*	斜体的内容
**粗体**	粗体的内容
***斜体+粗体***	斜体+粗体内容
~~删除线~~	删除线
Lorem ipsum dolor <kbd>CTRL</kbd> + <kbd>C</kbd>

斜体 斜体的内容

粗体 粗体的内容

斜体 + 粗体 斜体 + 粗体内容

删除线 删除线

Lorem ipsum dolor CTRL + C

列表

  • 无序列表:
* fruit
    * apples
    * oranges
    * pears

或者:
- fruit
    - apples
    - oranges
    - pears

或者:
+ fruit
    + apples
    + oranges
    + pears  

效果:

  • fruit

    • apples
    • oranges
    • pears

或者:

  • fruit

    • apples
    • oranges
    • pears

或者:

  • fruit

    • apples
    • oranges
    • pears
  • 有序列表:

1. lather
2. rinse
3. repeat

效果:

  1. lather
  2. rinse
  3. repeat
  • 任务列表:
- [x] Checked task item
- [x] Another checked task item
- [ ] Unchecked task item

效果:

  • Checked task item
  • Another checked task item
  • Unchecked task item

超链接

分为三种跳转类型:

  • 跳转到外部链接
  • 跳转到系统内其他页面
  • 本页面内部跳转

格式如下 ​[显示名称](地址 "鼠标移动到链接时的提示信息")

外部链接

1
[百度](https://www.baidu.com "百度搜索")

效果如下: 百度

跳转到系统内其他页面

1
[华为备份流程](/posts/华为备份流程)

效果如下:

华为备份流程

本页面内部跳转

支持

  • 小标题跳转
  • 任意位置跳转
小标题跳转

支持跳转到 #​号开头的标题

#​号开头

1
2
3
[普通标题](#普通标题)
[带 空格 标题](#带-空格-标题)
[222数字开头标题](#h-222数字开头标题)

效果: 普通标题 带 空格 标题 222数字开头标题

任意位置跳转

待跳转的地方用 span​包裹,通过 id​进行跳转

1
<span id="jump_markdown">Markdown</span>

链接:

1
[任意位置跳转](#jump_markdown)

效果:

任意位置跳转

普通标题

普通小标题,链接时 #​号后面直接填写标题

带 空格 标题

标题带空格,链接时 #​号后面 ​ ​​替换成 -

222 数字开头标题

数字开头的标题,链接时 #​号后面添加 h-

任意跳转示例:Markdown 是一个 Web 上使用的文本到 HTML 的转换工具,可以通过简单、易读易写的文本格式生成结构化的 HTML 文档。目前 Stackoverflow 网站使用这种格式来提问。

代码

1
2
3
4
5
6
7
单行代码
`print('Hello world!')` 

多行代码
‍‍‍‍```python
w = 'Hello word!'
print(w)

单行代码 print('Hello world!')

多行代码

1
2
w = 'Hello word!'
print(w)

表格

1
2
3
4
5
6
7

下边四列分别是默认,左对齐、居中、右对齐:

| Syntax1     | Syntax      | Description | Test Text     |
| ---         | :---        |    :----:   |          ---: |
| Header1     | Header      | Title       | Here's this   |
| Paragraph1  | Paragraph   | Text        | And more      |

效果:

Syntax1SyntaxDescriptionTest Text
Header1HeaderTitleHere’s this
Paragraph1ParagraphTextAnd more

图片

1
2
3
4
5
6
7
![图片名](图片文件路径)

![alt](/file/pic/2019/filename.jpg "title")
![Image](https://www.baidu.com/img/baidu_logo.gif =100x50)
![Image](https://www.baidu.com/img/baidu_logo.gif =100x)
![Image](https://www.baidu.com/img/baidu_logo.gif =x50)
![Image](https://www.baidu.com/img/baidu_logo.gif =100%x)

效果:

LOGO

Emoji

:apple:

Can be also be used :fire: inline

效果:

🍎

Can be also be used 🔥 inline

其他支持

提示信息

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
> Lorem ipsum dolor sit amet

> Consectetur adipiscing elit
{.is-info}

> Consectetur adipiscing elit
{.is-success}

> Consectetur adipiscing elit
{.is-warning}

> Consectetur adipiscing elit
{.is-danger}

效果:

Lorem ipsum dolor sit amet

Consectetur adipiscing elit {.is-info}

Consectetur adipiscing elit {.is-success}

Consectetur adipiscing elit {.is-warning}

Consectetur adipiscing elit {.is-danger}

列表

  • 有序列表
1
2
3
1. Lorem ipsum dolor sit amet
1. Consectetur adipiscing elit
1. Morbi vehicula aliquam

效果:

  1. Lorem ipsum dolor sit amet
  2. Consectetur adipiscing elit
  3. Morbi vehicula aliquam
  • 无序列表
- Grid Item 1
- Grid Item 2
- Grid Item 3
{.grid-list}


- [Lorem ipsum dolor sit amet *Subtitle description here*](https://www.google.com)
- [Consectetur adipiscing elit *Another subtitle description here*](https://www.google.com)
- [Morbi vehicula aliquam *Third subtitle description here*](https://www.google.com)
{.links-list}

效果:

  • Grid Item 1
  • Grid Item 2
  • Grid Item 3 {.grid-list}

Superscript

Lorem ^ipsum^ dolor

效果:

Lorem ^ipsum^ dolor

Mermaid Diagrams

Mermaid语法

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
``mermaid
sequenceDiagram
    Alice ->> Bob: Hello Bob, how are you?
    Bob-->>John: How about you John?
    Bob--x Alice: I am good thanks!
    Bob-x John: I am good thanks!
    Note right of John: Bob thinks a long<br/>long time, so long<br/>that the text does<br/>not fit on a row.

    Bob-->Alice: Checking with John...
    Alice->John: Yes... John, how are you?
``

效果:

PlanutUML

PlantUML语法

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36

``plantuml
@startuml

package "Some Group" {
  HTTP - [First Component]
  [Another Component]
}

node "Other Groups" {
  FTP - [Second Component]
  [First Component] --> FTP
}

cloud {
  [Example 1]
}


database "MySql" {
  folder "This is my folder" {
    [Folder 3]
  }
  frame "Foo" {
    [Frame 4]
  }
}


[Another Component] --> [Example 1]
[Example 1] --> [Folder 3]
[Folder 3] --> [Frame 4]

@enduml

``
@startuml

package "Some Group" {
  HTTP - [First Component]
  [Another Component]
}

node "Other Groups" {
  FTP - [Second Component]
  [First Component] --> FTP
}

cloud {
  [Example 1]
}


database "MySql" {
  folder "This is my folder" {
    [Folder 3]
  }
  frame "Foo" {
    [Frame 4]
  }
}


[Another Component] --> [Example 1]
[Example 1] --> [Folder 3]
[Folder 3] --> [Frame 4]

@enduml

Shortcut

测试 admonition

注意

​ 一个 注意 横幅

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
public int executeBackupTask(int sessionId, String taskCmd) throws InstallerExceptionEx {
    try {
        if (this.mInstaller != null) {
            return this.mInstaller.executeBackupTask(sessionId, taskCmd);
        }
        return -1;
    } catch (Installer.InstallerException e) {
        throw new InstallerExceptionEx(e.getMessage());
    }
}

一个 注意 横幅一个​ ​注意​ 横幅一​**意​​ 横幅一个 ​​意** ==横幅==

摘要
​ 一个 摘要 横幅 ​
​/

信息
​ 一个 信息 横幅 ​

技巧
​ 一个 技巧 横幅 ​

成功
​ 一个 成功 横幅 ​

问题
​ 一个 问题 横幅 ​

警告
​ 一个 警告 横幅 ​
​/

失败
​ 一个 失败 横幅 ​

危险
​ 一个 危险 横幅 ​

Bug
​ 一个 Bug 横幅 ​

示例
​ 一个 示例 横幅 ​

引用
​ 一个 引用 横幅 ​

打字机效果

段落

代码

center-quote

hello world

this is a center-quote shortcode example. ​

0%