<p> isn't permitted to have a number of things as it's children (EditorHtml::renderTagIndent and EditorHtml::renderTagHeading), it should use <div>
\XF\Html\Renderer\BbCode doesn't correctly undo the editor injecting a indent per-line, resulting in indent's mixed into existing line content when it shouldn't be.