升级3.1.1之后,即使config.yml里面的highlight.auto_detect设置为true,依然无法自动检测语言类型。看了下代码是hexo-util里面的highlight.js大约75行位置的autoDetect被默认设置成了false,建议处理下这个问题,希望可以通过config来配置是否开启自动检测。
Q
[hexojs/hexo]代码高亮autoDetect 沒有传到util.highlight
0
A
回答
9
还有config.yml里面的highlight.enable设置为false,看起来也不会起作用。
1
No bug was found in source code.
0
@nyaatyan highlight的参数options是在调用的时候直接传的一个对象,而并没有继承config里面的配置,可以看下hexo-renderer-marked的lib/renderer.js大概60行的位置
8
So you mean hexo-renderer-marked doesn't respect Hexo config, right?
Then you'd better open an issue in hexo-renderer-marked.
4
不過auto detect 算法會拖慢處理, 甚至當掉generate 不建議使用
2
@leesei 现在最新的代码高亮已经失效了。
6
options of highlight does respect Hexo config: https://github.com/hexojs/hexo/commit/5b172aa03163a7bf906fce6d16d0f571c52b49fe
You may need to run hexo clean after editing _config.yml