reveal.js is well integrated with Highlight.js for syntax highlighting.
Asciidoctor reveal.js supports that.
You can activate Highlight.js syntax highlighting (disabled by default) by setting the
source-highlighter document attribute as follows:
= Presentation Title // [...] other document attributes :source-highlighter: highlight.js
By default, we are using a prebuilt version of Highlight.js with 34 commonly used languages hosted on cdnjs.
You can load additional languages using the
You can also load Highlight.js from a custom base directory (or remote URL) using the
Once enabled, you can write code blocks as usual:
== Slide Five Uses highlighted code [source, python] ---- print "Hello World" ----
[source] blocks and blocks delimited by
---- will be highlighted.
[listing] block will not be highlighted.
highlight.js does language auto-detection but using the
language="…" attribute will hint the highlighter.
For example this will highlight this source code as Perl:
== Slide Five [source,perl] ---- print "$0: hello world\n" ----
Alternatively, you can use Rouge, Coderay or Pygments as syntax highlighters,