primary-theme / obsidian

Comfy, playful but productive theme for Obsidian. "Primary instantly puts you in a relaxed state that opens the door to creativity and exploration. Wonderfully executed down to the smallest details,"
GNU General Public License v3.0
981 stars 41 forks source link

Inconsitent space below headings #89

Closed nousernameavailableanymore closed 2 years ago

nousernameavailableanymore commented 2 years ago

The space below a heading is inconsistent between reading mode / Live Preview.

When using CSS to adjust the space, it even becomes inconsistent between reading mode / Live Preview and embed preview. The difference in embed preview seems to come from the "margin-bottom: -0.2em", which only decreases the gap in reading mode a tiny bit but completely removes the gap in embed preview.

CSS used for affected heading:

.markdown-preview-view h1 {
    color: var(--sne-gold-trans);
    text-align: center;
    vertical-align: middle; 
    background-color: var(--code-color);
    margin-bottom: -0.2em !important;
}

.HyperMD-header-1,
.cm-header-1 {
    color: var(--sne-gold-trans);
    text-align: center;
    vertical-align: middle; 
    background-color: var(--code-color);
}

image image

image image image

ceciliamay commented 2 years ago

Hey there @nousernameavailableanymore ! I just looked into this and I don't seem to have the inconsistent spaces you've mentioned 🤔 Here's what they look like on my end:

image

(by Editor, I mean Live Preview)

image

they look fine on embed preview too

image

What fixes have you tried? If you haven't, can you try:

Let me know how it goes!

nousernameavailableanymore commented 2 years ago

Hmmm not sure what you mean. Counting pixels (lowest pixel in header background to highest pixel in text beneath) in photoshop shows for my examples: 17 in Live Preview 35 in Reading Mode

Doing the same for your examples shows: 23 in reading mode 35 in editor view

So while the difference is not AS large as in my example (maybe related to font?), even in your example, the gap in editor view is still more than 50% larger than in reading mode.

ghtyrant commented 2 years ago

The same is happening for me, on two different installations of Obsidian. I already tried disabling all CSS snippets, but that does not fix it. Headers seem to lack spacing below in edit mode: image

In reading mode, spacing seems to be better: image

ceciliamay commented 2 years ago

Hey there @ghtyrant ! Unfortunately due to how Obsidian renders Live Preview and Reading Mode differently, the only solution is to add an empty line after every header/paragraph. There is currently no other workaround code-wise, and even big themes like Minimal have the same issues. I'm hoping for better visual consistency in Obsidian's rendering in the future! Hope this helps 🙏

ghtyrant commented 2 years ago

Thanks for your response. Too bad this can't be fixed otherwise, but I'll just add newlines for now.