Adapt to Hexo 7 highlight settings

This commit is contained in:
Mimi 2023-12-17 13:00:18 +08:00
parent c8c2fb23e5
commit 269eae34c4
3 changed files with 4 additions and 4 deletions

View File

@ -15,12 +15,12 @@ module.exports = hexo => {
config.highlight.hljs = false;
config.prismjs = config.prismjs || {};
theme.highlight = {
enable: config.highlight.enable && !config.prismjs.enable,
enable: config.syntax_highlighter === 'highlight.js' || config.highlight.enable,
light : highlightTheme(theme.codeblock.theme.light),
dark : highlightTheme(theme.codeblock.theme.dark)
};
theme.prism = {
enable: config.prismjs.enable,
enable: config.syntax_highlighter === 'prismjs' || config.prismjs.enable,
light : prismTheme(theme.codeblock.prism.light),
dark : prismTheme(theme.codeblock.prism.dark),
number: resolve('prismjs', 'plugins/line-numbers/prism-line-numbers.css')

View File

@ -27,7 +27,7 @@ hexo.extend.helper.register('next_config', function() {
comments : theme.comments,
stickytabs: theme.tabs.sticky,
motion : theme.motion,
prism : config.prismjs.enable && !config.prismjs.preprocess,
prism : theme.prism.enable && !config.prismjs.preprocess,
i18n : {
placeholder: __('search.placeholder'),
empty : __('search.empty', '${query}'),

View File

@ -5,7 +5,7 @@
hexo.extend.helper.register('js_vendors', function() {
const { config, theme } = this;
const vendors = ['anime'];
if (config.prismjs.enable && !config.prismjs.preprocess) {
if (theme.prism.enable && !config.prismjs.preprocess) {
vendors.push('prism', 'prism_autoloader');
if (config.prismjs.line_number) {
vendors.push('prism_line_numbers');