19
$\begingroup$

Suppose I am writing something like-

"Not only will two students need to raise a baby together, but they will need to do so while living together for two weeks#. Two weeks of Lane Evans and Dawn Caparelli. Alone. No parents. No teachers. No supervision. "

Now I want to start new line where I put #? How to do it. Googling it said put / but it do not work. You have to put two enters which gives a gap of line. I just want to go in very next line. The best i can do is-

"Not only will two students need to raise a baby together, but they will need to do so while living together for two weeks.

Two weeks of Lane Evans and Dawn Caparelli. Alone. No parents. No teachers. No supervision. "

See gap of a line. Why not very next line?

Ok here is my try.

Hi
Bye

$\endgroup$
  • $\begingroup$ See Markdown Editing Help $\endgroup$ – Martin Sleziak Dec 10 '14 at 5:17
  • 7
    $\begingroup$ On a quick glance, the title said "How to start new life on MSE?" $\endgroup$ – Asaf Karagila Dec 10 '14 at 10:04
  • 2
    $\begingroup$ I thought it was some revolutionary idea to change the site or something. $\endgroup$ – leo Dec 10 '14 at 14:06
  • $\begingroup$ I am not sure whether this should be tagged (mathjax) - this tag is related to typing mathematical expressions on this site. But since it was the tag chosen originally by the OP, I did not change it in my edit. $\endgroup$ – Martin Sleziak Dec 21 '14 at 13:02
  • $\begingroup$ I thought you were referring to Meta Stack Exchange until now. $\endgroup$ – nyuszika7h Dec 23 '14 at 9:16
19
$\begingroup$

There are three approaches for line breaks. As pointed out in the comments, Approaches 2 and 3 produce the same HTML output when rendered on the page.

Approach 1: Press "Enter" twice

Output:
Hi

Bye

Code:

Hi

Bye

Approach 2: Two spaces at end of line

Output:
Hi
Bye

Code:

Hi  
Bye

There are two spaces after "Hi." That is, the text looks like:

Hi<Space><Space>
Bye

Approach 3: HTML Tag

Output:
Hi
Bye

Code:

Hi<br />
Bye
$\endgroup$
  • 1
    $\begingroup$ 2 and 3 being identical as far as output is concerned (when Markdown gets converted to HTML, the two-space ending becomes <br/>). $\endgroup$ – user147263 Dec 10 '14 at 4:55
  • $\begingroup$ <br /> working. what do you mean two spaces at end of line? that did not work for me $\endgroup$ – Bhaskar Vashishth Dec 10 '14 at 5:00
  • $\begingroup$ @BhaskarVashishth I've edited it to be more clear. $\endgroup$ – apnorton Dec 10 '14 at 5:02
  • $\begingroup$ I did it. did not work. Let me try again $\endgroup$ – Bhaskar Vashishth Dec 10 '14 at 5:03
  • $\begingroup$ see nothing happened in my Hi and Bye.. see my edit in question $\endgroup$ – Bhaskar Vashishth Dec 10 '14 at 5:05
  • $\begingroup$ @BhaskarVashishth You need a line return after the spaces. Hi<Space><Space><Enter>Bye. $\endgroup$ – apnorton Dec 10 '14 at 5:06
  • $\begingroup$ Thanks alot. now done $\endgroup$ – Bhaskar Vashishth Dec 10 '14 at 5:07
3
$\begingroup$

Anorton has already explained how to produce a simple line break in Markdown. I'd like to take this opportunity to suggest that you probably shouldn't use it.

Put simply, there are two conventional ways to separate paragraphs in English typography:

  1. You can put a blank line (or at least some vertical whitespace — many style guides recommend somewhere between half a line and a full line) between the paragraphs, as in this example.

    When you do that, you do not need to indent the paragraphs.

  2. Alternatively, you can leave out (most of) the whitespace between the paragraphs, and just have the second paragraph start immediately on the next line.
            When you do that, you should indent the first line of the second (and subsequent) paragraph, to provide a clear visual indication of the paragraph break.
            This style works best with narrow columns, where most paragraphs will be long enough to span multiple lines.
            Single-line paragraphs can look kind of funny with this style.

The Stack Exchange style sheet is designed with the first (blank line) paragraph style in mind. While you can sort of fake the indentation style (as demonstrated above), it requires hacky and convoluted markup, and frankly just doesn't look very good here.

If the SE designers had wanted, they could've written the style sheet here so that normal paragraps (separated by a blank line in the Markdown source code) would be rendered using the indentation style, with an appropriate amount of spacing and indentation to make them pretty and readable. But they chose not to use that style, and IMO, we really should not try to fight that choice.

In any case, whichever paragraph style you prefer, you should pick one of them and use it consistently — using both a blank line and indentation to separate paragraphs looks silly, and using neither makes it hard to see at a glance where the paragraph breaks are.


So, what are the legitimate uses for line breaks in Markdown, then? IMO, there aren't many, but they do occasionally come in handy:

  • Markdown doesn't really have proper support for image captions, but you can fake them pretty well by putting the image on one line, followed by a simple line break and the caption. (I also like to wrap the caption in <sup> / </sup> tags, to make it look like it's set in small type. This is a total abuse of HTML markup, but it works reasonably well.)

  • Sometimes, you may wish to format a list in a way that Markdown doesn't properly support (e.g. using letters instead of numbers in an ordered list). Again, this can be reasonably well faked using line breaks (although you can't get proper list indentation that way).

  • Perhaps the only non-hacky use of line breaks would be to format text that is naturally structured in lines rather than in paragraphs, such as line-based computer program output, or maybe poetry. (Note that, for program output, code blocks may sometimes be preferable.)

$\endgroup$

You must log in to answer this question.

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