You seem to misunderstand the difference between a paragraph break and a line break, and also how these apply to the plain (markdown) text and the rendered result.
Markdown text that is only separated by a single newline is part of the same paragraph, and has no line breaks in the rendered output. So
This is one line in the markdown text.
This is another line in the markdown text.
is one paragraph and the text is rendered without any line breaks:
This is one line in the markdown text.
This is another line in the markdown text.
Note that this is how HTML text within a <p>...</p>
paragraph tag (and more besides) works. Any number of consecutive white space characters are collapsed to a single space.
When you add two (or more) spaces to the end of a markdown line, before end of the physical line, then you insert a line break in the rendered output; this is the equivalent of a <br/>
tag in HTML:
This is one line in the markdown text, followed by two spaces.
This is another line in the markdown text.
renders with a line break:
This is one line in the markdown text, followed by two spaces.
This is another line in the markdown text.
Paragraphs are continued sections of text, and you always need a blank line between them in the markdown source text:
This is one line in the markdown text, part of the first paragraph.
This is another line in the markdown text, still the same paragraph.
This is another line, but there is a blank line preceding it. This is now a new
paragraph, itself consisting of two lines.
so now you get a full new paragraph:
This is one line in the markdown text, part of the first paragraph.
This is another line in the markdown text, still the same paragraph.
This is another line, but there is a blank line preceding it. This is now a new
paragraph, itself consisting of two lines.
The editor preview follows those rules, and is not broken.
That’s because Markdown is designed to be readable as plain text, as well as output nice HTML. The original designer has explicitly stated that the goal is for the source text to work like most plain text email. Quoting from the original Markdown announcement post:
The overriding design goal for Markdown’s formatting syntax is to make it as readable as possible. The idea is that a Markdown-formatted document should be publishable as-is, as plain text, without looking like it’s been marked up with tags or formatting instructions. While Markdown’s syntax has been influenced by several existing text-to-HTML filters, the single biggest source of inspiration for Markdown’s syntax is the format of plain text email.
The editor here reflects this as it is a Markdown editor, not a WYSIWYG editor.
Note that for comments, there are no line breaks. Comments are always a single paragraph, there are no breaks possible. Comments are not a full markdown document. This is deliberate. From the help text shown when you click help
next to a comment input box:
Comments use mini-Markdown formatting
and from the comment formatting help:
Comments support only bold, italic, code and links
<br/>
), not a new paragraph.