在hexo中添加html、jss代碼的方法

Tips:

標(biāo)簽插件(Tag Plugins)

標(biāo)簽插件和 Front-matter 中的標(biāo)簽不同,它們是用于在文章中快速插入特定內(nèi)容的插件。

引用塊

在文章中插入引言,可包含作者、來源和標(biāo)題。
別號(hào): quote
{% blockquote [author[, source]] [link] [source_link_title] %}
content
{% endblockquote %}

樣例
  • 沒有提供參數(shù),則只輸出普通的 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.

  • 引用書上的句子
    {% 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

NEW: DevDocs now comes with syntax highlighting. http://devdocs.io
@DevDocstwitter.com/devdocs/status/356095192085962752

Every interaction is both precious and an opportunity to delight.
Seth GodinWelcome to Island Marketing

代碼塊

在文章中插入代碼。
別名: code
{% codeblock [title] [lang:language] [url] [link text] %}
code snippet
{% endcodeblock %}

樣例
普通的代碼塊
{% 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
array.map(callback[, thisArg])

附加說明和網(wǎng)址
{% codeblock _.compact http://underscorejs.org/#compact Underscore.js %}
_.compact([0, 1, false, 2, '', 3]);
=> [1, 2, 3]
{% endcodeblock %}

_.compactUnderscore.js
_.compact([0, 1, false, 2, '', 3]);
=> [1, 2, 3]

反引號(hào)代碼塊
另一種形式的代碼塊,不同的是它使用三個(gè)反引號(hào)來包裹。
[language] [title] [url] [link text] code snippetPull Quote
在文章中插入 Pull quote。
{% pullquote [class] %}
content
{% endpullquote %}

jsFiddle
在文章中嵌入 jsFiddle。
{% jsfiddle shorttag [tabs] [skin] [width] [height] %}

Gist
在文章中嵌入 Gist。
{% gist gist_id [filename] %}

iframe
在文章中插入 iframe。
{% iframe url [width] [height] %}

Image
在文章中插入指定大小的圖片。
{% img [class names] /path/to/image [width] [height] [title text [alt text]] %}

Link
在文章中插入鏈接,并自動(dòng)給外部鏈接添加 target="_blank"
屬性。
{% link text url [external] [title] %}

Include Code
插入 source
文件夾內(nèi)的代碼文件。
{% include_code [title] [lang:language] path/to/file %}

Youtube
在文章中插入 Youtube 視頻。
{% youtube video_id %}

Vimeo
在文章中插入 Vimeo 視頻。
{% vimeo video_id %}

引用文章
引用其他文章的鏈接。
{% post_path slug %}
{% post_link slug [title] %}

引用資源
引用文章的資源。
{% asset_path slug %}
{% asset_img slug [title] %}
{% asset_link slug [title] %}

Raw
如果您想在文章中插入 Swig 標(biāo)簽,可以嘗試使用 Raw 標(biāo)簽,以免發(fā)生解析異常。
{% raw %}
content
{% endraw %}

最后編輯于
?著作權(quán)歸作者所有,轉(zhuǎn)載或內(nèi)容合作請(qǐng)聯(lián)系作者
【社區(qū)內(nèi)容提示】社區(qū)部分內(nèi)容疑似由AI輔助生成,瀏覽時(shí)請(qǐng)結(jié)合常識(shí)與多方信息審慎甄別。
平臺(tái)聲明:文章內(nèi)容(如有圖片或視頻亦包括在內(nèi))由作者上傳并發(fā)布,文章內(nèi)容僅代表作者本人觀點(diǎn),簡書系信息發(fā)布平臺(tái),僅提供信息存儲(chǔ)服務(wù)。

相關(guān)閱讀更多精彩內(nèi)容

友情鏈接更多精彩內(nèi)容