atom/markdown-preview — pull request #49 by izuzak (2014-03-23 17:24:42+00:00)
Title: Add support for GFM newlines

Fixes #47

This extends the markdown preview pane with support for GFM newlines.

Instead of enabling this feature by default, I'm suggesting that we have a config option and a toggle command to turn this on. The reason for this is that on GitHub, if you create a Markdown file with some content, and an issue with the same content -- the two renderings will not be the same.

Issues use GFM newlines (single newline in the source forces a new line in the output), while files use regular Markdown newlines (single newlines are ignored, only double newlines force a new line in the output):

https://help.github.com/articles/writing-on-github

My assumption is that most people using this package will write Markdown content with the goal of saving it as a file and uploading to GitHub (and not writing issues/comments/PRs). So, it seems reasonable to optimize for this common case, but also make it possible to turn on the features needed for the less common case.

Fortunately, [marked](https://github.com/chjj/marked), the library used for parsing and rendering GFM, has a [`breaks` flag](https://github.com/chjj/marked#breaks) which forces newlines to be treated like they are in issues, so implementation was pretty straightforward.

I'm not sure is `gfmNewlines` is the best name for this configuration option, so feel free to :scissors: :hammer: on that. :)

And now for some screenshots and GIFs! :zap: :camera:

![](https://f.cloud.github.com/assets/38924/2493967/66365b52-b2af-11e3-9f94-8efd2cf59151.gif)

![screen shot 2014-03-23 at 6 12 52 pm](https://f.cloud.github.com/assets/38924/2493969/742ae87c-b2af-11e3-9daa-1540810392ac.png)