I've noticed that when the white space above is displayed correctly, in hidden markup view there is a little black square just to the left of the heading text, as in this image:
little square.jpg - Google Drive
When the white space above doesn't get inserted, the black square appears to the left of the white space below the heading, rather than to the left of the heading text. What does this black square mean, and how do I make sure that it ends up in the right place?