Skip to content

Commit

Permalink
🐞 fix: 兼容 Hexo 7.0.0 代码高亮配置
Browse files Browse the repository at this point in the history
  • Loading branch information
白云苍狗 committed Dec 11, 2023
1 parent 59de54a commit c2fcfcf
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
4 changes: 2 additions & 2 deletions packages/hexo-theme-async/scripts/events/config.js
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
2 changes: 1 addition & 1 deletion packages/hexo-theme-async/scripts/helper/async_config.js
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down

0 comments on commit c2fcfcf

Please sign in to comment.