Things I have tried
What I’m trying to do
Why isn’t there a way to add a caption to a local image in one of my Obsidian markdown notes?
Why isn’t there a way to add a caption to a local image in one of my Obsidian markdown notes?
I’ve been using subscript <sup></sup>
on the line after the image to act as a caption.
Hi there is actually a way that was shared in the discord by @foreveryone that will use snippets:
![[imagename.jpg|left|200]]
<figcaption id="left" style="width:200px">This is a caption</figcaption>
Here is another possible workaround I’m currently using. You can display the image’s alt text as figure caption using the following CSS snippet:
.image-embed[alt]:after {
content: attr(alt);
display: block;
margin: 0.2rem 1rem 1rem 1rem;
font-size: 90%;
line-height: 1.4;
color: var(--text-faint);
}
Here an example:
Please note, however, that inline Markdown syntax in the alt text will be not interpreted.
Please, also see my feature request:
Thanks for the snippet. But even though I activated it as CSS snippet, it does not display the caption.
This is how I did. Am I missing anything?
(tried with theme and with no theme selected)
Unfortunately, this seems to work currently only for internal images (images saved inside your vault), referenced using relative path to the image file, e.g.
![Caption](image.png)
or
![[image.png|Caption]]
Oh okay! But it works now. Thank you so much
This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.