YunYouJun / hexo-theme-yun

☁️ A fast & light & lovely theme for Hexo. 一个对可爱自以为是的 Hexo 主题。
https://yun.yunyoujun.cn
MIT License
1.39k stars 168 forks source link

[Usage Problem]如何禁用prism-theme-vars的CSS,并启用prismjs的CSS #272

Closed 1357310795 closed 2 years ago

1357310795 commented 2 years ago

主题似乎默认使用 https://cdn.jsdelivr.net/npm/prism-theme-vars/base.css 但是丑得离谱 怎样才能加载 https://cdn.jsdelivr.net/npm/prismjs@latest/themes/prism-coy.css

尝试了下面的配置:

(_config.yml)
highlight:
  enable: false
  line_number: true
  auto_detect: false
  tab_replace: ''
  wrap: true
  hljs: false
prismjs:
  enable: false
  preprocess: true
  line_number: false
  tab_replace: ''
(_config.yun.yml)
codeblock:
  copy_btn: true
# stylesheets loaded in the <head>
css:
  - /css/hexo-theme-yun.css
  - https://cdn.jsdelivr.net/npm/prismjs@latest/themes/prism-coy.css

但是失败了: QQ截图20220321151049

如果_config.yml改成

(_config.yml)
highlight:
  enable: false
  line_number: true
  auto_detect: false
  tab_replace: ''
  wrap: true
  hljs: false
prismjs:
  enable: true
  preprocess: true
  line_number: false
  tab_replace: ''

QQ截图20220321151521

YunYouJun commented 2 years ago
image image

代码高亮理论上应该是这个样子,并且有亮暗模式。

是否已经使用 cpp 作为代码区块命名?

1357310795 commented 2 years ago

抱歉之前没看到回复……

image image

这边展示的都是默认的prism-theme-vars的效果,这个是没问题的。但是我想更换成https://cdn.jsdelivr.net/npm/prismjs@latest/themes/prism-coy.css,不知道如何禁用prism-theme-vars的加载

YunYouJun commented 2 years ago

Just override it.

cdn:
  css:
    prism-theme-vars: '' # or your css
1357310795 commented 2 years ago

感谢!已解决