Awesome Asciidoctor: Change Number Style For Ordered Lists
To write a (nested) ordered lists in Asciidoctor is easy.
We need to start the line with a dot (
.) followed by a space and the list item text.
The number of dots reflects the levels of nesting.
So with two dots (
..) we have a nested list item.
By default each nested level has a separate numbering style.
The first level has arabic numbering, the second lower case alphanumeric, the third upper case alphanumeric, the fourth lower case roman and the fifth (which is maximum depth of nested levels in Asciidoctor) has style upper case roman.
But we can change this by setting a block style for each nested level block.
The name of the block style is
With the HTML5 backend we can also use
In the following example we have an ordered list where we set different block styles for the nested level:
= Nested numbering styles .Services [arabic] .. Datastore .. Mail . Repositories // Only HTML backend [decimal] .. PostgresDB .. Redis . Controllers // Only HTML backend [lowergreek] .. API .. Admin . Software systems // Or use upperalpha for upper case alphanumeric [loweralpha] .. OAuth . Operatings systems // Or use lowerroman for lower case roman [upperroman] .. Linux [decimal] ... Server A ... Server B .. macOS .. Windows server
When we create the HTML output we have the following result:
Written with Asciidoctor 1.5.4.