Gradle AsciiDoctor PDF: Syntax Highlighting

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
4 messages Options
Reply | Threaded
Open this post in threaded view
|

Gradle AsciiDoctor PDF: Syntax Highlighting

bodiam
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
Reply | Threaded
Open this post in threaded view
|

Re: Gradle AsciiDoctor PDF: Syntax Highlighting

mojavelinux
Administrator
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



--
Reply | Threaded
Open this post in threaded view
|

Re: Gradle AsciiDoctor PDF: Syntax Highlighting

bodiam
Hi Dan,

Super, thanks for that. I'll change the highlighter to Rouge then, and I'll wait for alpha.9 for that.

Also, maybe nice to know, is that I just published this: http://jworks.nl/2015/07/31/getting-started-with-asciidoctor/

It will be (hopefully) the first in a series of posts.

Greets, Erik
Reply | Threaded
Open this post in threaded view
|

Re: Gradle AsciiDoctor PDF: Syntax Highlighting

mojavelinux
Administrator
Erik,

I'll be releasing Asciidoctor PDF 1.5.0.alpha.9 this weekend, hopefully with a quick turn around on AsciidoctorJ PDF to follow. I filed an issue to bundle Rouge so it can be used out of the box. See https://github.com/asciidoctor/asciidoctorj/issues/368

Thanks for writing that post about Asciidoctor & Gradle! I look forward to the rest of the series!

Cheers,

-Dan

On Fri, Jul 31, 2015 at 9:29 AM, bodiam [via Asciidoctor :: Discussion] <[hidden email]> wrote:
Hi Dan,

Super, thanks for that. I'll change the highlighter to Rouge then, and I'll wait for alpha.9 for that.

Also, maybe nice to know, is that I just published this: http://jworks.nl/2015/07/31/getting-started-with-asciidoctor/

It will be (hopefully) the first in a series of posts.

Greets, 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-tp3590p3596.html
To start a new topic under Asciidoctor :: Discussion, email [hidden email]
To unsubscribe from Asciidoctor :: Discussion, click here.
NAML



--