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.
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
Hy @bicarlsen, thanks for making such a wonderful plugin. Before your plugin my work around was to use a snippet. But this made it quite simple.
I have two requests,
Add an option to number the figures in decimals, currently we can only number them from 1, 2, … . and it would be much helpful we can number them as 1.1, 1.2, … 2.1, 2.2,…3.1 …
Also make a plugin (or add functionality in this one) for table captions, I searched a lot and adding table captions are cumbersome. A simple plugin, as this one, will help a lot.
I also miss this function, but I miss it for all the embeds. I would also like to be able to attach a caption to for instance a PDF or a YouTube video.