hexo 使用指南

Hexo 官网文档

https://hexo.io/zh-cn/docs/writing

fluid 文档

https://hexo.fluid-dev.com/docs/

Hexo 使用指南

hexo clean
清除缓存

hexo g
生成 public 文件

hexo s
本地查看网页

hexo s --debug
调试网页

hexo d
推送到服务器

一般流程

hexo n [post|draft|page] "filename"
新建一个文件

1
2
3
4
5
6
7
8
9
10
11
---
title: 文章标题
tags: [Hexo, Fluid] # 标签
categories: [front, hexo] # 分类(具有层次性)
index_img: /img/example.jpg # 文章在首页的封面图
banner_img: /img/post_banner.jpg # 文章页顶部大图
math: true # 启用latex(默认关闭)
date: 2019-10-10 10:00:00
---
以下是文章内容
![](/img/example.jpg) # 文章内容图片

hexo clean && hexo g && hexo d

创建表格

1
2
3
4
| Syntax      | Description |
| ----------- | ----------- |
| Header | Title |
| Paragraph | Text |
Syntax Description
Header Title
Paragraph Text

插入图片

1
![test](/img/myimg/bg0.png)

test

tag 插件

1
2
3
{% note success %}
文字 或者 `markdown` 均可
{% endnote %}

primary

secondary

success

danger

warning

info

light

default

行内标签

1
{% label primary @text %}
primary default info success warning danger

勾选框

1
{% cb text, checked?, incline? %}
text

可选包括:
text:显示的文字
checked:默认是否已勾选,默认 false
incline: 是否内联(可以理解为后面的文字是否换行),默认 false

按钮

1
{% btn url, text, title %}
text

url:跳转链接
text:显示的文字
title:鼠标悬停时显示的文字(可选)

1
2
3
## 参考                           # 脚注
[^1]: 参考资料1
[^2]: 参考资料2

参考

脚注

由于 hexo 自带的 markdown 渲染数学公式不支持多行公式\aligned 的运用,因此我最开始参考 fluid 的文档换了 mathjax,结果发现 pandoc 不能很好的支持 plantuml,随后我又换了 katex,katex 既能很好的支持 plantuml,也可以正常显示数学公式,但是一开始忘记在主题配置下指定公式引擎,结果同时显示了两行公式,一行是原先的 mathjax,一行是 katex,这个地方调了半天才想起来.不过 katex 完成的也不是很完美,它的 strict 设置要求它的数学公式中不能出现 unicode 字符,但是 unicode 字符可以被\text{}包起来,于是我又自己写了一个正则表达式来处理这个问题:
189,225/[\u0080-\uffff]+/\\text{&}/g
189 和 225 是公式集中出现和消失的地方,但是这样做,遇到公式断断续续,中间还夹杂着大量的说明文字就会比较难受,因此最好还是能够通过直接修改 katex 的 strict 检测设置来实现.不过这部分我在文档里还没有翻到.

Markdown 用户代码片段

{
	"note primary": {
		"prefix": "note primary",
		"body": ["{% note primary %}", "$0", "{% endnote %}"],
		"description": "Markdown note primary"
	},

	"note default": {
		"prefix": "note default",
		"body": ["{% note default %}", "$0", "{% endnote %}"],
		"description": "Markdown note default"
	},

	"note info": {
		"prefix": "note info",
		"body": ["{% note info %}", "$0", "{% endnote %}"],
		"description": "Markdown note info"
	},

	"note success": {
		"prefix": "note success",
		"body": ["{% note success %}", "$0", "{% endnote %}"],
		"description": "Markdown note success"
	},

	"note warning": {
		"prefix": "note warning",
		"body": ["{% note warning %}", "$0", "{% endnote %}"],
		"description": "Markdown note warning"
	},

	"note danger": {
		"prefix": "note danger",
		"body": ["{% note danger %}", "$0", "{% endnote %}"],
		"description": "Markdown note danger"
	},

	"note secondary": {
		"prefix": "note secondary",
		"body": ["{% note secondary %}", "$0", "{% endnote %}"],
		"description": "Markdown note secondary"
	},

	"note light": {
		"prefix": "note light",
		"body": ["{% note light %}", "$0", "{% endnote %}"],
		"description": "Markdown note light"
	},

	"checkbox": {
		"prefix": "check box",
		"body": ["{% cb $0 %}"],
		"description": "{% cb text, checked?, incline? %}"
	},

	"button": {
		"prefix": "button",
		"body": ["{% btn $0, $1 %}"],
		"description": "{% btn url, text, title? %}"
	},

	"plantuml": {
		"prefix": "plantuml-normal",
		"body": ["{% plantuml %}", "!theme cerulean-outline", "$0", "```"],
		"description": "Markdown plantuml theme cerulean-outline"
	},

	"plantuml-mindmap": {
		"prefix": "plantuml-mindmap",
		"body": [
			"```plantuml",
			"@startmindmap",
			"",
			"$0",
			"@endmindmap",
			"```"
		],
		"description": "Log output to console"
	}
}

`{% endplantuml %}
<section class="footnotes"><div class="footnote-list"><ol><li><span id="fn:1" class="footnote-text"><span>参考资料 1
<a href="#fnref:1" rev="footnote" class="footnote-backref"> ↩</a></span></span></li><li><span id="fn:2" class="footnote-text"><span>参考资料 2
<a href="#fnref:2" rev="footnote" class="footnote-backref"> ↩</a></span></span></li></ol></div></section>