This project provides an Asciidoctor extension for highlighting source listing blocks using Rouge – a pure-ruby code highlighter that is compatible with pygments.

It supports all Asciidoctor features such as callouts, highlighting of specified lines (attribute highlight), passthroughs inside a code and all other substitutions.

This extension is highly customizable and modular.

NOTICE: Asciidoctor already supports for Rouge since version 2.0.0, so this extension is not needed anymore.

Installation

To install (or update to the latest version):

gem install asciidoctor-rouge

or to install the latest development version:

gem install asciidoctor-rouge --pre

Usage

Assign rouge to the source-highlighter attribute in your document’s header or via command-line argument.

asciidoctor -r asciidoctor-rouge -a source-highlighter=rouge Example.adoc

Attributes

You can further customize the source block output with additional Rouge attributes:

rouge-css

Controls what method is used for applying CSS to the tokens. Can be class (CSS classes) or style (inline styles). When class is used, Rouge styles for the specified theme are included in an HTML header. Default is class.

rouge-theme

Sets the name of the Rouge colour theme to use. Look into lib/rouge/themes in the Rouge repository for a list of available themes. Default is github.

rouge-style

Alternative name for the rouge-theme for compatibility with asciidoctor-pdf (see #3).

License

This project is licensed under MIT License. For the full text of the license, see the LICENSE file.