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.
$ gem install rouge
$ gem install pygments.rb
$ gem install coderay
Alternately, you can declare the gem in your Gemfile to manage it using Bundler.