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

                              !

                                                    :)

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

Explore a sea of insights with this enlightening post, highly esteemed within the nurturing DEV Community. Coders of all stripes are invited to participate and contribute to our shared knowledge.

Expressing gratitude with a simple "thank you" can make a big impact. Leave your thanks in the comments!

On DEV, exchanging ideas smooths our way and strengthens our community bonds. Found this useful? A quick note of thanks to the author can mean a lot.

Okay