I have a simple markdown file containing an image:

I'm using the GitHub viewer and there I see the image fine, but without the title / caption. Is there any way to solve this?
Markdown's link / image titles aren't the same as captions, and Markdown itself has no support for captions.
However, since Markdown supports inline HTML, you can caption images using <figure> and <figcaption>.
Here is an example from the previous MDN link:
<figure>
<img
src="https://developer.mozilla.org/static/img/favicon144.png"
alt="The beautiful MDN logo.">
<figcaption>MDN Logo</figcaption>
</figure>
I don't like HTML in Markdown. This is why here an idea to solve it with plain markdown. The markdown (set two css-classes to the p-wrapper) and the logo_caption inside the p-wrapper. Title and Alt were already there.
{: .cssclass1 .cssclass2 }

*logo_caption*
Output as HTML
<p class="cssclass1 cssclass2">
<img src="/assets/img/logo.jpg" alt="Logo" title="Logo title">
<em>logo_caption</em>
</p>
The styling can be done in CSS.
Tested in jekyll v4.2 and kramdown.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With