什么是 Markdown
Markdown 是一种轻量级标记语言,用于格式化文本内容。它通过简单的标记符号(如 #
和 *
)来控制文本的显示方式,例如加粗、斜体、插入图片或创建列表等。
语法指南
以下是常见 Markdown 语法的总结,适用于 GitHub 或任何支持 Markdown 的平台。
标题
# This is a h1 tag
## This is a h2 tag
#### This is a h4 tag
This is a h1 tag
This is a h2 tag
This is a h4 tag
强调文本
你可以通过 _
或 **
来使文本斜体或加粗:
_This text will be italic_
**This text will be bold**
_You **can** combine them_
This text will be italic
This text will be bold
You can combine them
列表
无序列表
- Item 1
- Item 2
- Item 2a
- Item 2b
- Item 1
- Item 2
- Item 2a
- Item 2b
有序列表
1. Item 1
1. Item 2
1. Item 3
1. Item 3a
1. Item 3b
- Item 1
- Item 2
- Item 3
- Item 3a
- Item 3b
插入图片
使用 
格式插入图片:

超链接
插入链接时可以使用纯 URL 或 Markdown 链接格式:
http://github.com - automatic!
[GitHub](http://github.com)
http://github.com - automatic! GitHub
块引用
使用 >
来创建引用文本:
As Kanye West said:
> We're living the future so
> the present is our past.
As Kanye West said:
We're living the future so the present is our past.
行内代码
使用反引号 包裹代码:
I think you should use an `<addr>` element here instead.
I think you should use an <addr>
element here instead.
语法高亮
使用 GitHub Flavored Markdown 配合 mdx-prism
插件,实现代码高亮:
```js:fancyAlert.js
function fancyAlert(arg) {
if (arg) {
$.facebox({ div: '#foo' })
}
}
```
效果如下——带有样式代码标题的漂亮颜色!
function fancyAlert(arg) {
if (arg) {
$.facebox({ div: '#foo' })
}
}
脚注
可以通过 1 插入脚注并进行引用:
Here is a simple footnote[^1]. With some additional text after it.
[^1]: My reference.
Here is a simple footnote1. With some additional text after it.
任务列表
创建任务列表时,你可以通过 - [ ] 和 - [x] 来标记任务的完成状态:
- [x] list syntax required (any unordered or ordered list supported)
- [x] this is a complete item
- [ ] this is an incomplete item
- list syntax required (any unordered or ordered list supported)
- this is a complete item
- this is an incomplete item
表格
通过 | 来创建表格,分隔不同的列:
| 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 column |
删除线
用 ~~
包裹文本,实现删除线效果:
crossed out.
Happy reading!