'Asciidoc: How do I preserve both spacing and formatting
I need to produce the following output in asciidoc format, exactly as shown, including the spacing (it's VERY important that the columns line up), the font colouring and formatting and highlighting, and keep the asterisks at the start of the line.
As a code block, I can get the spacing OK, keep all the special characters, but loose all the formatting. And the formatting is as important as the text, if not here precisely, but in many other places. No sense in having copy referring to the highlighted element in a block of text that is not capable of showing highlighting.
aciextrtr# show ip bgp vrf BGP-FXX
...<output omitted>...
Network Next Hop Metric LocPrf Weight Path
*>l1.F.0.XX/32 0.0.0.0 100 32768 i
*>l10.FXX.3.0/24 0.0.0.0 100 32768 i
*>l10.FXX.20.0/24 0.0.0.0 100 32768 i
Curiously, the BEST I've been able to discover is the [verse] block , but it has ridiculously wide spacing between lines, and I had to escape a few special characters (* and the ellipses).
As a kludge, perhaps there is a way of re-defining [verse] so that it doesn't leave huge gaps between lines, but hopefully there is a way defining my own model based on verse that does what I want.
Curiously, Visual Studio code renders it more accurately than https://asciidoclive.com/edit/scratch/1 - I'd paste the source here but of course it won't render properly in this environment (strips back-ticks etc)
TIA
Solution 1:[1]
You can use a literal block to specify a monospace font and keep the lines together. Use the subs attribute to re-enable inline formatting.
For example:
[subs="+quotes"]
----
... <ellipses are not substituted> ...
*>l1.[.red]##F##.0.XX/32 #0.0.0.0# 100 32768
----
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|---|
| Solution 1 |


![rendered using [verse]](https://i.stack.imgur.com/j0cKf.png)