Whitespace and Line Breaks

by typora.io

Line breaks is every confusing in Markdown, our recommendations is that:

Single Line Breaks

Single line break is parsed differently across different Markdown engines, CommonMark will just ignore it, in other words, if you write:

line 1
line 2

it will be rendered as

line 1 line 2

But other markdown engines may choose to keep it (like input box for issues in GitHub), or provide options whether to preserve it or not.

In Typora, we provide options whether to preserve it or not in preference panel, and you would choose the behavior when writing from menu bar quickly. By default, Typora will Preserve line breaks in editing view and ignore them when print or export. You could change this option in preference panel.

Whitespace

Sequential whitespace are similar to Single Line Breaks, most Markdown engines will ignore them, for example, in CommonMark,

Four    whietspace in between

will be converted to

<p>Four    whitespace in between</p>

and you will only see

Four whitespace in between

By default, Typora will Preserve sequential whitespace in editing view and ignore them when print or export. You could change this option in preference panel.

If you do want to insert sequential whitespace that Other markdown engines support, you could

Enter key in Typora

In Markdown, two line break means create a new paragraph, in Typora, when you press Enter key, a new paragraph is created, and if you switch to source code mode, two line breaks are inserted, for example, source of

Paragraph 1

Paragraph 2

is

paragraph 1
(empty line)
paragraph 2

You could explicitly insert a single line break in editing view by pressing Shift+Enter key.

## Markdown Line Break

Markdown provides ways to insert single hard line break:

Almost all Markdown engines will parse them as hard line break in the output.

We provide related settings in Preference Panel or Edit -> Whitespace and Line Breaks from menu bar.