环境

  • os: win32 10.0.19045
  • git: git version 2.39.1.windows.1
  • node: v18.16.0
  • hexo: 6.3.0
  • hexo-cli: 4.3.1

安装git的官网:https://git-scm.com/

安装node.js的官网:https://nodejs.org/en

hexo的官网:https://hexo.io/

在终端中输入命令进行安装:

1
npm install hexo-cli -g

初始化一个博客项目:

1
2
3
4
5
npm install hexo-cli -g
hexo init blog
cd blog
npm install
hexo server

选择一个主题(使用Butterfly) https://butterfly.js.org/

在hexo根目录中输入命令

1
git clone -b master https://github.com/jerryc127/hexo-theme-butterfly.git themes/butterfly

安装需要的依赖(pug及stylus的渲染器)

1
npm install hexo-renderer-pug hexo-renderer-stylus --save

另注:使用中发现数学公式会重复显示,即先显示正常渲染的公式,然后又显示未正常渲染的。解决方法:卸载 hexo-renderer-markdown-it-plus

1
2
npm un hexo-renderer-marked --save
npm i hexo-renderer-markdown-it-plus --save

其实我不知道到底怎么办,莫名其妙就成功了……参考了下面这篇博客

https://jun-wang-2018.github.io/MyBlog/en/hexo-and-katex/