Last modified: 2014-06-26 01:06:26 UTC
The solution for this may be related to Bug 61049: If you add a caption to an image, and you press return in the text area box at the end (perhaps several times), then the caption includes those pointless blank lines, which makes for ugly wikitext when the page is saved. See https://en.wikipedia.org/w/index.php?title=Sugar_candy&diff=613063549&oldid=611921250
The same is true for the main document, but I'd rather issue warnings than do automatic document modification (cf. typing wikitext into VE)