How to add a blank caption for a figure in AsciiDoc

657 views Asked by At

I have an AsciiDoc page which has a number of images. I am converting this into html via antora.

On my AsciiDoc page, some of the images have a caption and some do not.

For the images with a caption, the first one is named "Figure 1. Some interesting caption", then the second one is named "Figure 2. Some fascinating caption" and so on. In fact, the "Figure 1", "Figure 2" text is added automatically by Antora. In AsciiDoc itself, the markup is as follows:

.Some interesting caption;

image::images/image1.png


.Some fascinating caption;

image::images/image2.png

However, now I have a third image which has no caption to display. I would like this image to simply read "Figure 3". However, I do not know how to do this. The only thing I could come up with is to put some character after the "." symbol just above it (I chose a semi-colon), as follows:

.;

image::images/image3.png

This produces "Figure 3;" once converted into html.

It's better than nothing, but I would like to be able to use, for example, a whitespace character, instead of the semi-colon, so that I could simply produce text that reads "Figure 3 " (with an invisible whitespace character that nobody can see). Unfortunately, if I try to do that, the whitespace is ignored and I just see the '.' character in the generated html.

1

There are 1 answers

0
eskwayrd On

You can use an attribute for the non-breaking space: {nbsp}

For example:

.Some interesting caption;
image::images/image1.png[]

.Some fascinating caption;
image::images/image2.png[]

.{nbsp}
image::images/image3.png[]

Note that I added square brackets to each image macro invocation, because those lines are just text with them. And, there doesn't need to be a blank line between the caption and its associated image.