標(biāo)簽插件和 Front-matter 中的標(biāo)簽不同,它們是用于在文章中快速插入特定內(nèi)容的插件。
在文章中插入引言,可包含作者、來(lái)源和標(biāo)題。
捷徑: quote
{% blockquote [author[, source]] [link] [source_link_title] %}
content
{% endblockquote %}
沒(méi)有提供參數(shù),則只輸出普通的 blockquote
{% blockquote %}
Lo
{% 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.
引用書上的句子
{% 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.
David LevithanWide Awake
引用 Twitter
{% blockquote @DevDocs https:
NEW: DevDocs now comes with syntax highlighting. http:
{% endblockquote %}
NEW: DevDocs now comes with syntax highlighting. http://devdocs.io
@DevDocs[twitter.com/devdocs/status/356095192085962752](https://twitter.com/devdocs/status/356095192085962752)
引用網(wǎng)路上的文章
{% 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.
Seth Godin[Welcome to Island Marketing](http://sethgodin.typepad.com/seths_blog/2009/07/welcome-to-island-marketing.html)
在文章中插入代碼。
快捷方式: code
{% codeblock [title] [lang:language] [url] [link text] %}
code snippet
{% endcodeblock %}
以option:value格式指定其他選項(xiàng),例如line_number:false first_line:5。
額外的選擇 | 描述 | 默認(rèn) |
---|---|---|
line_number
|
顯示行號(hào) | true
|
highlight
|
啟用代碼突出顯示 | true
|
first_line
|
指定第一行號(hào) | 1
|
mark
|
突出顯示特定行,每個(gè)值用逗號(hào)分隔。使用破折號(hào)指定數(shù)字范圍 示例:mark:1,4-7,10 將標(biāo)記第1、4至7和10行。 |
|
wrap
|
將代碼塊包裝在 `` | true
|
普通的代碼塊
{% codeblock %}
alert('Hello World!');
{% endcodeblock %}
alert('Hello World!');
指定語(yǔ)言
{% codeblock lang:objc %}
[rectangle setX: 10 y: 10 width: 20 height: 20];
{% endcodeblock %}
[rectangle setX: 10 y: 10 width: 20 height: 20];
在代碼塊中添加標(biāo)題
{%codeblock Array.map%}
array.map(callback [,thisArg])
{%endcodeblock%}
Array.maparray.map(callback [,thisArg])
添加標(biāo)題和URL
{%codeblock _.compact http://underscorejs.org/#compact Underscore.js%}
_.compact([0,1,false,2,``,3]);
=> [1、2、3]
{%endcodeblock%}
_.compact([0, 1, false, 2, '', 3]);
=> [1, 2, 3]
這與使用代碼塊相同,但是使用三個(gè)反引號(hào)來(lái)分隔該塊。
```[語(yǔ)言] [標(biāo)題] [URL] [鏈接文本]代碼段
要將拉引號(hào)添加到您的帖子中:
{%pullquote [class]%}
content
{%endpullquote%}
嵌入 jsFiddle 代碼段:
{% jsfiddle shorttag [tabs] [skin] [width] [height] %}
?
嵌入要點(diǎn)代碼段:
{% gist gist_id [filename] %}
?
嵌入 iframe:
{% iframe url [width] [height] %}
?
插入具有指定尺寸的圖像。
{% img [class names] /path/to/image [width] [height] '"title text" "alt text"' %}
插入具有 target="_blank" 屬性的鏈接。
{% link text url [external] [title] %}
?
在source/downloads/code文件夾中插入代碼段。文件夾位置可以通過(guò)code_dir配置中的選項(xiàng)指定。
{% include_code [title] [lang:language] [from:line] [to:line] path/to/file %}
嵌入test.js的全部?jī)?nèi)容
{%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 video_id [type] [cookie] %}
嵌入視頻
{%youtube lJIrF4YjHfQ%}
嵌入播放列表
{% youtube PL9hW1uS6HUfscJ9DHkOSoOX45MjXduUxo 'playlist' %}
啟用隱私增強(qiáng)模式
在此模式下不使用 YouTube 的 cookie。
{% youtube lJIrF4YjHfQ false %}
{% youtube PL9hW1uS6HUfscJ9DHkOSoOX45MjXduUxo 'playlist' false %}
插入自適應(yīng)或指定大小的 Vimeo 視頻。
{% vimeo video_id [width] [height] %}
包括指向其他帖子的鏈接。
{% post_path filename %}
{% post_link filename [title] [escape] %}
使用此標(biāo)記時(shí),您可以忽略永久鏈接和文件夾信息,例如語(yǔ)言和日期。
例如:{% 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。
您可以自定義要顯示的文本,而不是顯示帖子的標(biāo)題。
默認(rèn)情況下,轉(zhuǎn)義帖子的標(biāo)題和自定義文本。您可以使用該escape選項(xiàng)禁用轉(zhuǎn)義。
例如:
顯示帖子標(biāo)題。
{% post_link hexo-3-8-released %}
顯示自定義文本。
{% post_link hexo-3-8-released 'Link to a post' %}
Escape title.
{% post_link hexo-4-released 'How to use <b> tag in title' %}
Do not escape title
{% post_link hexo-4-released '<b>bold</b> custom title' false %}
包括要與結(jié)合使用的職位資產(chǎn)post_asset_folder。
{% asset_path filename %}
{% asset_img [class names] slug [width] [height] [title text [alt text]] %}
{% asset_link filename [title] [escape] %}
標(biāo)記為 3.1.0+的 hexo-renderer 標(biāo)記可以(可選)自動(dòng)解析圖像的帖子路徑,有關(guān)如何啟用它的信息,請(qǐng)參閱本節(jié)。
“ foo.jpg” 位于http://example.com/2020/01/02/hello/foo.jpg。
Default (無(wú)選項(xiàng))**
{% 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" class="post-image">
Display size
{% asset_img foo.jpg 500 400 %}
<img src="/2020/01/02/hello/foo.jpg" width="500" height="400">
標(biāo)題和替代
{% asset_img logo.svg "lorem ipsum'dolor'" %}
<img src="/2020/01/02/hello/foo.jpg" title="lorem ipsum" alt="dolor">
如果某些內(nèi)容導(dǎo)致帖子中的處理問(wèn)題,請(qǐng)使用raw標(biāo)記將其包裹起來(lái),以避免呈現(xiàn)錯(cuò)誤。
{% raw %}
content
{% endraw %}
使用<!-- more -->標(biāo)簽前面的文字作為帖子的摘錄。如果已指定,則最重要的excerpt:值將優(yōu)先。
例子:
Lorem ipsum dolor坐鎮(zhèn),奉獻(xiàn)自若,sius do eiusmod tempor incididunt ut Labore et dolore magna aliqua。
<!-更多->
盡量減少使用veniam,不要進(jìn)行任何鍛煉,否則將導(dǎo)致commodo后果。Duis aute irure dolor in reprehenderit in voltate velit esse cillum dolore eu fugiat nulla pariatur。不擅長(zhǎng)于圣人的情節(jié),應(yīng)在負(fù)責(zé)任的犯罪活動(dòng)中動(dòng)工。
更多建議: