IntelliJ IDEA 14: How to stop stripping of trailing spaces

I’ve recently been using Markdown in conjunction with Metalsmith to create some new static content web sites (more on this in a future post). IntelliJ IDEA, IMHO the world’s best IDE for Java/web/Python/PHP (and many more languages/technologies) supports all the popular web technologies and is a joy to use most of the time.

However, I came across an annoying little problem recently when I noticed that line breaks were missing from my Markdown generated content. Markdown uses 2 trailing spaces on a line to signify that a line break is required, and it transpired that IDEA was stripping these trailing spaces from lines when the Markdown file was saved!

After a bit of a search through the IDEA Editor settings I finally found the offending option buried deep in the Editor / General section:

idea-14-settings

The default setting is set to strip trailing spaces so simply select “None” here and your Markdown line breaks will remain intact!