Reputation: 12376
I'm writing a blog in ascidoc and would like the code listings to be automatically numbered, e.g.
Listing 1.3 The Hello World code
...
Listing 1.4 Some other code sample
Is there an attribute that I can set for the entire text so asciidoc would automatically number code listings?
Upvotes: 2
Views: 1205
Reputation: 9507
It is not that clear in the asciidoctor user-manual (Listing Blocks), but in order for asciidoctor to number the listing you need to:
listing-caption
attribute at the begining of your documentExample:
:listing-caption: Listing
.The Hello World code
----
//TODO: add hello world code
----
.Some other code sample
----
//TODO: Some other code sample
----
Controlling the way the listing blocks are numbered (1.1, 1.2 in your example) is not that easy. There is a discussion on GitHub for that.
Upvotes: 3