I am styling a blog where the posts are in Markdown format. Images are wrapped in <p>
tags when converted to HTML. The first paragraph after an image is the caption, and needs specific styling applied to it.
For example:
<p>Regular paragraph.</p>
<p><img src="/images/puppy.jpg" alt="Puppy" /></p>
<p>This is the caption.</p>
<p>Another paragraph.</p>
Is there a way to select only the paragraphs that follow a paragraph with an <img>
tag in them? Something like this, perhaps? (Except that it doesn't work.)
p img + p {
text-decoration: underline;
}
I'd rather not have to go into all the posts and manually add classes to all the captions if I don't have to.
EDIT: This is a Middleman blog (4.2.1) using Redcarpet (3.4.0).