Over a million developers have joined DZone.
{{announcement.body}}
{{announcement.title}}

Awesome Asciidoctor: Change Number Style for Ordered Lists

DZone's Guide to

Awesome Asciidoctor: Change Number Style for Ordered Lists

It's easy to use Asciidoctor to write beautiful (nested) ordered lists.

Free Resource

Migrating from On-Prem to Cloud Middleware? Here’s what Aberdeen Group says leading companies should be considering. Brought to you in partnershp with Liaison Technologies

Writing (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 has alphanumeric, the third upper case has alphanumeric, the fourth lower case has Roman, and the fifth (which is the maximum depth of nested levels in Asciidoctor) has a style of uppercase Roman.

We can change this by setting a block style for each nested level block. The name of the block style is arabic, loweralpha, upperalpha, lowerromann, or upperroman. With the HTML5 backend, we can also use decimal and lowergreek.

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.

Is iPaaS solving the right problems? Not knowing the fundamental difference between iPaaS and iPaaS+ could cost you down the road. Brought to you in partnership with Liaison Technologies.

Topics:
asciidoctor ,integration ,ordered lists ,nested classes

Published at DZone with permission of Hubert Klein Ikkink, DZone MVB. See the original article here.

Opinions expressed by DZone contributors are their own.

THE DZONE NEWSLETTER

Dev Resources & Solutions Straight to Your Inbox

Thanks for subscribing!

Awesome! Check your inbox to verify your email so you can start receiving the latest in tech news and resources.

X

{{ parent.title || parent.header.title}}

{{ parent.tldr }}

{{ parent.urlSource.name }}