noatpad / obsidian-banners

An Obsidian plugin that adds banners to your notes
MIT License
616 stars 39 forks source link

Too much empty space below banner after edit #141

Open chrisbrasington opened 9 months ago

chrisbrasington commented 9 months ago

Obsidian: v1.4.16 Banners: 1.3.3

Reproduce: To ensure I didn't have any conflicting plugins/css, I can reproduce this on a new vault.

Issue: Banners add too much white-space padding below the banner after editing any page. Disable/Enable plugin will remove the spacing. Not able to use banners in the meanwhile.

Notice how the "hello" shifts down. Issue persists at all times after first appearance.

Before edit: image

During edit: image

After edit: image

afreid commented 9 months ago

Hey, I have the same issue. Mac OS 14.1, iOS 16. Tony

tombl commented 9 months ago

Looks like the obsidian-banner-wrapper element needs to be at the top of the markdown preview, but a markdown-preview-pusher element gets added even before that.

afreid commented 9 months ago

As a workaround, I added a CSS snippet to the Appearance Settings:

.obsidian-banner-wrapper {
    margin-top: calc(var(--banner-height) - 200px);
    padding-top: 0.5em;
}

It works fine on Mac OS but doesn't make any difference on iOS.

afreid commented 9 months ago

Not sure why it took me so long, but, adding !important to the snippet got the work around sorted for iOS:

.obsidian-banner-wrapper {
    margin-top: calc(var(--banner-height) - 200px) !important;
    padding-top: 0.5em;
}

Of course, this is only a workaround, and you'll need to adjust for the height you have your banner set.

Jeremiah-Olatunde commented 9 months ago

I've written the following CSS snippet workaround

.obsidian-banner-wrapper {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: var(--banner-height);
    margin-top: 0;
    padding-top: 0;
}

.obsidian-banner{
    position: relative;
}

.markdown-preview-view:has(.obsidian-banner-wrapper) {
    padding-top: calc(var(--banner-height) + var(--file-margins));
}
before after
before after

[!warning] This fix does not work in preview embedded. Disable the Show banner in preview embed option in the Banner plugin settings

bug

gallbotond commented 7 months ago

My simple fix (it works best for me in preview and in embed)

.obsidian-banner-wrapper {
  margin-top: 0;
}

image

image

image