asciidoc

In Asciidoc (and Asciidoctor), how do I format console output best?


In my adoc document, I want to show some output logging to the console.

Should I use [source], [source,shell] or nothing before the ----?

----
Solving started: time spent (67), best score (-20init/0hard/0soft), environment mode (REPRODUCIBLE), random (JDK with seed 0).
    CH step (0), time spent (128), score (-18init/0hard/0soft), selected move count (15), picked move ([Math(101) {null -> Room A}, Math(101) {null -> MONDAY 08:30}]).
    CH step (1), time spent (145), score (-16init/0hard/0soft), selected move count (15), picked move ([Physics(102) {null -> Room A}, Physics(102) {null -> MONDAY 09:30}]).    
----

I'd argue it's not really source code (it's output) and I definitely don't output text that happen to contain shell language syntax to be code colored as shell language (because it's not).


Solution

  • You should use [source, console] for console commands and start with the $ sign to highlight the command. Lines without the $ sign after the command represent the output.

    To disable source highlighting for a given source block, specify the language as text or remove the source style.

    Alternatively, you can use [listing] for console output.

    [source, shell] is used to highlight shell script files.

    https://docs.asciidoctor.org/asciidoc/latest/verbatim/source-highlighter/#shell-vs-console