Here’s another little Docs annoyance that can easily be cleaned up with a little automation. If you are using headings in your document, and insert blank lines beside a heading, you end up with uneven blank lines since they will take the format of the heading level rather than just a normally spaced line. Here’s a snippet to clean that up.

Cleaning up blank lines in a document

The hierarchy array lists out all the heading levels to consider for conversion. I guess there may be some reason that you want to exclude some.

The demote variable says what heading level matching blank paragraphs should be set to.

This function provides a dry run capability that reports which headings it plans to demote, then set this false when ready to commit.
var DRY_RUN = false;

Here’s the kind of update you get.

And that’s all there is to it. Here’s the code

For more like this see Google Apps Scripts Snippets
Why not join our forum, follow the blog or follow me on twitter to ensure you get updates when they are available.