Sign in
Log inSign up

[Markdown] TIL: You can force line break in Markdown without creating a new paragraph

Fazle Rahman's photo
Fazle Rahman
·Oct 3, 2019

Adding a new empty line between two lines of text in Markdown creates two different paragraphs. For example:

This is paragraph 1. 

This is paragraph 2.

Output:

<p>This is paragraph 1. </p>
<p>This is paragraph 2.</p>

However, there are times when you just want to create a line break and not a new paragraph. Well, you can do that by adding two spaces at the end of the line.

This is paragraph 1.  
This is a new line in paragraph 1.

This is paragraph 2.

Output:

<p>This is paragraph 1. <br/>This is a new line in paragraph 1.</p>
<p>This is paragraph 2. </p>

This also applies to the ordered and unordered lists. For example:

1. This is line 1.  
This is line 2 of line 1. 
2. This is line 2.

Output:

<ol>
<li>This is line 1. <br/>This is line 2 of line 1. </li>
<li>This is line 2. </li>
</ol>

I hope you find this TIL helpful. Go ahead and try this in your post on Hashnode. 😀