Including code blocks in a list without breaking the item numbering

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
4 messages Options
Reply | Threaded
Open this post in threaded view
|

Including code blocks in a list without breaking the item numbering

awilkinson
We've got a section in the Spring Boot docs where we're using code blocks within a list. It produces warnings at build time and the item numbers are incorrect in the generated documentation: 1, 2, 1, 1, 1 instead of 1, 2, 3, 4, 5.

It's a bit of a hack, but I've tried using ["arabic", start=n] (where n is 3, 4, or 5) to start the "new" lists with the right number. Unfortunately, it had no effect.

How can we use code blocks as part of an item in a list and retain the correct item numbering?
Reply | Threaded
Open this post in threaded view
|

Re: Including code blocks in a list without breaking the item numbering

LightGuardjp
You can "nest" block content in a list by using '+':

[source, asciidoc]
====
. Here is some content.
+
Here's a new paragraph
+
. Second line
====

Hope that helps. 

Sent from Mailbox


On Wed, Jun 4, 2014 at 6:21 AM, awilkinson [via Asciidoctor :: Discussion] <[hidden email]> wrote:

We've got a section in the Spring Boot docs where we're using code blocks within a list. It produces warnings at build time and the item numbers are incorrect in the generated documentation: 1, 2, 1, 1, 1 instead of 1, 2, 3, 4, 5.

It's a bit of a hack, but I've tried using ["arabic", start=n] (where n is 3, 4, or 5) to start the "new" lists with the right number. Unfortunately, it had no effect.

How can we use code blocks as part of an item in a list and retain the correct item numbering?


If you reply to this email, your message will be added to the discussion below:
http://discuss.asciidoctor.org/Including-code-blocks-in-a-list-without-breaking-the-item-numbering-tp1781.html
To start a new topic under Asciidoctor :: Discussion, email [hidden email]
To unsubscribe from Asciidoctor :: Discussion, click here.
NAML

Reply | Threaded
Open this post in threaded view
|

Re: Including code blocks in a list without breaking the item numbering

awilkinson
Thanks very much, that did the trick.
Reply | Threaded
Open this post in threaded view
|

Re: Including code blocks in a list without breaking the item numbering

mojavelinux
Administrator
Andy,

Another convention I strongly recommend when using complex content in a list item is to nest that content in an open block. The open block effectively becomes a "catch-all" container that explicitly sets the boundaries of the list item.

Here's an example:

. Item #1
+
--
attached paragraph

[source,java]
----
public class Person {
  private String name;
  // ...
}
----

another paragraph
--

. Item #2

We are discussing the option of allowing the list continuation lines (the lines with the + sign) to be indented so they are easier to trace. Many users, including myself, sense a friction with aligning the list continuation with the margin. See https://github.com/asciidoctor/asciidoctor/issues/686.

Cheers,

-Dan


On Wed, Jun 4, 2014 at 10:51 AM, awilkinson [via Asciidoctor :: Discussion] <[hidden email]> wrote:
Thanks very much, that did the trick.


If you reply to this email, your message will be added to the discussion below:
http://discuss.asciidoctor.org/Including-code-blocks-in-a-list-without-breaking-the-item-numbering-tp1781p1783.html
To start a new topic under Asciidoctor :: Discussion, email [hidden email]
To unsubscribe from Asciidoctor :: Discussion, click here.
NAML



--