title: Markdown and line wrapping
body: <p>Most of the time Markdown files are treated just like source code: they're in a VCS, they take part in pull requests and/or reviews, and they're well formatted. And just like in source code, I often see inserted line breaks at a specific length—like a code formatter would do.</p>
  
  <p>Many editors do that dynamically according to the current window size (a.k.a. word wrap). Furthermore, Markdown is mainly used to generate HTML pages, PDF documents, or other formats. Manually inserted line breaks often lead to messed up text rendering in these situations.</p>
  
  <p>Is wrapping Markdown at a specific line length good or bad? The topic seems to be <a href="https://meta.stackexchange.com/q/26011">controversial</a>, even the current CommonMark specification (<a href="https://spec.commonmark.org/0.29/#soft-line-breaks" rel="noreferrer">v0.29</a>) somewhat sits on the fence:</p>
  
  <blockquote>
    <p>A regular line break (not in a code span or HTML tag) that is not preceded by two or more spaces or a backslash is parsed as a <a href="https://spec.commonmark.org/0.29/#softbreak" rel="noreferrer">softbreak</a>. (A softbreak may be rendered in HTML either as a <a href="https://spec.commonmark.org/0.29/#line-ending" rel="noreferrer">line ending</a> or as a space. The result will be the same in browsers. In the examples here, a <a href="https://spec.commonmark.org/0.29/#line-ending" rel="noreferrer">line ending</a> will be used.)</p>
    
    <p>[…]</p>
    
    <p>A conforming parser may render a soft line break in HTML either as a line break or as a space.</p>
    
    <p>A renderer may also provide an option to render soft line breaks as hard line breaks.</p>
  </blockquote>
  
  <p>However, <a href="https://daringfireball.net/projects/markdown/syntax#p" rel="noreferrer">John Gruber said</a> back in 2004:</p>
  
  <blockquote>
    <p>The implication of the “one or more consecutive lines of text” rule is that Markdown supports “hard-wrapped” text paragraphs. This differs significantly from most other text-to-HTML formatters (including Movable Type’s “Convert Line Breaks” option) which translate every line break character in a paragraph into a <code>&lt;br /&gt;</code> tag.</p>
    
    <p>When you do want to insert a <code>&lt;br /&gt;</code> break tag using Markdown, you end a line with two or more spaces, then type return.</p>
    
    <p>Yes, this takes a tad more effort to create a <code>&lt;br /&gt;</code>, but a simplistic “every line break is a <code>&lt;br /&gt;</code>” rule wouldn’t work for Markdown. Markdown’s email-style blockquoting and multi-paragraph list items work best — and look better — when you format them with hard breaks.</p>
  </blockquote>