From 775854c25ca829c581f112ccd1d0390375b52cae Mon Sep 17 00:00:00 2001 From: jaywcjlove <398188662@qq.com> Date: Mon, 25 Mar 2024 23:38:06 +0800 Subject: [PATCH] fix: fix giscus theme issue. --- src/markdown/markdown.ts | 4 +++- themes/default/js/giscus.js | 4 +++- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/src/markdown/markdown.ts b/src/markdown/markdown.ts index 27114d50..7db0bb78 100644 --- a/src/markdown/markdown.ts +++ b/src/markdown/markdown.ts @@ -236,7 +236,9 @@ export async function createHTML(mdStr: string = '', fromPath: string, toPath: s if (config.data.giscus) { const resultGiscus = Object.keys(config.data.giscus).map((key) => `${key}="${config.data.giscus[key]}"`); - varData.giscusScript = `
`; + varData.giscusScript = `
`; } let tempPath = path.resolve(config.data.theme, page.layout || 'markdown.ejs'); if (page.layout) { diff --git a/themes/default/js/giscus.js b/themes/default/js/giscus.js index 36f8efd9..729dd0b1 100644 --- a/themes/default/js/giscus.js +++ b/themes/default/js/giscus.js @@ -26,7 +26,9 @@ }, } }; - iframe.contentWindow.postMessage(config, 'https://giscus.app'); + iframe.contentWindow.postMessage(config, 'https://giscus.app'); + const script = document.querySelector("script[data-script-id=\"giscus\"]") + script.setAttribute("data-theme", theme) } } })();