Adding caption to images

Use case or problem

As far as I know, there is currently no “official” way to add a caption to an image.

Proposed solution

I would suggest, that an image with nonempty alt text, occurring by itself in a paragraph, will be rendered as a figure with a caption. The image’s alt text will be used as the caption. Inline Markdown in the alt text should be interpreted.

That means that following Markdown snippet

![This is the caption](image.png)

or

![[image.png|This is the caption]]

will be rendered as something like

<figure>
    <img src="path/to/image.png" />
    <figcaption>This is the caption</figcaption>
</figure>

This is the way pandoc with the implicit_figures extension handles figure captions in Markdown documents.

Concerning implementation details I would suggest to make this behavior optional as an extension.

Current workaround

16 Likes

There is a Discordian theme which can render the image caption.

I agree that it would be great if this feature can be implmented in the core if that’s what you’re asking.

@obsidian337 Thank you for the hint!

I already use a very similar workaround (see my workaround link above). The biggest disadvantage of this approach for me, however, is that inline Markdown in the alt text will not be interpreted, so you can not use e.g. inline math in caption text.

This would be a really nice feature.
I use Obsidian to study and one of my professors uses a lot of diagrams, would help me so much to be able to caption those

Seconded, I too would like the alt text to be displayed beneath the image.

+1 for this feature request.

Take my +1