主题配置与使用

代码高亮

代码书写时

当使用```这种形式来包含代码时,开头处应该加上代码块语言的类型

比如:```python

主题文件配置

仅针对Butterfly主题

先展示一下Hexo默认的主题配置部分:

1
2
3
4
5
6
7
8
9
10
11
12
highlight:
enable: true
line_number: true
auto_detect: false
tab_replace: ''
wrap: true
hljs: false
prismjs:
enable: false
preprocess: true
line_number: true
tab_replace: ''

首先在Hexo主配置文件

  • 修改highlight.enabletrue
  • 修改highlight.hljsfalse

再主题配置文件

  • 修改highlight_theme为对应要使用的主题

参考链接

  1. Hexo官方文档-代码高亮
  2. 代码块后支持的语言类型有哪些
  3. Butterfly主题代码高亮文档