Line Breaks (Nothing works)

Things I have tried

Reading several posts

What I’m trying to do

create some space between parts of text

I’m not able to create any space in preview mode, not matter how many line breaks I have. (looks fine in edit mode)… According to a few posts it’s either not possible w/o html or using some kind of backslash, but then other posts seem to indicate it works with more than one break, or turning the setting for strict line breaks should do something. for me that setting has no effect either way. Guess I’m not getting it.

1 Like

The setting for strict line breaks only has to do with what is understood as the beginning of a new paragraph. In normal markdown, there has to be an empty line between two paragraphs - if you just enter one single line break, markdown doesn’t interpret it as a new paragraph.

There are two possible solutions to your problem:

The first one is with css - you can define more space between two paragraphs. This setting, however, then would apply to every paragraph.

If you just want to insert more space between two lines/paragraphs from time to time, the only solution is to use html. <br> is the html syntax for “line break”. Try to include several of these and see how it looks in preview mode!

Hi @alltagsverstand,

I would also like a little more space between paragraphs. When using a
, the space is to big so I would like to try a snippet for more flexibility. Can you help with that?

Any help is very appreciated.

Hi @SamAdams you can create a css snippet with the following content:

.markdown-preview-view p {
  padding-top: 1em;
}

You can adjust the padding to your needs, you can also replace “padding-top” by “padding-bottom” (or use both).

3 Likes

Hi @alltagsverstand,

Super, exactly what I need. Thanks a lot :grinning:!

1 Like

thanks but i’m not sure how and where to use css snippets, still learning the basics. can you explain?

Have a look here:

https://help.obsidian.md/How+to/Add+custom+styles

Copy the code from my previous post into an empty file, save this file under “spaces-between-paragraphs.css” (you can chose any file name, but don’t change the .css ) into the folder .obsidian/snippets and activate your snippet in Settings → appearance.

i did everything you mentioned, but doesn’t see to have any effect. could it be my theme? I even tried various different “em” values and also went back to the settings are reloaded the snippets (do I have to do this every time I make a change?) In any case, my spacing looks the same in edit and preview modes. I also clicked off the file and back to it in case it needed to refresh.

That’s at least possible - which theme are you using?

And can you tell exactly what you did and paste your css snippet here?

tried different themes, currently using “minimal”… I did everything I think correctly. see screenshots.

Screen Shot 2021-12-13 at 17.37.40


your css file can’t be read - delete the three backticks at the beginning and the end of your code! You added the snippet as a codeblock…

Only this text should be in your snippet:

.markdown-preview-view p {
padding-top: 1em;
}

cool. i just copied pasted into the file, but not seems to work, but I’m confused… this seems to only put extra space at the very top of the doc. I thought this would allow more space between paragraphs… no matter how many line-breaks I put in in edit mode, preview mode compresses all the text together. How do you add space between sections and paragraphs in markdown?

I hadn’t meant to respond to a necrothread, but it came up below a thread I was reading and seemed to be left unresolved.

In case anyone reads this in future, I think there are two root issues:

  • One is markdown’s problematic use of whitespace (it counts it out like a miser or and abolishes space that does not have a markdown ratified purpose); the outcome is that what you see in edit may not closely resemble what is produced in review/preview/print. It makes no difference how many blank lines you add, you’ll still end up with one only. Unfortunately, if you want to use whitespace in markdown, you need a good understanding of how markdown handles it and how to get around its restrictions.
  • The second is terminology. There is frequently a lack of clarity between lines and paragraphs. Pressing an Enter key in Obsidian, as in most traditional markdown editors, gives you a new line, not a new paragraph as you would get in Word, Ulysses, Scrivener, Roam etc. People mimic paragraphs by using CSS to add padding between lines, but they are still only lines unless there is a blank line above and below.

There is a feature request for an option to use Enter for new paragraphs instead of new lines.

2 Likes

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.