Hello World

Welcome to Hexo! This is your very first post. Check documentation for more info. If you get any problems when using Hexo, you can find the answer in troubleshooting or you can ask me on GitHub.

基本操作

创建博客

$ hexo new "My New Post"

More info: Writing

预览

$ hexo server --debug

More info: Server

发布

$ hexo g -d

More info: Generating Deployment

支持图片

详见Hexo博客写作与图片处理的经验

  1. 设置 Typora 将图片复制到指定目录

  2. 修改 hexo 全局配置文件 _config.yml 中的配置:

    post_asset_folder: true
  3. 安装hexo-asset-image插件修复博客图片路径问题。

    npm install hexo-image-link --save

支持公式

详见在 Hexo 博客中写出好看的Latex 公式

安装 hexo-renderer-kramed

npm uninstall hexo-renderer-marked --save
npm install hexo-renderer-kramed --save

打开next 主题配置开关

mathjax:
enable: true
# See: https://mhchem.github.io/MathJax-mhchem/
mhchem: false

文章开头声明支持公式

mathjax: true

其他配置

关闭代码的行号

highlight:
enable: true
line_number: false
auto_detect: true
tab_replace: ' '
wrap: true
hljs: false

关闭 TOC 的序号

主题配置number设为false。

toc:
enable: true
number: false

问题

找不到 git 插件

ERROR Deployer not found: git

解决方案:安装 hexo-deployer-git

blog git:(master) ✗ npm install hexo-deployer-git --save

git 鉴权失败

fatal: 'https://github.com/WhiteTeeth/whiteteeth.github.io.git/' 鉴权失败
FATAL {
err: Error: Spawn failed
at ChildProcess.<anonymous> (/Users/baiya/Developer/baiya-github/blog/node_modules/hexo-util/lib/spawn.js:51:21)
at ChildProcess.emit (node:events:390:28)
at Process.ChildProcess._handle.onexit (node:internal/child_process:290:12) {
code: 128
}
} Something's wrong. Maybe you can find the solution here: %s https://hexo.io/docs/troubleshooting.html

解决方案:修改 _config.yml中的 deploy repo 路径,改用 ssh 方式

deploy:
type: git
repo:
github: git@github.com:WhiteTeeth/whiteteeth.github.io.git
branch: master