11ty / eleventy-base-blog

A starter repository for a blog web site using the Eleventy static site generator.
https://eleventy-base-blog.netlify.app/
MIT License
1.21k stars 619 forks source link

Markdown parsing inserts <br> at all line endings, not just those with two trailing spaces #86

Closed tylensthilaire closed 2 years ago

tylensthilaire commented 3 years ago

When Markdown is transformed into HTML,
tags are inserted wherever line breaks exist in the .md file, instead of only where two space characters exist at the end of the line.

It's easy enough for someone to remove the breaks: true, part of the Markdown overrides in eleventy.js but perhaps it could be more explicitly documented or false by default?

Verbose example ```json /* Markdown Overrides */ let markdownLibrary = markdownIt({ html: true, breaks: true, linkify: true }).use(markdownItAnchor, { permalink: true, permalinkClass: "direct-link", permalinkSymbol: "#" }); ``` `breaks: true,` turns: ```md Lorem ipsum dolor sit amet. Consectetur adipiscing elit. ``` into: ```html

Lorem ipsum dolor
sit amet.

Consectetur
adipiscing elit.

``` Removing `breaks: true,` outputs: ```html

Lorem ipsum dolor sit amet

Consectetur
adipiscing elit.

``` Live example: https://github.com/tylensthilaire/eleventy-base-blog/blob/master/posts/firstpost.md https://nostalgic-kepler-b836c1.netlify.app/posts/firstpost/ Only the second paragraph would have any `
` tags in a GitHub/Markdown-it preview by default.
zachleat commented 2 years ago

Sold! Default removed.