Change initial header level in docutils

I use reStructuredText on parts of this site to write HTML content. But as the main headers don't originate from the rst content I need to start with an h2 tag. It's just a matter of rtfm but here's a solution.
from docutils.core import publish_parts
print publish_parts(rst_content, writer_name='html',settings_overrides={
'initial_header_level': 2,})['html_body']
2 comments
Reply