Another solution to this is to use an HTML minifier. This works best with a Grunt build process, where the HTML can be minified on the fly.
The extra linebreaks and whitespace are removed, which solves the margin problem neatly, and lets you write markup however you like in the IDE (no
).