Markdown formatting in image captions
I've noticed that when adding captions using the Markdown syntax ![Caption goes here.](image_url.png)
that I'm unable to use Markdown to format the caption. For example on this post, 'Ted Lasso' is supposed to be italicized and the '⌘' character in the caption is supposed to direct link to the full-size image, but it's not rendered that way. Is there a way to make the engine check for markdown formatting within that text caption area? Here's the raw text for that particular link:
![Black shirt with *Ted Lasso* character names in white text. [⌘](https://ik.imagekit.io/heydingus/afc-richmond-squad_N_fQ5BWYs)](https://ik.imagekit.io/heydingus/afc-richmond-squad_N_fQ5BWYs)
(I have the 'Create a caption from the image’s alt text' option checked in settings.)
No, this is not possible at the moment due to the way the markdown parser works. One workaround is to skip the markdown and just mix the desired HTML right into your post:
<p>
<img src="https://ik.imagekit.io/heydingus/afc-richmond-squad_N_fQ5BWYs">
<span class="caption">Black shirt with <em>Ted Lasso</em> character names in white text. ⌘</span>
</p>
Does that help you work around the issue for now?
Answered 2 years ago · Edit answerI've got a similar workaround that should be good enough for now. I put the actual caption (as opposed to specifically alt text) into a <figcaption>
tag right after the ![]()
syntax, which I've styled the same as the other captions in the CSS file. And then I disabled the setting to convert alt text to a caption.
Example:
![Cartoon girl surrounded by icons for services.](https://ik.imagekit.io/heydingus/App_Store_Report_Hero_TybCxyYgkt)
<figcaption> Apple's never made that iPhone.</figcaption>
That will work for now! (I'm also hoping that this will be better for folks using screen readers by including both the alt text and caption for them?)
Would you consider an adaptation to the Markdown parser to include that alt text/caption area in the future?
Answered 2 years ago · Edit answerI would but this will take a little while – messing with the markdown parser is complicated at this point!
Answered 2 years ago · Edit answer