when using a first-level markdown heading (#) in a topic will that result in h1 or h2 in the HTML output?
It will output a <h1> ![]()
so does that mean that Discourse assumes that it’s nice to have multiple <h1> tags in a page? Seems like if the topic title is h1, then first-level headings inside that topic should be h2 by default, no?
Discourse doesn’t assume anything, it will output what you ask it to output.
It’s better practice to use ## as top-level headings inside a post for sure ![]()
That is definitely some “user education” I think we could spare ourselves by not making # be a level 1 heading… ![]()
Do you know if there is any way to change that? Or at least hide level 1 headings in the toolbar? (I’m guessing people writing directly in Markdown are a realistic education target…)
Yes, it’s pretty straightforward. The list element has a data-name="heading-1" attribute that you can target with CSS ![]()
Heh - I was just looking into it too. In a quick test, this hides the H1 option in both the markdown and rich text composer:
button[data-name="heading-1"] {
display: none;
}
(I may just keep this! I don’t see much reason to offer H1 in the composer.)
I can see your point, but this isn’t something that Discourse necessarily decided one way or another. Discourse follows a markdown convention called CommonMark, and it specifies that # should be converted into an H1. I think this convention for how markdown headings are converted to HTML tags is pretty standard across major markdown specifications.
Well, two <h1> headings isn’t that big question actually. It is really old SEO meme, that hasn’t been an issue long time now. Google etc. will use the first one or what ever they think is the most suitable.
We can discuss if two main headers is the most smart move contwnt wise, but when a platfprm will use different style for topic name and headers in posts it doesn’t really matter.
Still it is more suitable to use ##/<h2> in posts. But because it doesn’t play any actual role, my opinion is it is better that users use some headers that avoid those because they are afraid of using ”wrong” headers ![]()
Headings may only be a small signal for SEO today – but I still dislike multiple H1s because I’m a nerd. ![]()
I’m also thinking about how Steph is creating printable documentation for Page Publishing, where H1s in the post are rendering even larger than the page top H1:
Making those H2 would keep them slightly smaller than the top H1:
Yeah that’s the problem. For me it’s natural to use the first-level header first, but if the theme isn’t styled with the same assumption, it’s messy. There’s a kind of disconnect here.
(Side-note: is it showing the doc to you en English without intervention of your part?!?)
That’s natural, yes, and it makes sense when you’re building a web page from scratch. But a CMS or publishing system almost always gets the page’s H1 from a title field, so you’d typically reach for H2 for the content sections.
(And I used the web browser’s translation tool to get English.)

