Login  Register

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

On Thu, Jul 30, 2015 at 6:37 AM, bodiam [via Asciidoctor :: Discussion] <[hidden email]> wrote:
Hi all,

I'm using the Gradle AsciiDoctor plugin to generate my documentation, and I use the prettify plugin to do syntax highlighting (because it's one of the few plugins which doesn't Scala highlighting).

However, when generating a PDF, the highlighting doesn't work, and all my text is black. It's not the biggest problem, but I was wondering if it was possible to fix this. Even if it's partial highlighting, like certain keywords, it would already be an improvement over 'just plain text' highlighting.

Thanks,

Erik


If you reply to this email, your message will be added to the discussion below:
http://discuss.asciidoctor.org/Gradle-AsciiDoctor-PDF-Syntax-Highlighting-tp3590.html
To start a new topic under Asciidoctor :: Discussion, email [hidden email]
To unsubscribe from Asciidoctor :: Discussion, click here.
NAML



--