-
-
Notifications
You must be signed in to change notification settings - Fork 3.8k
Description
Discussed in #11418
Originally posted by ghamerly January 24, 2026
reveal.js works well with highlight.js (on its own), but when pandoc generates revealjs slides, it is not possible (as far as I can see) to simply integrate highlight.js. There are two reasons:
- pandoc generates
<pre [attributes]><code>..., but highlight.js expects<pre><code [attributes]>... - the revealjs template needs some minor additions - in particular to add initialization for
RevealHighlightplugin inReveal.initialize(.
I've made a miniature working demo that enables pandoc to generate revealjs slides that seem to work well with highlight.js. I'm sure something I did could be simpler, but it boils down to:
- a Lua filter to put attributes on the "correct" HTML tags
- a slightly modified revealjs template
Here's the demo. Feedback is welcome. I'm going to try to use this in my teaching workflow.
https://github.com/ghamerly/pandoc-revealjs-highlightjs
As suggested in that Discussion, we could modify the revealjs writer to generate code suitable for reveal's built-in highlighting if the idiomatic highlighting option is selected.