3 分钟
Markdown语法参考
1、 嵌入html
这是一个普通段落。
这是一个普通段落。
Foo |
<table>
<tr>
<td>Foo</td>
</tr>
</table>
2、标题
This is an H1
This is an H1
=============
This is an H2
This is an H2
-------------
这是 H1
# 这是 H1 #
这是 H2
## 这是 H2 ##
这是 H3
### 这是 H3 ###
这是 H4
#### 这是 H4 ####
这是 H5
##### 这是 H5 #####
这是 H6
###### 这是 H6 ######
后面的#号可以省略
3、区块引用 Blockquotes
方式1
This is a blockquote with two paragraphs. Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Aliquam hendrerit mi posuere lectus.
> This is a blockquote with two paragraphs. Lorem ipsum dolor sit amet,
> consectetuer adipiscing elit. Aliquam hendrerit mi posuere lectus.
方式2
This is a blockquote with two paragraphs. Lorem ipsum dolor sit amet Donec sit amet nisl. Aliquam semper ipsum sit amet velit. Suspendisse id sem consectetuer libero luctus adipiscing.
> This is a blockquote with two paragraphs. Lorem ipsum dolor sit amet
> Donec sit amet nisl. Aliquam semper ipsum sit amet velit. Suspendisse
id sem consectetuer libero luctus adipiscing.
嵌套
This is the first level of quoting.
This is nested blockquote.
Back to the first level.
> This is the first level of quoting.
>
> > This is nested blockquote.
>
> Back to the first level.
包含其他markdown元素
这是一个标题。
- 这是第一行列表项。
- 这是第二行列表项。
给出一些例子代码:
return shell_exec("echo $input | $markdown_script");
> ## 这是一个标题。
>
> 1. 这是第一行列表项。
> 2. 这是第二行列表项。
>
> 给出一些例子代码:
>
> return shell_exec("echo $input | $markdown_script");
4、列表
无序列表
- Red
- Green
Blue
* Red * Green * Blue
或者
- Red
- Green
Blue
+ Red + Green + Blue
或者
- Red
- Green
Blue
- Red - Green - Blue
有序列表
- Bird
- McHale
Parish
1. Bird 2. McHale 3. Parish
或者
- Bird
- McHale
Parish
1. Bird 1. McHale 1. Parish
或者
- Bird
- McHale
Parish
3. Bird 1. McHale 8. Parish
列表中引用
A list item with a blockquote:
This is a blockquote inside a list item.
* A list item with a blockquote: > This is a blockquote > inside a list item.
出现数字.需要转义
1986. What a great season.
1986\. What a great season.
表格
Tables | Are | Cool |
---|---|---|
col 3 is | right-aligned | $1600 |
col 2 is | centered | $12 |
zebra stripes | are neat | $1 |
| Tables | Are | Cool |
| ------------- |:-------------:| -----:|
| col 3 is | right-aligned | $1600 |
| col 2 is | centered | $12 |
| zebra stripes | are neat | $1 |
代码区块
这是一个普通段落:
这是一个代码区块。
这是一个代码区块。
或者
#include <iostream>
using namespace std;
int main(){
cout<<"hello world"<<endl;
return 0;
}
//```cpp 请忽略前面双斜线
#include <iostream>
using namespace std;
int main(){
cout<<"hello world"<<endl;
return 0;
}
//``` 请忽略前面双斜线
链接
行内式
This is 本站主页 inline link.
This is [本站主页](/ "主页") inline link.
参考式
This is an example reference-style link.
This is [an example][id] reference-style link.
[id]: /article "title"
例子
I get 10 times more traffic from Google than from Yahoo or MSN.
I get 10 times more traffic from [Google][1] than from
[Yahoo][2] or [MSN][3].
[1]: http://google.com/ "Google"
[2]: http://search.yahoo.com/ "Yahoo Search"
[3]: http://search.msn.com/ "MSN Search"
强调
single asterisks
*single asterisks*
single underscores
_single underscores_
double asterisks
**double asterisks**
double underscores
__double underscores__
un*frigging*believable
un*frigging*believable
如果你的 * 和 _ 两边都有空白的话,它们就只会被当成普通的符号。 普通文本两端插入*或者_号需要加入\转义 *this text is surrounded by literal asterisks* _this text is surrounded by literal asterisks_
行内代码
Use the printf()
function.
如果要在代码区段内插入反引号,你可以用多个反引号来开启和结束代码区段:
There is a literal backtick (`) here.
Use the `printf()` function.
如果要在代码区段内插入反引号,你可以用多个反引号来开启和结束代码区段:
``There is a literal backtick (`) here.``
A single backtick in a code span: `
A backtick-delimited string in a code span: `foo`
Please don’t use any <blink>
tags.
A single backtick in a code span: `` ` ``
A backtick-delimited string in a code span: `` `foo` ``
Please don't use any `<blink>` tags.
图片
![加载失败显示内容](/img/java.png "hover")
自动链接
http://example.com/ [email protected]
<http://example.com/>
<[email protected]>
\反斜线
*literal asterisks*
\*literal asterisks\*
Markdown 支持以下这些符号前面加上反斜杠来帮助插入普通的符号:
\ 反斜线
` 反引号
* 星号
_ 底线
{} 花括号
[] 方括号
() 括弧
# 井字号
+ 加号
- 减号
. 英文句点
! 惊叹号
nihaio dsvffd
扩展Markdown
参考文献
这是段文字参考文献,将会自动移动到文末 1
这是段文字参考文献 [^1]
[^1]: https://github.com/gohugoio/hugoBasicExample/blob/master/content/post/markdown-syntax.md
简化表格
Name | Age |
---|---|
Bob | 27 |
Alice | 23 |
Name | Age
------|----
Bob | 27
Alice | 23
其他元素 - abbr, sub, sup, kbd, mark
GIF is a bitmap image format.
H2O
Xn + Yn = Zn
Press CTRL+ALT+Delete to end the session.
Most salamanders are nocturnal, and hunt for insects, worms, and other small creatures.
<abbr title="Graphics Interchange Format">GIF</abbr> is a bitmap image format.
H<sub>2</sub>O
X<sup>n</sup> + Y<sup>n</sup> = Z<sup>n</sup>
Press <kbd><kbd>CTRL</kbd>+<kbd>ALT</kbd>+<kbd>Delete</kbd></kbd> to end the session.
Most <mark>salamanders</mark> are nocturnal, and hunt for insects, worms, and other small creatures.