-9

Markdown specs says two spaces causes line break. 6 spaces follow this EOL:
And the editor just ignores them. Hmmm? Two spaces are at the end of this line.
After which I used the ENTER key. There is no blank line generated. I can simulate it with two ENTER key presses.

Okay, so does markdown work in the primary Body of a post?
And do I get a break?<6 spaces follows>
test1. Nope, should have at least one blank line before the word test1.

I don't get it. Maybe markdown only works in replies. The <br /> tag works, but that isn't really markdown.

5
  • Here is where my question continues. I cannot use the ENTER key to force a new paragraph (it closes the comment editor and posts it). So two spaces do not begin new line and <br /> tags don't work either. So how can I format comments.
    – Bcwilmot
    Nov 16, 2019 at 21:54
  • comments use a more limited markdown that does not support newlines. Nov 16, 2019 at 22:00
  • 4
    And the editor just ignores them is on a new line, and not part of the previous line. Double-space at the end doesn't create a new paragraph, it just means that the next line doesn't wrap around. It's a line break (<br/>), not a new paragraph.
    – Martijn Pieters Mod
    Nov 16, 2019 at 22:00
  • Reply to @Pieters, Double spaces have no effect on wrapping or line breaks, Its the ENTER key that forces a new line in the Body.....double, triple or any number of spaces get collapsed into one and text continues on same line without any affect from double spacing.
    – Bcwilmot
    Nov 16, 2019 at 22:03
  • 4
    The rule is that the double space appears at the end of a physical line. It is the double space in combination with a newline that signals the line break.
    – Martijn Pieters Mod
    Nov 16, 2019 at 22:08

1 Answer 1

11

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

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .