From c2fcfcf77f6a53e8d4282df0f1f8fd936d99e6e2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E7=99=BD=E4=BA=91=E8=8B=8D=E7=8B=97?= Date: Mon, 11 Dec 2023 12:53:54 +0800 Subject: [PATCH] =?UTF-8?q?=F0=9F=90=9E=20fix:=20=E5=85=BC=E5=AE=B9=20Hexo?= =?UTF-8?q?=207.0.0=20=E4=BB=A3=E7=A0=81=E9=AB=98=E4=BA=AE=E9=85=8D?= =?UTF-8?q?=E7=BD=AE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- packages/hexo-theme-async/scripts/events/config.js | 4 ++-- packages/hexo-theme-async/scripts/helper/async_config.js | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/packages/hexo-theme-async/scripts/events/config.js b/packages/hexo-theme-async/scripts/events/config.js index dcf8bfe4..bf25beca 100644 --- a/packages/hexo-theme-async/scripts/events/config.js +++ b/packages/hexo-theme-async/scripts/events/config.js @@ -87,9 +87,9 @@ const processLess = hexo => { if (theme.config.reward.enable) less.options.globalVars.isReward = true; // 代码高亮 - less.options.globalVars.highlightEnable = highlight && highlight.enable; + less.options.globalVars.highlightEnable = (highlight && highlight.enable) || hexo.config.syntax_highlighter == 'highlight.js'; less.options.globalVars.highlightLineNumber = highlight && highlight.line_number; - less.options.globalVars.prismjsEnable = prismjs && prismjs.enable; + less.options.globalVars.prismjsEnable = (prismjs && prismjs.enable) || hexo.config.syntax_highlighter == 'prismjs'; less.options.globalVars.prismjsLineNumber = prismjs && prismjs.line_number; less.options.globalVars.highlightTheme = theme.config.highlight.theme; less.options.globalVars.highlightTitleStyle = theme.config.highlight.title; diff --git a/packages/hexo-theme-async/scripts/helper/async_config.js b/packages/hexo-theme-async/scripts/helper/async_config.js index 1c9dc7e4..231b10c8 100644 --- a/packages/hexo-theme-async/scripts/helper/async_config.js +++ b/packages/hexo-theme-async/scripts/helper/async_config.js @@ -47,7 +47,7 @@ hexo.extend.helper.register('async_config', function () { icons: theme.icons, icontype: theme.assets.icons.type, highlight: { - plugin: config.highlight.enable ? 'highlighjs' : 'prismjs', + plugin: (config.highlight.enable || config.syntax_highlighter == 'highlight.js') ? 'highlighjs' : 'prismjs', theme: theme.highlight.theme, copy: theme.highlight.copy, lang: theme.highlight.lang,