title: HTML specification for rendering new lines?
body: <p>I'm trying to render some simple HTML documents (contain mostly div and br tags) to plain text, but I'm struggling on when to add new lines. I assumed it would be quite simple with <code>&lt;div&gt;</code> and <code>&lt;br/&gt;</code> generating new lines, but it looks like there's various subtle rules. For example:</p>
  
  <p><div class="snippet" data-lang="js" data-hide="false" data-console="false" data-babel="false">
  <div class="snippet-code">
  <pre class="snippet-code-html lang-html prettyprint-override"><code>&lt;div&gt;one line&lt;/div&gt;
  &lt;div&gt;two lines&lt;/div&gt;
  
  &lt;hr/&gt;
  
  &lt;div&gt;one line&lt;/div&gt;
  &lt;div&gt;&lt;/div&gt;
  &lt;div&gt;still two lines because the empty div doesn't count&lt;/div&gt;
  
  &lt;hr/&gt;
  
  &lt;div&gt;one line&lt;br/&gt;&lt;/div&gt;
  &lt;div&gt;&lt;/div&gt;
  &lt;div&gt;still two lines because the br tag is ignored&lt;/div&gt;
  
  &lt;hr/&gt;
  
  &lt;div&gt;one line&lt;br/&gt;&lt;/div&gt;
  &lt;div&gt;&lt;br/&gt;&lt;/div&gt;
  &lt;div&gt;three lines this time because the second br tag is not ignored&lt;/div&gt;
  
  &lt;hr/&gt;
  
  &lt;div&gt;&lt;div&gt;Wrapped tags generate only one new line&lt;br/&gt;&lt;/div&gt;&lt;/div&gt;
  &lt;div&gt;&lt;br/&gt;&lt;/div&gt;
  &lt;div&gt;three lines this time because the second br tag is not ignored&lt;/div&gt;</code></pre>
  </div>
  </div>
  </p>
  
  <p>So I'm looking for a specification on how new lines should be rendered in HTML documents (when no CSS is applied). Any idea where I could find this kind of document?</p>