HTML code on Obsidian Publish sites contains a <div> inside heading elements (<h1>, <h2>, etc.) which is not allowed by the HTML5 content model

Once you’ve done the above, delete everything above this line.

Steps to reproduce

Use Obsidian Publish to publish notes on the web. Any heading #, ##, ###, etc. will be represented by HTML header tags <h1>, <h2>, <h3>, which is the intended behavior. Header tags (h1, h2, h3, etc.) are incredibly important for search-engines and having a document properly structured is one of the really cool things that you can do very well in Obsidian in particular, and in Markdown in general. Unfortunately, however, the HTML code produced by Obsidian Publish includes a <div> tag inside the <h1> and subsequent header <h2> and <h3> tags:


And that is neither HTML5 best-practices, nor part of the actual HTML standard, which says that header elements (HTML Standard) may contain “phrasing content” (HTML Standard) only, and that list of tags does NOT include <div> tags.

As a result, these header tags are not properly processed by search engines, and even SEO analytical tools, such as are unable to see header tags in my blog published via Obsidian Publish.

Last, but not least, this <div> doesn’t actually do anything. Inside of the Obsidian software itself, these headers have little folding triangles in front of them and one can collapse or expand those sections of a document, which is super useful. But in the published version via Obsidian Publish those are missing and so that <div> element doesn’t even have any function and only disrupts SEO.

Did you follow the troubleshooting guide? [Y/N]


Expected result

The expected result would be to see the <div> tag that contains the folding mechanism outside and before the header tag, so <div>…</div> first, and then <h1>Actual Heading</h1>.

Actual result

See screenshot above.


Any site published via Obsidian Publish, e.g.

Additional information

See HTML specifications for header elements:,-h2,-h3,-h4,-h5,-and-h6-elements

Which states that they may contain “phrasing content” only:

So <div> tags insides of <h1> and other headers are not part of HTML standard.

1 Like

Thanks, we’ll look into it.

1 Like