DEV Community

Max
Max

Posted on

4 1

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

                              !

                                                    :)

Do your career a big favor. Join DEV. (The website you're on right now)

It takes one minute, it's free, and is worth it for your career.

Get started

Community matters

Top comments (1)

Collapse
 
shreyas-a-s profile image
Shreyas A S

So useful in writing posts even here in DEV, but somehow it feels like cheating. 😅

👋 Kindness is contagious

Immerse yourself in a wealth of knowledge with this piece, supported by the inclusive DEV Community—every developer, no matter where they are in their journey, is invited to contribute to our collective wisdom.

A simple “thank you” goes a long way—express your gratitude below in the comments!

Gathering insights enriches our journey on DEV and fortifies our community ties. Did you find this article valuable? Taking a moment to thank the author can have a significant impact.

Okay