Do not advertise the first title of the document.
settings_overrides, publish_parts() :
rest_content = """
I should be an h1
=================
I should be an h2
-----------------
foo
I should also be an h2
----------------------
foo
"""
from docutils.core import publish_parts
parts = publish_parts(rest_content, writer_name="html",
settings_overrides={'doctitle_xform':False})
html_snippet = parts['html_body']
print(html_snippet)
:
<div class="document">
<div class="section" id="i-should-be-an-h1">
<h1>I should be an h1</h1>
<div class="section" id="i-should-be-an-h2">
<h2>I should be an h2</h2>
<p>foo</p>
</div>
<div class="section" id="i-should-also-be-an-h2">
<h2>I should also be an h2</h2>
<p>foo</p>
</div>
</div>
</div>