Skip to content

Commit f08f424

Browse files
giscus.ejs needs to check for darkMode
and not use variables that won't be declared
1 parent 334b6e7 commit f08f424

File tree

2 files changed

+3
-1
lines changed

2 files changed

+3
-1
lines changed

src/format/html/format-html.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -609,7 +609,7 @@ export async function htmlFormatExtras(
609609
giscusAfterBody,
610610
renderEjs(
611611
formatResourcePath("html", join("giscus", "giscus.ejs")),
612-
{ giscus },
612+
{ giscus, darkMode: options.darkMode },
613613
),
614614
);
615615
includeAfterBody.push(giscusAfterBody);

src/resources/formats/html/giscus/giscus.ejs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,9 +6,11 @@
66
const getTheme = () => {
77
let baseTheme = document.getElementById('giscus-base-theme').value;
88
let altTheme = document.getElementById('giscus-alt-theme').value;
9+
<% if (darkMode !== undefined) { %>
910
if (authorPrefersDark) {
1011
[baseTheme, altTheme] = [altTheme, baseTheme];
1112
}
13+
<% } %>
1214
return document.body.classList.contains('quarto-dark') ? altTheme : baseTheme;
1315
};
1416
const script = document.createElement("script");

0 commit comments

Comments
 (0)