2

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.

joanq
  • 1,416
  • 2
  • 10
  • 12

3 Answers3

0

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

ahus1
  • 5,782
  • 24
  • 42
0

This is for PDF

Put this file into document folder and run asciidoctor-pdf -r ./numbers.rb example.adoc

-1

Closer solution I found so far:

{empty}1. First item +
{nbsp}{nbsp}1.1. Subitem +
{nbsp}{nbsp}{nbsp}{nbsp}1.1.1. Sub-subitem +
{nbsp}{nbsp}{nbsp}{nbsp}1.1.2. Sub-subitem +
{nbsp}{nbsp}1.2. Subitem +
{empty}2. Second item +
...

Which renders as:

1. First item
  1.1. Subitem
    1.1.1. Sub-subitem
    1.1.2. Sub-subitem
  1.2 Subitem
2. Second item
...
joanq
  • 1,416
  • 2
  • 10
  • 12