<commit_before>= Syntax Highlighting

[#install]
== Install a syntax highlighter

To syntax highlight source listings, you need to install Rouge, Pygments, or CodeRay.
Choose one (or more) of the following:

.Rouge
 $ gem install rouge

.Pygments
 $ gem install pygments.rb

.CodeRay
 $ gem install coderay

[#activate]
== Activate syntax highlighting

Once you've installed a syntax highlighter, you need to activate it for a given document by setting the `source-highlighter` attribute in the document header and assigning it the keyword value of the applicable library.

[,asciidoc]
----
= Document Title
:source-highlighter: rouge
----
<commit_msg>explain more clearly which syntax highlighters are supported; declare Rouge as the preferred choice [no ci]<commit_after>= Syntax Highlighting

[#install]
== Install a syntax highlighter

To add source highlighting to source blocks, you must have a suitable syntax highlighter installed.
Asciidoctor PDF performs source highlighting during conversion, which means you must use a build-time syntax highlighter.

The build-time syntax highlighters that Asciidoctor PDF supports out of the box are Rouge, Pygments, and CodeRay.
Rouge is the preferred syntax highlighter.

To install Rouge, Pygments, or CodeRay, run the corresponding gem command shown below.

.Rouge
 $ gem install rouge

.Pygments
 $ gem install pygments.rb

.CodeRay
 $ gem install coderay

Alternately, you can declare the gem in your [.path]_Gemfile_ to manage it using Bundler.

[#activate]
== Activate syntax highlighting

Once you've installed a syntax highlighter, you need to activate it for a given document by setting the `source-highlighter` attribute in the document header and assigning it the keyword value of the applicable library.

[,asciidoc]
----
= Document Title
:source-highlighter: rouge
----

{'fraction_non_alphanumeric': 0.06168122270742358, 'fraction_numerical': 0.0, 'mean_word_length': 4.657407407407407, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '6639604', 'n_tokens_mistral': 515, 'n_tokens_neox': 492, 'n_words': 242}