Markdown 基本要素
这篇文件意在简要介绍 GitHub Flavored Markdown 写作。
什么是 Markdown?
Markdown 是一种文本格式。你可以用它来控制文档的显示。使用 markdown,你可以创建粗体的文字,斜体的文字,添加图片,并且创建列表 等等。基本上来讲,Markdown 就是普通的文字加上 # 或者 * 等符号。
语法说明
标题
# 这是 <h1> 一级标题
## 这是 <h2> 二级标题
### 这是 <h3> 三级标题
#### 这是 <h4> 四级标题
##### 这是 <h5> 五级标题
###### 这是 <h6> 六级标题如果你想要给你的标题添加 id 或者 class,请在标题最后添加 {#id .class1 .class2}。例如:
# 这个标题拥有 1 个 id {#my_id}
# 这个标题有 2 个 classes {.class1 .class2}这是一个 MPE 扩展的特性。
强调
*这会是 斜体 的文字*_这会是 斜体 的文字_
**这会是 粗体 的文字**__这会是 粗体 的文字__
_你也 **组合** 这些符号_
~~这个文字将会被横线删除~~换行(特殊地方需要)
这是第一行。<br>这是第二行。列表
无序列表
- Item 1- Item 2 - Item 2a - Item 2b有序列表
1. Item 11. Item 21. Item 3 1. Item 3a 1. Item 3b添加图片
Format: 链接
https://github.com - 自动生成引用
正如 Kanye West 所说:
> We're living the future so> the present is our past.分割线
如下,三个或者更多的
---
连字符
---
星号
---
下划线行内代码
我觉得你应该在这里使用`<addr>` 才对。代码块
你可以在你的代码上面和下面添加 ``` 来表示代码块。
语法高亮
你可以给你的代码块添加任何一种语言的语法高亮
例如,给 ruby 代码添加语法高亮:
```rubyrequire 'redcarpet'markdown = Redcarpet.new("Hello World!")puts markdown.to_html```会得到下面的效果:
require 'redcarpet'markdown = Redcarpet.new("Hello World!")puts markdown.to_html代码块 class(MPE 扩展的特性)
你可以给你的代码块设置 class。
例如,添加 class1 class2 到一个 代码块:
```javascript {.class1 .class}function add(x, y) { return x + y}```代码行数
如果你想要你的代码块显示代码行数,只要添加 line-numbers class 就可以了。
例如:
```javascript {.line-numbers}function add(x, y) { return x + y}```将会得到下面的显示效果:

高亮代码行数
你可以通过添加 highlight 属性的方式来高亮代码行数:
```javascript {highlight=10}```
```javascript {highlight=10-20}```
```javascript {highlight=[1-10,15,20-22]}```任务列表
- [x] @mentions, #refs, [links](), **formatting**, and <del>tags</del> supported- [x] list syntax required (any unordered or ordered list supported)- [x] this is a complete item- [ ] this is an incomplete item表格
First Header | Second Header------------ | -------------Content from cell 1 | Content from cell 2Content in the first column | Content in the second column扩展的语法
表格
需要在插件设置中打开
enableExtendedTableSyntax选项来使其工作。

Emoji & Font-Awesome
只适用于
markdown-it parser而不适用于pandoc parser。
缺省下是启用的。你可以在插件设置里禁用此功能。
:smile::fa-car:上标
30^th^下标
H~2~O脚注
Content [^1]
[^1]: Hi! This is a footnote缩略
*[HTML]: Hyper Text Markup Language*[W3C]: World Wide Web ConsortiumThe HTML specificationis maintained by the W3C.标记
==marked==CriticMarkup
CriticMarkup 缺省是禁用的,你可以通过插件设置来启动它。
有关 CriticMarkup 的更多信息,请查看 CriticMarkup 用户指南.
这里有 5 种基本语法:
- 添加
{++ ++} - 删除
{-- --} - 替换
{~~ ~> ~~} - 注释
{>> <<} - 高亮
{== ==}{>> <<}
CriticMarkup 仅可用于 markdown-it parser,不与 pandoc parser 兼容。
Admonition
!!! note This is the admonition title This is the admonition body请在 https://squidfunk.github.io/mkdocs-material/reference/admonitions/ 查看更多信息
参考
发现错误或想要改进这篇文章?
在 GitHub 上编辑此页