DEV Community

Max
Max

Posted on

How to display multiple blank lines in Markdown

Ever wished you could space out your blocks of text in markdown a bit more without using non-markdown tags?

According to markdown rules multiple empty lines are collapsed into a single empty line or just a start of a new paragraph, depending on the flavour.

Example

*Line 1*





*Line 2*
Enter fullscreen mode Exit fullscreen mode

is collapsed into

Line 1

Line 2


However, this seemingly identical example

*Line 1*
 

 

 

*Line 2*
Enter fullscreen mode Exit fullscreen mode

retains its white space:

Line 1

Line 2


Both examples look the same to a naked eye in markdown and have no special markup.

The difference in the second example is in an invisible Unicode character followed by a new line.

It fools the rendering code into adding a visually empty <p> </p> tag giving you an extra empty line. You can add as many of them as you need alternating with an empty line.

According to emptycharacter.com there are 16 types of those "invisible characters". I found that Medium Mathematical Space (U+205F) works best here, on GitHub, Reddit or sites produced by Hugo static site generator. It looks like this:


Happy

              writing

                              !

                                                    :)

Latest comments (0)