Adding classes to headings in {{content}} in post.hbs

Hello !

I’m looking for a clean way of adding specific classes to h2 and h3 on post.hbs.

Since the content is not customizable, we have to use {{content}} to show the content, how can I modify the way headings are displayed?

Right now the headings are displayed like this :

<h2 id="les-faits">Les faits</h2>

I use Tailwind as a framework and I want to have something like this:

<h2 id="les-faits" class="mb-2">Les faits</h2>

Any help would be very kind !!

PS : If there is any way to customize how are displayed too, it would be awesome!

Thanks a lot,

You could use javascript to add attributes to the H2s and H3s (setAttribute is the function you want). You could create those parts as HTML cards in the editor and add the attributes manually. Or you could set up your css to style them all based on being within the content div (the class of which varies from theme to theme). Or…?

Thanks for your answer but I was wondering if everything that goes under {{content}} is customizable or not. It seems that I need to modify the core which is not a good practice at all… The goal is to give access to ghost admin to anyone (not only developers) and to have something maintainable with only a few css lines.

I think I must set up some CSS with a specific class only for post page…