The Dead Simple Markdown Guide to Line Breaks

To create line breaks in Markdown, use trailing spaces or the
HTML tag for compatibility. Avoid using backslashes or relying on automatic line breaks, as they may not be supported across all Markdown applications.


This content originally appeared on HackerNoon and was authored by Typesetting

Line Breaks

To create a line break or new line (<br>), end a line with two or more spaces, and then type return.

\

| Markdown | HTML | Rendered Output | |----|----|----| | This is the first line. &nbsp; \n And this is the second line. | <p>This is the first line.<br> \n And this is the second line.</p> | This is the first line. \n And this is the second line. |

Line Break Best Practices

You can use two or more spaces (commonly referred to as “trailing whitespace”) for line breaks in nearly every Markdown application, but it’s controversial. It’s hard to see trailing whitespace in an editor, and many people accidentally or intentionally put two spaces after every sentence. For this reason, you may want to use something other than trailing whitespace for line breaks. If your Markdown application supports HTML, you can use the <br> HTML tag.

\ For compatibility, use trailing white space or the <br> HTML tag at the end of the line.

\ There are two other options I don’t recommend using. CommonMark and a few other lightweight markup languages let you type a backslash (\) at the end of the line, but not all Markdown applications support this, so it isn’t a great option from a compatibility perspective. And at least a couple lightweight markup languages don’t require anything at the end of the line — just type return and they’ll create a line break.

\

| ✅  Do this | ❌  Don't do this | |----|----| | First line with two spaces after. &nbsp; \n And the next line. \n \n First line with the HTML tag after.<br> \n And the next line. | First line with a backslash after.\ \n And the next line. \n \n First line with nothing after. \n And the next line. |

\

:::info This guide is a Matt Cone project available on Markdown Guide under the CC BY-SA 4.0 license.

:::

\


This content originally appeared on HackerNoon and was authored by Typesetting


Print Share Comment Cite Upload Translate Updates
APA

Typesetting | Sciencx (2024-08-20T15:48:54+00:00) The Dead Simple Markdown Guide to Line Breaks. Retrieved from https://www.scien.cx/2024/08/20/the-dead-simple-markdown-guide-to-line-breaks/

MLA
" » The Dead Simple Markdown Guide to Line Breaks." Typesetting | Sciencx - Tuesday August 20, 2024, https://www.scien.cx/2024/08/20/the-dead-simple-markdown-guide-to-line-breaks/
HARVARD
Typesetting | Sciencx Tuesday August 20, 2024 » The Dead Simple Markdown Guide to Line Breaks., viewed ,<https://www.scien.cx/2024/08/20/the-dead-simple-markdown-guide-to-line-breaks/>
VANCOUVER
Typesetting | Sciencx - » The Dead Simple Markdown Guide to Line Breaks. [Internet]. [Accessed ]. Available from: https://www.scien.cx/2024/08/20/the-dead-simple-markdown-guide-to-line-breaks/
CHICAGO
" » The Dead Simple Markdown Guide to Line Breaks." Typesetting | Sciencx - Accessed . https://www.scien.cx/2024/08/20/the-dead-simple-markdown-guide-to-line-breaks/
IEEE
" » The Dead Simple Markdown Guide to Line Breaks." Typesetting | Sciencx [Online]. Available: https://www.scien.cx/2024/08/20/the-dead-simple-markdown-guide-to-line-breaks/. [Accessed: ]
rf:citation
» The Dead Simple Markdown Guide to Line Breaks | Typesetting | Sciencx | https://www.scien.cx/2024/08/20/the-dead-simple-markdown-guide-to-line-breaks/ |

Please log in to upload a file.




There are no updates yet.
Click the Upload button above to add an update.

You must be logged in to translate posts. Please log in or register.