Post navigation

Awesome Asciidoctor: Using Paragraphs in Lists With List Item Continuation

When we write a list in Asciidoctor we can simply create a list item by starting the line with a dot (.). To create a another list item we simply start a new line with a dot (.). But what if we want to add a list item with multiple paragraphs, or text and a source code block element. We can use the list item continuation (+) to indicate to Asciidoctor we want to keep these together for a single list item.

In the following example we have a list in Asciidoctor markup. The second list item has multiple paragraphs , the third item has an extra admonition block and the fourth item contains a source code block:

1

2

3

4

5

6

7

8

9

10

11

12

13

14

15

16

17

18

19

20

21

22

23

24

25

26

:icons:font

==List continuation

When we havealist item that has forexample multiple paragraphs,

we can useAsciidoctor's list continuation feature. We place a

`+` symbol between the paragraphs to indicate the paragraphs

belong to a single list item.

=== Sample list

. A very simple first item

. This item consists of two paragraphs.

+

By adding the `+` symbol we indicate this

paragraph also belongs to the second list item.

. We can even add for example an admonition.

+

TIP: Did you know Asciidoctor is awesome?

. A small code example:

+

[source,groovy]

----

println 'Groovy rocks!'

----

. Let'sendwithasimple list item.

Let’s generate this Asciidoctor markup to HTML and we see the following result:

We see how the extra paragraph, admonition and source code are part of a single list item.

About mrhaki

My name is Hubert A. Klein Ikkink also known as mrhaki. I work at the great IT company JDriven. Here I work on projects with Groovy & Grails, Gradle and Spring. At JDriven we focus on SpringSource technologies. All colleagues want to learn new technologies, support craftmanship and are very eager to learn. This is truly a great environment to work in. You can contact me via Google+ or @mrhaki.