1. 安装
1 2 3 npm install -g hexo-cli cd your-blog hexo init
2. 常用命令选项
1 2 3 4 5 6 7 8 9 10 11 12 13 d, deploy Deploy your website. g, generate Generate static files. n, new Create a new post. s, server Start the server. clean Remove generated files and cache. config Get or set configurations. help Get help on a command. init Create a new Hexo folder. list List the information of the site migrate Migrate your site from other system to Hexo. publish Moves a draft post from \_drafts to \_posts folder. render Render files with renderer plugins. version Display version information.
3. 常用插件
hexo-abbrlink 链接地址优化
hexo-pdf 支持pdf
hexo-deployer-git 用git发布
hexo-generator-searchdb 支持本地搜索
hexo-footnotes 支持脚注 (脚注非 markdown 原生语法, 需要插件支持)
hexo-tag-plantuml 画UML图
hexo-tag-echarts3 支持EChart
hexo-heading-index 标题自动添加序号
1 cnpm i -S hexo-abbrlink hexo-pdf hexo-deployer-git hexo-generator-searchdb hexo-footnotes hexo-tag-plantuml hexo-tag-echarts3 hexo-heading-index
4. 最好用的主题
next-Pisces 主题简洁大方, 功能丰富, 翻了多个主题, 就这个最方便了.
自带 mathjax.
1 2 3 4 5 6 7 cd $blog_dir git clone -b master --depth=1 https://github.com/theme-next/hexo-theme-next themes/next git clone -b master --depth=1 https://github.com/theme-next/hexo-theme-next next ln -sf next $blog_dir/themes/next ln -sf $DOCS_DIR/next $DOCS_DIR/blog/themes/next
之后添加 ${your-blog}/source/_posts/_data/next.yml, 用于覆盖 theme/next/_config.yml
5. 常见问题
5.1. 数据表达式支持
${your-blog}/source/_posts/_data/next.yml 文件中打开数据表达式支持
1 2 3 math: katex: enable: true
把 hexo-renderer-marked 卸载
1 2 cnpm un -S hexo-renderer-marked cnpm i -S hexo-renderer-markdown-it-plus
在博客文件头中添加标识 mathjax: true
之后在博客文件正文就可以写数学表达式了, 如:
1 2 3 4 5 6 7 8 9 10 11 单行数学表达式: $a \ne 0$ 多行数学表达式: $$ \begin{aligned} a &= b + c \\ &= d + e + f + g \\ &= h + i \end{aligned} $$
5.2. 特殊字符转义
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 ! ! — 惊叹号 Exclamation mark ” " " 双引号 Quotation mark # # — 数字标志 Number sign $ $ — 美元标志 Dollar sign % % — 百分号 Percent sign & & & Ampersand ‘ ' — 单引号 Apostrophe ( ( — 小括号左边部分 Left parenthesis ) ) — 小括号右边部分 Right parenthesis * * — 星号 Asterisk + + — 加号 Plus sign < < < 小于号 Less than = = — 等于符号 Equals sign - - − — 减号 > > > 大于号 Greater than ? ? — 问号 Question mark @ @ — Commercial at [ [ --- 中括号左边部分 Left square bracket \ \ --- 反斜杠 Reverse solidus (backslash) ] ] — 中括号右边部分 Right square bracket { { — 大括号左边部分 Left curly brace | | — 竖线Vertical bar } } — 大括号右边部分 Right curly brace
6. Resource