clayh53 / tufte-jekyll

Minimal Jekyll blog styled to resemble the look and layout of Edward Tufte's books
MIT License
620 stars 206 forks source link

Single markdown linebreaks cause <br> #31

Closed mkirchner closed 8 years ago

mkirchner commented 8 years ago

In the default setup tufte-jekyll is configured to put newlines where the original markdown had a single line word wrap. This forces users to use long lines (very inconvenient for versioning) and comes as a bit of a surprise as this is not the standard for most markdown interpreters.

The solution is to manually disable the hard_wrap option of kramdown in _config.yml like so:

    markdown: Kramdown
    kramdown:
        ...
        input: GFM
        hard_wrap: false  <-- here
        ...

Would you mind bringing that option into _config.yml either as a default or commented out (as it is likely a breaking change for existing blogs)? Anything that helps the next person figuring this out faster would be greatly appreciated. Thanks!

ghost commented 8 years ago

Or you could remove input: GFM and that should set you back to kramdown which has the default you're looking for: http://kramdown.gettalong.org/syntax.html#line-wrapping

Removing that line won't be a problem if you don't use Github Flavored Markdown. Kramdown GFM interprets line breaks literally by design to match to the GFM spec: http://kramdown.gettalong.org/parser/gfm.html

mkirchner commented 8 years ago

Well, yes, unless you want GFM fenced code blocks... ;-)

ghost commented 8 years ago

Since the GFM default is to interpret line breaks literally, setting hard_wrap: false is probably best left as a user-set option. Either that, or an alternative default is to remove input: GFM from the kramdown block. The default Jekyll config is without input: GFM and tufte-jekyll should probably follow suit. This way if a user is adding GFM support they likely know that they are also enabling literal line-break interpretation.

ghost commented 8 years ago

Jekyll 3.0 defaults to Rouge code highlighting and fenced code block support, so the following can be fully removed from _config.yml

markdown: Kramdown
kramdown:  
  input: GFM
  syntax_highlighter: rouge
highlighter: rouge