hexo 添加html项目,在hexo中添加html、jss代码的方法

Tips:

这种方法整理来自hexo官网

适用于添加绝大部分编程语言代码段

欢迎关注我的博客

标签插件(Tag Plugins)

标签插件和 Front-matter 中的标签不同,它们是用于在文章中快速插入特定内容的插件。

引用块

在文章中插入引言,可包含作者、来源和标题。

别号: quote

{% blockquote [author[, source]] [link] [source_link_title] %}

content

{% endblockquote %}

样例

没有提供参数,则只输出普通的 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

引用 Twitter

{% blockquote @DevDocs https://twitter.com/devdocs/status/356095192085962752 %}

NEW: DevDocs now comes with syntax highlighting. http://devdocs.io

{% endblockquote %}

引用网络上的文章

{% 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 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])

附加说明和网址

{% 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]

反引号代码块

另一种形式的代码块,不同的是它使用三个反引号来包裹。

[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

在文章中插入链接,并自动给外部链接添加 target="_blank"

属性。

{% link text url [external] [title] %}

Include Code

插入 source

文件夹内的代码文件。

{% 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 标签,可以尝试使用 Raw 标签,以免发生解析异常。

{% raw %}

content

{% endraw %}

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值