With Asciidoctor we can use images in our documents with the
When the document is converted each image gets a caption.
By default the caption label is Figure followed a number for the position of the image in the document.
So the first image has a caption Figure 1..
If we add a block title (text prefixed with a
.) to the image then that text is used in the caption as well.
We can customize the caption label, figure counter, caption text or disable the figure caption using a combination of document and
We have the following Asciidoctor markup.
We include several images and customize the figure caption settings.
To change the caption label (Figure) we set a different value for the document attribute
In our example we use the value
Logo. Any captions following this definition will have the label
To use a separate counter we can use a counter attribute inside the
caption attribute for our image.
In our example we use this for the Gradle logo.
If we want to use another caption text instead of the block title we can use the
title attribute for an image.
Finally to disable all figure captions we negate the
figure-caption document attribute.
= Figure caption
// Default the figure caption
// label is Figure.
// Set caption for figures
// for the rest of the document
// to the value Logo.
// The figure caption label is Logo.
// Custom caption label for this image
// where we can still use a counter.
// Instead of using the image block
// title in the caption we define
// our own caption text with the title
// Disable all captions for figures.
When we transform this markup to HTML we get the following output:
Written with Asciidoctor 1.5.4.