summaryrefslogtreecommitdiff
path: root/docs/modules/syntax-highlighting
diff options
context:
space:
mode:
authorDan Allen <dan.j.allen@gmail.com>2021-05-03 15:32:46 -0600
committerDan Allen <dan.j.allen@gmail.com>2021-05-03 15:32:46 -0600
commit96986cfb89c2b68c263eade17bd4d86d684077d3 (patch)
tree7dd59c32b8b4e76173b6a3a3fbf54bfc5a6c03d2 /docs/modules/syntax-highlighting
parent92cd7282d00aed76b7b7d53619ced9e48d58fb87 (diff)
be more clear about how to set the rouge style and provide an example [skip ci]
Diffstat (limited to 'docs/modules/syntax-highlighting')
-rw-r--r--docs/modules/syntax-highlighting/pages/rouge.adoc23
1 files changed, 21 insertions, 2 deletions
diff --git a/docs/modules/syntax-highlighting/pages/rouge.adoc b/docs/modules/syntax-highlighting/pages/rouge.adoc
index 8709cb14..b710f7d3 100644
--- a/docs/modules/syntax-highlighting/pages/rouge.adoc
+++ b/docs/modules/syntax-highlighting/pages/rouge.adoc
@@ -40,7 +40,7 @@ Controls what method is used for applying CSS to the tokens.
Can be `class` or `style`.
Default: `class`.
-[.line-through]#rouge-linenums-mode# (not currently implemented)::
+[.line-through]#rouge-linenums-mode# (not currently implemented, see https://github.com/asciidoctor/asciidoctor/issues/3641[#3641])::
Controls how line numbers are laid out.
Can be `table` or `inline`.
If line wrapping is enabled on preformatted blocks (i.e., `prewrap`), and you want to use line numbering on source blocks, you must set the value of this attribute to `inline` in order for the numbers to line up properly with their target lines.
@@ -50,12 +50,29 @@ rouge-style::
Controls the color theme used to for highlighting.
You can find the list of themes in the {url-rouge-repo}[Rouge code repository^].
+Typically, you set these attributes using the CLI or API (e.g., `-a source-highlighter=rouge -a rouge-style=colorful`) so you don't have to define them in each document.
+However, you can define them per document as shown in the following example.
+
+.Activating the Rouge syntax highlighter and applying a different style
+[source,asciidoc]
+....
+:source-highlighter: rouge
+:rouge-style: monokai
+
+[source,ruby]
+----
+puts "Hello, Rouge!"
+----
+....
+
+You can enable line numbering using the linenums option on the block.
+
.Customizing a source block with Rouge line numbers
[source,asciidoc]
....
:source-highlighter: rouge
-[source,ruby,linenums]
+[source%linenums,ruby]
----
ORDERED_LIST_KEYWORDS = {
'loweralpha' => 'a',
@@ -68,3 +85,5 @@ ORDERED_LIST_KEYWORDS = {
}
----
....
+
+It's also possible to enable linenums for all source blocks by setting the `source-linenums-option` attribute on the document.