Skip to content

Commit 31fcf2f

Browse files
cdervclaude
andcommitted
Fix hasTextHighlighting to check for "none" string
Since 1edf415, highlight-style: none sets "none" string instead of null. The ?? operator and null check didn't catch this, causing hasTextHighlighting to incorrectly return true when highlighting was disabled. - Use || fallback (consistent with hasAdaptiveTheme, readHighlightingTheme) - Check for "none" string instead of null - Remove unreachable null check (|| chain always provides default) Co-Authored-By: Claude Opus 4.5 <[email protected]>
1 parent 6480394 commit 31fcf2f

1 file changed

Lines changed: 4 additions & 2 deletions

File tree

src/quarto-core/text-highlighting.ts

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -98,8 +98,10 @@ export function hasAdaptiveTheme(pandoc: FormatPandoc) {
9898

9999
export function hasTextHighlighting(pandoc: FormatPandoc): boolean {
100100
// Check both syntax-highlighting (new) and highlight-style (deprecated alias)
101-
const theme = pandoc[kSyntaxHighlighting] ?? pandoc[kHighlightStyle];
102-
return theme !== null;
101+
const theme = pandoc[kSyntaxHighlighting] ||
102+
pandoc[kHighlightStyle] ||
103+
kDefaultHighlightStyle;
104+
return theme !== "none";
103105
}
104106

105107
export function isAdaptiveTheme(theme: string | Record<string, string>) {

0 commit comments

Comments
 (0)