How should I write the Asciidoc(tor) to have the following output:
* item 1
* item a
paragraph 1 inside item a
* item a.1 inside paragraph 1 inside item a
paragraph a.1 inside item a.1
* item a.2 inside paragraph 1 inside item a
paragraph a.2 inside item a.1
paragraph 2 inside item a
* item b
paragraph 1 inside item b
* item 2
UPDATE: @TigerTV.ru suggested a nice trick, but it requires the capability to hide the bullets in bullet lists. How can this be done?
Thanks
You can make unordered lists in AsciiDoc by starting the lines with a designated marker. An unordered list is a list with items that are prefixed with symbol, such as a bullet. AsciiDoc builds on the well-established convention of using an asterisk or hyphen to identify a list item.
Nesting lists A nested list – a list within a list – is a numbered or bulleted list with subordinate (usually indented) numbered or bulleted lists.
To do this, simply press 'shift + enter' on your keyboard when your cursor is at the end of a list item, and the next list item will be indented. There won't be any bullet (or number), on the indented line, so I recommend you add a dash '-' character, followed by a space and then your content.
https://asciidoctor.org/docs/user-manual/#attaching-to-an-ancestor-list:
You may find that you need to attach block content to a parent list item instead of the current one. In other words, you want to attach the block content to the parent list item so it becomes a sibling of the child list. To do this, you add a blank line before the list continuation.
* parent list item ** child list item + paragraph attached to parent list item
More complex example:
* Foo
** Aaa
** Bbb
+
Continuation of Foo
* Bar
+
Continuation of Bar
* Baz
+
Continuation of Baz
** Ccc
** Ddd
* Xyz
Notes:
You need blank line after Bbb. This is by design:
The blank line signals to the list continuation to move out of the current list so it attaches the block to the last item of the parent list.
You also need blank line before Ccc. This is currently an open issue #2509.
A block attached to the grandparent list item:
* grandparent list item ** parent list item *** child list item + paragraph attached to grandparent list item
Using blank lines to back out of the nesting may feel fragile. A more robust way to accomplish the same thing is to enclose the nested lists in an open block. That way, it’s clear where the nested list ends and the enclosing list continues:
* grandparent list item + -- ** parent list item *** child list item -- + paragraph attached to grandparent list item
Think this will work:
* item 1
** item a +
paragraph 1 inside item a
+
--
*** item a.1 inside paragraph 1 inside item a +
paragraph a.1 inside item a.1
*** item a.2 inside paragraph 1 inside item a +
paragraph a.2 inside item a.1
--
+
paragraph 2 inside item a
** item b +
paragraph 1 inside item b
* item 2
Tested with Asciidoctor 1.5.6.1
.
You can use several asterisks for levels:
* item 1
** item a
*** paragraph 1 inside item a
**** item a.1 inside paragraph 1 inside item a
**** item a.2 inside paragraph 1 inside item a
*** paragraph 2 inside item a
** item b
*** paragraph 1 inside item b
* item 2
https://asciidoctor.org/docs/asciidoc-syntax-quick-reference/#lists
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With