This post is originated from here and is used for testing markdown style. This post contains nearly every markdown usage. Make sure all the markdown elements below show up correctly.
# Headers
# H1 | |
## H2 | |
### H3 | |
#### H4 | |
##### H5 | |
###### H6 | |
Alternatively, for H1 and H2, an underline-ish style: | |
Alt-H1 | |
====== | |
Alt-H2 | |
------ |
# H1
# H2
# H3
# H4
# H5
# H6
Alternatively, for H1 and H2, an underline-ish style:
# Alt-H1
# Alt-H2
# Emphasis
Emphasis, aka italics, with *asterisks* or _underscores_. | |
Strong emphasis, aka bold, with **asterisks** or __underscores__. | |
Combined emphasis with **asterisks and _underscores_**. | |
Strikethrough uses two tildes. ~~Scratch this.~~ |
Emphasis, aka italics, with asterisks or underscores.
Strong emphasis, aka bold, with asterisks or underscores.
Combined emphasis with asterisks and underscores.
Strikethrough uses two tildes. Scratch this.
# Lists
1. First ordered list item | |
2. Another item | |
* Unordered sub-list. | |
1. Actual numbers don't matter, just that it's a number | |
1. Ordered sub-list | |
4. And another item. | |
You can have properly indented paragraphs within list items. Notice the blank line above, and the leading spaces (at least one, but we'll use three here to also align the raw Markdown). | |
To have a line break without a paragraph, you will need to use two trailing spaces. | |
Note that this line is separate, but within the same paragraph. | |
(This is contrary to the typical GFM line break behaviour, where trailing spaces are not required.) | |
* Unordered list can use asterisks | |
- Or minuses | |
+ Or pluses | |
- Paragraph In unordered list | |
For example like this. | |
Common Paragraph with some text. | |
And more text. |
First ordered list item
Another item
- Unordered sub-list.
Actual numbers don't matter, just that it's a number
- Ordered sub-list
And another item.
You can have properly indented paragraphs within list items. Notice the blank line above, and the leading spaces (at least one, but we'll use three here to also align the raw Markdown).
To have a line break without a paragraph, you will need to use two trailing spaces.
Note that this line is separate, but within the same paragraph.
(This is contrary to the typical GFM line break behaviour, where trailing spaces are not required.)
- Unordered list can use asterisks
- Or minuses
- Or pluses
Paragraph In unordered list
For example like this.
Common Paragraph with some text.
And more text.
# Inline HTML
<p>To reboot your computer, press <kbd>ctrl</kbd>+<kbd>alt</kbd>+<kbd>del</kbd>.</p> |
To reboot your computer, press ctrl+alt+del.
<dl> | |
<dt>Definition list</dt> | |
<dd>Is something people use sometimes.</dd> | |
<dt>Markdown in HTML</dt> | |
<dd>Does *not* work **very** well. Use HTML <em>tags</em>.</dd> | |
</dl> |
- Definition list
- Is something people use sometimes.
- Markdown in HTML
- Does *not* work **very** well. Use HTML tags.
This is a regular paragraph. | |
<table> | |
<tr> | |
<td>Foo</td> | |
</tr> | |
</table> | |
This is another regular paragraph. |
This is a regular paragraph.
Foo |
This is another regular paragraph.
# Links
[I'm an inline-style link](https://www.google.com) | |
[I'm an inline-style link with title](https://www.google.com "Google's Homepage") | |
[I'm a reference-style link][Arbitrary case-insensitive reference text] | |
[I'm a relative reference to a repository file](../blob/master/LICENSE) | |
[You can use numbers for reference-style link definitions][1] | |
Or leave it empty and use the [link text itself] | |
Some text to show that the reference links can follow later. | |
[arbitrary case-insensitive reference text]: https://hexo.io | |
[1]: https://hexo.io/docs/ | |
[link text itself]: https://hexo.io/api/ |
I'm an inline-style link
I'm an inline-style link with title
I'm a reference-style link
I'm a relative reference to a repository file
You can use numbers for reference-style link definitions
Or leave it empty and use the link text itself
Some text to show that the reference links can follow later.
# Images
hover to see the title text: | |
Inline-style: | |
 | |
Reference-style: | |
![alt text][logo] | |
[logo]: https://hexo.io/icon/favicon-196x196.png "Logo Title Text 2" |
hover to see the title text:
Inline-style:
Reference-style:
# Code and Syntax Highlighting
Inline code
has back-ticks around
it.
var s = "JavaScript syntax highlighting"; | |
alert(s); |
s = "Python syntax highlighting" | |
print s |
No language indicated, so no syntax highlighting.
But let's throw in a <b>tag</b>.
# Tables
| |ASCII |HTML | | |
|----------------|-------------------------------|-----------------------------| | |
|Single backticks|`'Isn't this fun?'` |'Isn't this fun?' | | |
|Quotes |`"Isn't this fun?"` |"Isn't this fun?" | | |
|Dashes |`-- is en-dash, --- is em-dash`|-- is en-dash, --- is em-dash| |
ASCII | HTML | |
---|---|---|
Single backticks | 'Isn't this fun?' | 'Isn't this fun?' |
Quotes | "Isn't this fun?" | "Isn't this fun?" |
Dashes | -- is en-dash, --- is em-dash | -- is en-dash, --- is em-dash |
Colons can be used to align columns.
| Tables | Are | Cool | | |
| ------------- |:-------------:| -----:| | |
| col 3 is | right-aligned | | | |
| col 2 is | centered | | | |
| zebra stripes | are neat | | |
Tables | Are | Cool |
---|---|---|
col 3 is | right-aligned | |
col 2 is | centered | |
zebra stripes | are neat |
The outer pipes (|) are optional, and you don't need to make the raw Markdown line up prettily. You can also use inline Markdown.
Markdown | Less | Pretty | |
--- | --- | --- | |
*Still* | `renders` | **nicely** | |
1 | 2 | 3 |
Markdown | Less | Pretty |
---|---|---|
Still | renders | nicely |
1 | 2 | 3 |
You can find more information about LaTeX mathematical expressions here.
# Horizontal Rule
Three or more...
--- | |
Hyphens | |
*** | |
Asterisks | |
___ | |
Underscores |
Hyphens
Asterisks
Underscores
# Line Breaks
Here's a line for us to start with. | |
This line is separated from the one above by two newlines, so it will be a *separate paragraph*. | |
This line is also a separate paragraph, but... | |
This line is only separated by a single newline, so it's a separate line in the *same paragraph*. |
Here's a line for us to start with.
This line is separated from the one above by two newlines, so it will be a separate paragraph.
This line is also a separate paragraph, but...
This line is only separated by a single newline, so it's a separate line in the same paragraph.
# md 文件导入 image
# Youtube videos
<a href="https://www.youtube.com/watch?feature=player_embedded&v=ARted4RniaU | |
" target="_blank"><img src="https://img.youtube.com/vi/ARted4RniaU/0.jpg" | |
alt="IMAGE ALT TEXT HERE" width="240" height="180" border="10" /></a> | |
Pure markdown version: | |
[](https://www.youtube.com/watch?v=ARted4RniaU) |
Pure markdown version:
Youtube
Vimeo
# tag-plugins
# 引用块
在文章中插入引言,可包含作者、来源和标题。
别号: quote
{% blockquote [author[, source]] [link] [source_link_title] %}
content
{% endblockquote %}
content
# 样例
没有提供参数,则只输出普通的 blockquote
{% blockquote %}
Lorem ipsum dolor sit amet, consectetur adipiscing elit. Pellentesque hendrerit lacus ut purus iaculis feugiat. Sed nec tempor elit, quis aliquam neque. Curabitur sed diam eget dolor fermentum semper at eu lorem.
{% endblockquote %}
Lorem ipsum dolor sit amet, consectetur adipiscing elit. Pellentesque hendrerit lacus ut purus iaculis feugiat. Sed nec tempor elit, quis aliquam neque. Curabitur sed diam eget dolor fermentum semper at eu lorem.
Lorem ipsum dolor sit amet, consectetur adipiscing elit. Pellentesque hendrerit lacus ut purus iaculis feugiat. Sed nec tempor elit, quis aliquam neque. Curabitur sed diam eget dolor fermentum semper at eu lorem.
引用书上的句子
{% blockquote David Levithan, Wide Awake %}
Do not just seek happiness for yourself. Seek happiness for all. Through kindness. Through mercy.
{% endblockquote %}
Do not just seek happiness for yourself. Seek happiness for all. Through kindness. Through mercy.
Do not just seek happiness for yourself. Seek happiness for all. Through kindness. Through mercy.
引用 Twitter
{% blockquote @DevDocs https://twitter.com/devdocs/status/356095192085962752 %}
NEW: DevDocs now comes with syntax highlighting. http://devdocs.io
{% endblockquote %}
NEW: DevDocs now comes with syntax highlighting. http://devdocs.io
NEW: DevDocs now comes with syntax highlighting. http://devdocs.io
引用网络上的文章
{% blockquote Seth Godin http://sethgodin.typepad.com/seths_blog/2009/07/welcome-to-island-marketing.html Welcome to Island Marketing %}
Every interaction is both precious and an opportunity to delight.
{% endblockquote %}
Every interaction is both precious and an opportunity to delight.
Every interaction is both precious and an opportunity to delight.
# 代码块
别名: code
{% codeblock [title] [lang:language] [url] [link text] [additional options] %}
code snippet
{% endcodeblock %}
Specify additional options in option:value
format, e.g. line_number:false first_line:5
.
Extra Options | Description | Default |
---|---|---|
line_number | Show line number | true |
highlight | Enable code highlighting | true |
first_line | Specify the first line number | 1 |
mark | Line highlight specific line(s), each value separated by a comma. Specify number range using a dash Example: mark:1,4-7,10 will mark line 1, 4 to 7 and 10. | |
wrap | Wrap the code block in `` | true |
# 样例
普通的代码块
{% codeblock %}
alert('Hello World!');
{% endcodeblock %}
alert('Hello World!');
指定语言
{% codeblock lang:objc %}
[rectangle setX: 10 y: 10 width: 20 height: 20];
{% endcodeblock %}
[rectangle setX: 10 y: 10 width: 20 height: 20];
附加说明
{% codeblock Array.map %}
array.map(callback[, thisArg])
{% endcodeblock %}
array.map(callback[, thisArg])
附加说明和网址
{% codeblock _.compact http://underscorejs.org/#compactUnderscore.js %}
_.compact([0, 1, false, 2, '', 3]);
=> [1, 2, 3]
{% endcodeblock %}
_.compact([0, 1, false, 2, '', 3]);
=> [1, 2, 3]
# jsFiddle
在文章中嵌入 jsFiddle。
# Gist
在文章中嵌入 Gist。
# iframe
在文章中插入 iframe。
{% iframe url [width] [height] %}
# Image
在文章中插入指定大小的图片。
{% img [class names] /path/to/image [width] [height] '"title text" "alt text"' %}
# Link
在文章中插入链接,并自动给外部链接添加 target="_blank"
属性。
{% link text url [external] [title] %}
# Include Code
插入 source/downloads/code
文件夹内的代码文件。 source/downloads/code
不是固定的,取决于你在配置文件中 code_dir
的配置。
{% include_code [title] [lang:language] [from:line] [to:line] path/to/file %}
# 样例
嵌入 test.js 文件全文
{% include_code lang:javascript test.js %}
只嵌入第 3 行
{% include_code lang:javascript from:3 to:3 test.js %}
嵌入第 5 行至第 8 行
{% include_code lang:javascript from:5 to:8 test.js %}
嵌入第 5 行至文件结束
{% include_code lang:javascript from:5 test.js %}
嵌入第 1 行至第 8 行
{% include_code lang:javascript to:8 test.js %}
# Youtube
在文章中插入 Youtube 视频。
{% youtube video_id [type] [cookie] %}
# Examples
视频
{% youtube lJIrF4YjHfQ %}
播放列表
{% youtube PL9hW1uS6HUfscJ9DHkOSoOX45MjXduUxo 'playlist' %}
隐私模式
禁止 YouTube cookie
{% youtube lJIrF4YjHfQ false %}
{% youtube PL9hW1uS6HUfscJ9DHkOSoOX45MjXduUxo 'playlist' false %}
# Vimeo
在文章中插入 Vimeo 视频。
{% vimeo video_id %}
# 引用文章
引用其他文章的链接。
{% post_path filename %}
{% post_link filename [title] [escape] %}
在使用此标签时可以忽略文章文件所在的路径或者文章的永久链接信息、如语言、日期。
例如,在文章中使用 {% post_link how-to-bake-a-cake %}
时,只需有一个名为 how-to-bake-a-cake.md
的文章文件即可。即使这个文件位于站点文件夹的 source/posts/2015-02-my-family-holiday
目录下、或者文章的永久链接是 2018/en/how-to-bake-a-cake
,都没有影响。
默认链接文字是文章的标题,你也可以自定义要显示的文本。
默认对文章的标题和自定义标题里的特殊字符进行转义。可以使用 escape
选项,禁止对特殊字符进行转义。
链接使用文章的标题
{% post_link hexo-3-8-released %}
Hexo 3.8.0 Released
链接使用自定义文字
{% post_link hexo-3-8-released '通往文章的链接' %}
通往文章的链接
对标题的特殊字符进行转义
{% post_link hexo-4-released 'How to use tag in title' %}
How to use tag in title
禁止对标题的特殊字符进行转义
{% post_link hexo-4-released 'bold custom title' false %}
# 引用资源
引用文章的资源。
{% asset_path filename %}
{% asset_img [class names] slug [width] [height] [title text [alt text]] %}
{% asset_link filename [title] [escape] %}
# Embed image
hexo-renderer-marked 3.1.0+ can (optionally) resolves the post’s path of an image automatically, refer to this section on how to enable it.
“foo.jpg” is located at http://example.com/2020/01/02/hello/foo.jpg
.
Default (no option)
{% asset_img foo.jpg %}
<img src="/2020/01/02/hello/foo.jpg">
Custom class
{% asset_img post-image foo.jpg %}
<img src="/2020/01/02/hello/foo.jpg">
Display size
{% asset_img foo.jpg 500 400 %}
<img src="/2020/01/02/hello/foo.jpg" width="500" height="400">
Title & Alt
{% asset_img logo.svg "lorem ipsum'dolor'" %}
<img src="/2020/01/02/hello/foo.jpg" title="lorem ipsum" alt="dolor">
# Raw
如果您想在文章中插入 Swig 标签,可以尝试使用 Raw 标签,以免发生解析异常。
content
# 文章摘要和截断
在文章中使用 <!-- more -->
,那么 <!-- more -->
之前的文字将会被视为摘要。首页中将只出现这部分文字,同时这部分文字也会出现在正文之中。