Custom CSS for a paragraph in Middleman v4

Hi, I’d like to have an option in my site to apply specific CSS styles to certain paragraphs.

This looks very similar to what was discussed in Custom CSS per blocks of paragraphs with Redcarpet, but the answers provided there appear to be for older versions of Middleman. The after_render method cited there appears to not exist in MM v4.

Can someone provide an updated version of this? Or at least a toehold to start from?

Thank you!

-Eric

Even assuming the event was there, I’m not sure this was the one you need.
Why do you want to change the paragraph style after the site is built and not while you’re building it.

Just apply some if logic while carrying some variable in the front matter or at template level and you will be able to do it.

@scouten, what kind of language are we talking about? I assume Markdown. The default Kramdown gem supports extensions to Markdown syntax, also to apply styles to elements, both block and inline. Example of paragraph styling:

This is a paragraph of text.
{: .stylename}

Kramdown docs

1 Like