champion

千里之行,始于足下

hexo+next踩坑日常

代码高亮组件

由于看到别人提到的默认代码高亮效果差,需要在根目录下用npm添加组件hexo-prism-plugin

1
$ npm i -S hexo-prism-plugin

结果会警告报错(不影响正常运行),实在看不下去了

1
$ ERROR Plugin load failed: hexo-prism-plugin

这是由于hexo5.0后的版本自带prismjs代码语法高亮的支持,解决方法也简单,进根目录git bash卸载就行,再去根目录_config.yml文件中搜highlight更改配置

1
$ npm uninstall hexo-prism-plugin
1
2
3
4
5
6
7
8
9
10
11
12
$ highlight:
enable: false #默认启用,禁用掉就行
line_number: true
auto_detect: false
tab_replace: ''
wrap: true
hljs: false
prismjs:
enable: true
preprocess: true
line_number: true
tab_replace: ''

默认主题prismjs是tomorrow night,如果要定制主题的话,可以前往prismjs官网下载自己喜欢的主题css文件,再将css主题文件改名为prism.css,替换掉hexo-theme-matery里的source/libs/prism/prism.css文件即可

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.

![屏幕截图 2026-05-10 091132-1](https://raw.githubusercontent.com/Kgorterm/cdn/main/boke_images/屏幕截图 2026-05-10 091132-1.png)

Quick Start(快速开始)

Clean your public(清理生成的文件-在部署之前删除下public文件中的内容,清理缓存)

1
$ hexo clean

Create a new post(创建一条新的博客)

1
$ hexo new "No.1博客"

More info: Writing

Run server(启动本地服务部署博客)

1
$ hexo server

More info: Server

Generate static files(生成静态文件)

1
$ hexo generate

More info: Generating

Deploy to remote sites(部署到你的专用仓库)

1
$ hexo deploy

More info: Deployment

0%