From 98ff7de56afe7483725fdef057a8513ff1b8bf0d Mon Sep 17 00:00:00 2001 From: HPCesia Date: Wed, 13 Nov 2024 17:41:38 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=E5=8D=95=E4=B8=BB=E9=A2=98?= =?UTF-8?q?=E6=97=B6=E7=9A=84=20BUG?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- package.json | 2 +- src/main.ts | 3 ++- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/package.json b/package.json index 2ff34b5..681f5ac 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "hexo-highlighter-shiki", - "version": "1.2.0", + "version": "1.2.1", "description": "A package for Hexo which use Shiki to render code highlight.", "main": "dist/index.js", "files": [ diff --git a/src/main.ts b/src/main.ts index a239782..c156076 100644 --- a/src/main.ts +++ b/src/main.ts @@ -69,6 +69,7 @@ export async function init(hexo: Hexo) { for (const extra_theme of [].concat(config.additional.themes)) { additional_themes.push(JSON.parse(readFileSync(extra_theme, "utf8"))); } + // 处理主题 const themes = additional_themes.concat( (typeof config.theme === "string" ? [config.theme] : Object.values(config.theme)).filter( (theme) => theme in bundledThemes @@ -151,7 +152,7 @@ export async function init(hexo: Hexo) { }; }; try { - if (config.theme === "string") + if (typeof config.theme === "string") pre = highlighter.codeToHtml(code, { lang, theme: config.theme,