Skip to content

Commit 970b0c6

Browse files
cdervclaude
andcommitted
Block syntax-highlighting: idiomatic for reveal.js
Reveal.js doesn't properly support Pandoc's idiomatic highlighting mode, resulting in no highlighting at all. Emit a warning and fall back to default skylighting instead. Co-Authored-By: Claude Opus 4.5 <[email protected]>
1 parent 1756832 commit 970b0c6

3 files changed

Lines changed: 57 additions & 6 deletions

File tree

src/command/render/pandoc.ts

Lines changed: 14 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66

77
import { basename, dirname, isAbsolute, join } from "../../deno_ral/path.ts";
88

9-
import { info } from "../../deno_ral/log.ts";
9+
import { info, warning } from "../../deno_ral/log.ts";
1010

1111
import { ensureDir, existsSync, expandGlobSync } from "../../deno_ral/fs.ts";
1212

@@ -1774,11 +1774,19 @@ function resolveTextHighlightStyle(
17741774
}
17751775

17761776
if (highlightTheme === "idiomatic") {
1777-
// Use native format highlighting (typst, LaTeX listings, reveal.js highlight.js)
1778-
// Pass through to Pandoc 3.8+ which handles this natively
1779-
extras.pandoc = extras.pandoc || {};
1780-
extras.pandoc[kSyntaxHighlighting] = "idiomatic";
1781-
return extras;
1777+
if (isRevealjsOutput(pandoc)) {
1778+
// reveal.js idiomatic mode doesn't produce working highlighting
1779+
// Fall through to default skylighting instead
1780+
warning(
1781+
"syntax-highlighting: idiomatic is not supported for reveal.js. Using default highlighting.",
1782+
);
1783+
} else {
1784+
// Use native format highlighting (typst native, LaTeX listings)
1785+
// Pass through to Pandoc 3.8+ which handles this natively
1786+
extras.pandoc = extras.pandoc || {};
1787+
extras.pandoc[kSyntaxHighlighting] = "idiomatic";
1788+
return extras;
1789+
}
17821790
}
17831791

17841792
// create the possible name matches based upon the dark vs. light
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
---
2+
title: LaTeX Idiomatic Highlighting
3+
format: pdf
4+
keep-tex: true
5+
syntax-highlighting: idiomatic
6+
_quarto:
7+
tests:
8+
pdf:
9+
ensureLatexFileRegexMatches:
10+
# idiomatic = LaTeX listings package
11+
- ["\\\\begin\\{lstlisting\\}", "\\\\usepackage\\{listings\\}"]
12+
# Should NOT have fancyvrb/Shaded (skylighting output)
13+
- ["fancyvrb", "Shaded"]
14+
---
15+
16+
Test that `syntax-highlighting: idiomatic` produces LaTeX listings highlighting.
17+
18+
```python
19+
def hello():
20+
print("world")
21+
```
Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
---
2+
title: Reveal.js Idiomatic Warning
3+
format: revealjs
4+
syntax-highlighting: idiomatic
5+
_quarto:
6+
tests:
7+
revealjs:
8+
noErrors: default
9+
printsMessage:
10+
level: WARN
11+
regex: "syntax-highlighting: idiomatic is not supported for reveal.js"
12+
ensureFileRegexMatches:
13+
# Should still have skylighting highlighting (fallback worked)
14+
- ["sourceCode", "class="]
15+
---
16+
17+
Test that `syntax-highlighting: idiomatic` emits warning for reveal.js and falls back to default highlighting.
18+
19+
```python
20+
def hello():
21+
print("world")
22+
```

0 commit comments

Comments
 (0)