Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

sublist numbering in asciidoc

I need to display a list with this exact format:

1. First item 1.1. Subitem 1.1.1. Sub-subitem 1.1.2. Sub-subitem 1.2. Subitem 2. Second item ...

Is there a way to achieve this using asciidoc?

The closer way I found is using horizontal labeled lists, but the rendering differs from a normal numbered list.

like image 850
joanq Avatar asked Dec 07 '25 20:12

joanq


1 Answers

If you want CSS to do the Job of numbering, you an apply this solution to Asciidoctor

++++
<style>
ol {
  list-style-type: none;
  counter-reset: item;
  margin: 0;
  padding: 0;
}

ol > li {
  display: table;
  counter-increment: item;
  margin-bottom: 0.6em;
}

ol > li:before {
  content: counters(item, ".") ". ";
  display: table-cell;
  padding-right: 0.6em;
}

li ol > li {
  margin: 0;
}

li ol > li:before {
  content: counters(item, ".") " ";
}
</style>
++++

. First item
.. Subitem
... Sub-subitem
... Sub-subitem
.. Subitem
. Second item

Will produce

enter image description here

like image 74
ahus1 Avatar answered Dec 09 '25 22:12

ahus1



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!