Increase space between paragraphs

Things I have tried

I just searched everywhere and while there are answers that worked for others, it had absolutely no effect in my case.
Here is what I tried and it had zero effect.

.CodeMirror pre.CodeMirror-line {
  line-height: 1.4;/*height of a*/
  padding-top: 6px; /*the lower part of height of b*/
  padding-bottom: 6px;/*the upper part of height of b*/
}

I also tried some other changes with CSS snippets like adding justified text alignment and it worked, like for example this:

/* reading mode */
.markdown-preview-view p {
	text-align: justify;
	text-justify: inter-word;
}

/* source view and live preview */
.markdown-source-view.mod-cm6 .cm-line {
	text-align: justify;
	text-justify: inter-word;
}

What I’m trying to do

I am trying to increase the space between paragraphs. Like as example see the image bellow. So space between paragraphs without need to hit enter everytime:

So I am not sure what I am doing wrong in the case of paddings. Maybe it’s something trivial that I am missing and you can suggest or maybe there is a certain update and changes to the code that is getting in the way and I should just forget about this feature and try to move on to workarounds.

Do any of the snippets work if you use the default theme? If not, what version of Obsidian are you using?

I haven’t changed any default themes, it seems like just came with a dark theme already enabled, and that’s it.
Then as I mentioned above I used a snippet with text-justify: inter-word; and it works as expected.
I haven’t tried changing it back to a light theme though, did not think it would help. but might try it just to make sure, cause otherwise, out of ideas.

The Obsidian version is 0.15.9 for Windows, just downloaded it today.

OK, cool. So the problem is probably with the CSS you snippets you found.

I don’t have a specific solution for you, but here’s an article on styling Obsidian in general.

Obsidian’s CSS is not the easiest thing to work with. The next version (no ETA but it’s being tested and refined in Insider builds) is going to come with a new default theme that makes it easier.

@lexob9 are u trying to do it for reading view only or both reading n editing view?

Also can u share screenshot how it looks right now in ur vault

I haven’t kept up with any recent changes to how themes work. But you might have to add an !important flag to these snippets. Otherwise, if they are defined somewhere else, that might take priority. I don’t really know, but I did have to mark some of my snippets as important.

Example (I did not test this.)

.CodeMirror pre.CodeMirror-line {
  line-height: 1.4 !important; /*height of a*/
  padding-top: 6px !important; /*the lower part of height of b*/
  padding-bottom: 6px !important;/*the upper part of height of b*/
}

@efemkay
Trying to change the editing view, not interested in the reading view, but if it comes as a bonus I don’t mind.

This is what it looks like now:


Where the top arrow points, there is a double-enter used.
On the bottom, there is a single-enter used. But want it to look as if i used double-enter.

@rigmarole
Tried adding !important as you suggested but nothing.
My guess is that selectors are wrong and won’t target the needed part of the code (or classes, not sure how they are called,.CodeMirror pre.CodeMirror-line << talking about this part).
Tried searching these selectors using a developer tool but there are so many of them, gets confusing very fast.

I believe the .CodeMirror-line selector was when Obsidian uses CM5 (now it uses CM6). You should be using .cm-line instead. However, note that you might want to test how it looks like when you have a more diverse note with bullets, headers (and perhaps callout?) to see how it behaves.

Anyway, here’s an example that I think should work (unless u have a theme that somehow have higher specificity – if so than you can just add that !important but I highly advise against it)

  • I use css combinator + to adjust only the padding-top for second blocks onwards (and not applied for the first block).
  • I use 1em as the size just so it scale well if the line is the header, than it will be same size as the header itself
  • I use :is() to shorten the code, else I would write .markdown-source-view twice
.markdown-source-view :is(.cm-line + .cm-line) {
   padding-top: 1em;
}

with the snippet

without the snippet

1 Like

Oh yes, you are the man. thanks very much.

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