Respect Blank Lines in Preview Mode

When I’m in editor mode I can leave multiple blank lines between text. I find this useful for separating content and making my work more readable. However, when I switch to preview mode the blank lines are stripped and my work is horribly condensed again.

Any chance you would stop preview mode from stripping whitespace, or at least give the option to have preview mode respect blank lines?

Thank you!

18 Likes

I think it would be nice too. If you didn’t know, you can add a <br /> to get what you want.

1 Like

+1

is viable but not so graceful. :slight_smile:

1 Like
.markdown-preview-view div p {

margin-bottom: 1.5rem;

}

this css snippet works for a visual line break in preview @bagameow

Thank you for the CSS snippet, @hieu, but I think the request is not about generally increasing the spacing after every paragraph, as your snippet does; instead, it’s about (sometimes) using multiple empty lines to visually separate some parts/paragraphs from each other. This works well in edit mode (and most other note apps), but in preview mode, all this additional visual structure is lost.

:sob: nods, makes prose so ugly, hurts my heart

1 Like

I took this answer from Stackoverflow:

this is a line with two hardbreaks below:\
\
\

…and it worked great for me. Cheers!

For macOS, pressing OPT SPACE on a new line produces a blank line in preview mode.

Angel

1 Like

You can also do:

(empty line)
\
(tab)
(tab)

Each empty line with a tab will create an empty line in preview. the \ symbol won‘t be shown in preview.

Extra bonus: If you want to avoid the empty lines getting “swallowed” by folding an above header, do this:

# .
\
(tab)
(tab)

The amount of hashtags should be equal to the above header. Instead of a . you can also use another symbol, but I found the dot to be least obtrusive.

I appreciate people coming up with all kinds of creative workarounds, but they all require you to remember to do something special and potentially even uglify your notes significantly when viewed in edit mode. Plus, most users will simply be annoyed by the existing behavior and not come to the forums to search for some hacky workaround.

I’m cautiously optimistic, though, that this issue will get solved by the planned WYSIWYG editor mode, which is in the short-term section of the Obsidian roadmap.