New: Learn Statamic on Laracasts!

We've retired the forum in favor of GitHub Discussions.

New conversations can be started on GitHub. Existing conversations will remain for a while longer.

Head over to GitHub →

Extending the markdown modifier

Alexander Stoffel May 12, 2020 by Alexander Stoffel

Is there a way to add classes to elements within the standard markdown output? I have a bard field that contains (among others) text areas which can include headlines etc.

I need to find a way to add a specific class to each h2, h3, and h4. We are utilizing tailwind.css and calculating fluid font sizes using a plugin ( Since the plugin's output can't be added to a selector in css (e.g. h2), I have to add the class into the html output.

So to make it clear, instead of the bard printing text as


I would like the output to be

<h2 class="font-h2-fluid">headline</h2>

This will be applied globally and the classes will always be the same.

Anybody have an idea how that could easily be achieved?

Answered by Alexander Stoffel!
>>>>>>> Answered <<<<<<<
3 Replies