Re: Gradle AsciiDoctor PDF: Syntax Highlighting
Posted by
mojavelinux on
Jul 30, 2015; 10:32pm
URL: https://discuss.asciidoctor.org/Gradle-AsciiDoctor-PDF-Syntax-Highlighting-tp3590p3591.html
Erik,
AsciidoctorJ PDF supports two syntax highlighters, CodeRay and Rouge. That's one less than Asciidoctor PDF because the pygments.rb gem doesn't work on JRuby (or we can't figure it out), taking Pygments off the table.
Rouge is the better choice between the two. It's modeled after Pygments and supports most of the languages that Pygments supports, including Scala. (It's also reasonable to extend).
To enable it, install the rouge gem:
$ gem install rouge
Then set the source-highlighter attribute to "rouge".
ifdef::backend-pdf[]
:source-highlighter: rouge
endif::[]
However, that won't work until AsciidoctorJ PDF 1.5.0-alpha.9 is released, which I'm working on right now. I'll make sure to bundle the rouge gem so you don't have to worry about installing it. You'll just have to wait a few days.
Cheers,
-Dan