When docutils generates an HTML file, the DOM is not the same if there is only one paragraph or several one in a container.
For example:
paragraphe
paragraphe
The demo shows it can be a problem visualy if the p tag has specific CSS. The CSS will be applyied in the second case but not in the first case.
You can check the demo by extracting the attached archive, cd demo and run:
$ rst2html.py --stylesheet style.css demo.rst demo.html
It work properly with rst2html5.
I read the source code and I found the visit_container() function however I failed to find where it's called.
The behaviour is limited to the "legacy" HTML writer html4css1. It is documented as intended in the docstring of docutils.writers.html4css1.HTMLTranslator:
The simple workaround would be to use the html5 writer or adapt your CSS definitions.
If you need XHTML 4.1 for some reason, the function to look at would be
should_be_compact_paragraph() in docutils/writers/html4css1/init.py which is called by
visit_paragraph() in the same module.