Closed john-cj closed 5 years ago
The source block provides syntax highlighting (when a language is specified). The listing block does not.
But what's the reason to have [listing]
whereas language-less [source]
can accomplish the same task, without any downsides?
If the listing style is used on the listing block, it's redundant. But it can also be used on the literal block (to provide an alternate boundary syntax if the content happens to contain a line with 4 hyphens).
Langues-less source should never be used unless you have defined a global language (using the source-language
attribute, which is the use case for that syntax).
Understood, thanks.
I have carefully read the docs, but haven't found any explanation about the difference between
[source]
and[listing]
. Here is the Asciidoctor markup and corresponding HTML:So, from what I see I could say that
[listing]
is reserved for monospaced computer-related text, like pseudo-tables. Not sure, though. Is it correct assumption?