Giter Club home page Giter Club logo

obsidian-banners's Introduction

Banners

An Obsidian plugin to add banner images (and icons) to your notes!

banners-demo

Usage

Within an open note, you can use the Add/Change banner with local image command to select a local image as a banner for your note; or you can copy an image URL & run the Paste banner from clipboard command to paste the URL as a banner image. You can also drag the banner image to reposition the image, as well as use the Lock/Unlock banner position command to "lock" the banner's position in place and vice versa.

If you want to remove the banner, you can run the Remove banner command to do just that.

You can also add a banner icon, using Add/Change emoji icon & selecting an emoji of your choice. You can also change an existing emoji by clicking on it in the preview.

Similarly, you can remove the icon with the Remove icon command.

Advanced

Under the hood, this plugin uses your file's YAML frontmatter/metadata to store info about your banner. So you can also input it manually or use other plugins to input it for you. These are the fields you can use thus far (using the default frontmatter field prefix):

# The source path of your banner image, can be a URL or an internal link to an image.
# NOTE: Make sure it's wrapped in quotes to avoid parsing errors, such as "![[file]]"
banner: string

# The banner's center position. A number between 0-1
banner_x: number
banner_y: number

# Determines if the banner is locked in place or not
banner_lock: boolean

# The banner icon. Can be an emoji or any string really (but it'll only accept the first letter)
banner_icon: string

Settings

Banners

  • Banner height: Specify how tall the banner image should be for each note.
  • Banner style: Change how your banner looks in your notes. There are currently 2 options:
    • Solid: A simple, sharp-container banner image.
    • Gradient: A banner that fades into transparency, inspired by this forum post.
Solid Gradient
solid-style gradient-style
  • Show banner in internal embed: Choose if the banner should be displayed in the inline internal embed within a file.
  • Preview internal banner height: If Show banner in internal embed is on, this setting determines how tall the banner image in the embed should be.

inception

  • Show banner in preview embed: Choose if the banner should be displayed in the preview embed for the Page Preview plugin.
  • Preview embed banner height: If Show banner in preview embed is on, this setting determines how tall the banner image in the embed should be.

embed

  • Frontmatter field name: If set, use a customizable frontmatter field to use for banner data. For example, the default value banner will use the fields banner_x, banner_y, and so on.
  • Banner drag modifier key: Set a modifier key that must be usedto drag a banner. For example, setting it to Shift means you'll have to drag with Shift to move it. This can help avoid accidental banner shifts.

Banner Icons

  • Horizontal alignment: Align the icon horizontally within the note's boundaries. If set to Custom, you can input a custom offset, relative to the note's left boundary. This can be any valid CSS length value.
  • Vertical alignment: Align the icon vertically relative to a banner's bottom edge, if a banner is present. If set to Custom, you can input a custom offset, relative to the center of a banner's lower edge if any. This can also be any valid CSS length value.
  • Use Twemoji: If set, it will use Twemoji (Twitter's emoji set) instead of the stock emoji on your device. This is on by default as there is better emoji support using this.

Local Image Modal

  • Show preview images: Enable this to allow preview images to be seen when searching through the modal.
  • Suggestions limit: Limit the amount of suggestions the modal can display at once.
    • NOTE: If you set this to a high number, while having Show preview images on, you may experience some slowdowns while searching.
  • Banners folder: Specify a folder to exclusively search for image files within the modal. If unset, the modal will search the entire vault by default.

Experimental

  • Allow mobile drag: Choose if you can adjust the banner positioning on mobile devices by dragging.
    • NOTE: This setting is experimental since it acts a bit funny with the mobile app's already built-in touch gestures.

Compatibility

This plugin has been tested on desktop from 0.12.12 onwards (previously MacOS and currently Windows) and on mobile from 1.0.4 onwards (iOS). It probably works fine on older versions, but just a heads up.

Installation

  • From the Community Plugins tab:
    • Within Obsidian, search for Banners in the Community Plugins browser and install it directly
  • Manual install:
    • Go to the latest release here, & download the files listed there (main.js, styles.css, & manifest.json)
    • Go to your vault's plugin folder (<vault>/.obsidian/plugins), create a folder called obsidian-banners, and move your files in there.
    • Reload Obsidian & enable the plugin in Settings -> Community Plugins

FAQ

What are these banner, banner_x, banner_y, ... fields in my note's frontmatter?

This plugin uses the frontmatter to store data about your note's banner, such as its positioning and such. The fields you can use are listed here and the prefix can be customized using the Frontmatter field name setting.

Is this incompatible with other plugins?

There are a few cases, but it depends. Because of how it functions, any plugin that conflicts with Banners' styling may cause issues. It's rather situational, but I'm planning to address some styling fixes for those conflicts down the line.

Currently some plugins reported to conflict with Banners are:

Develop

Once you run npm i, you can build the files into dist/ easily by running npm run build.

You can also have it watch your files and update your plugin within your vault while you develop by running npm run dev. Just make sure to set DEVDIR in ./esbuild.config.mjs to your testing vault beforehand.

Things I might do down the road

  • Plugin compatibility fixes and enhancements
  • Note-specific settings (override global style & height settings per note)
    • Drag bottom of banner to determine note-specific banner height
  • Image icons instead of only emoji
  • Banner titles (a la Notion-style)
  • Allow content's vertical displacement height to be different than banner height (this can be nice for aesthetic choices with the Gradient style)
  • Copy image files and paste as a banner
  • Unsplash API integration (select from Unsplash's images straight from Obsidian)

obsidian-banners's People

Contributors

mara-li avatar noatpad avatar ryotaushio avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

obsidian-banners's Issues

[CSS HELP] How to move the breadcrumbs plugin down when banner is loaded (if possible)

Hello! I hope it's alright for me to ask this here, but I've been trying to figure out how to get the banner to play nicely with the breadcrumbs plugin for a while now. I'm very inexperienced with CSS so please bear with me if this is an obvious question;

I have two plugins that display at the top of my note: breadcrumbs and metatable. I managed to edit metatable's css using a snippet found here to scoot it down when a banner is loaded, but I cannot figure out how to do the same for breadcrumbs.

This is my css edited snippet for my metatable plugin, and below are a couple screenshots showing the issue.

.code-block-wrap.obsidian-banner-wrapper {
	position: initial;
  margin-top: 200px;
  margin-bottom: 0;
}

The file w/o banner
Obsidian_rEFEu6IO4X

Banner turned on, covering breadcrumbs but metatable was appropriately pushed down by banner
image

Is there something I'm missing to affect breadcrumbs as well? If it's impossible to mess with breadcrumbs, could the banner be scooted down a bit with css and have breadcrumbs accessible from above?

Thanks again, and if this doesn't belong here I'll gladly move it!

gradient option works but i can't call it

hi!, i've been trying to set my banner style as gradient, but for some reason it doesn't seem to work, it'll help a lot me if i could get some syntax examples about the property in the documentation, this is an image of all the attempts i made (all of them done separately):

Obsidian_TpZFU19nQG

then i gave up and decided to set it as my default value and it worked:

Obsidian_7wDBO56cfZ

i'm not sure if this is a bug of the property or if i needed to do something else.

Icon displacement on mobile

Hey dear dev, not sure if it's a bug or not but after the most recent update the position of the icon on my phone (iPhone pro 12) seems to be a bit off.

image

Before the update it was like this

image

But meanwhile I really did update lots of plugins and themes today so I'm not one hundred percent sure it's a banners related problem. Could you check this out if it's not too much trouble?

Automatically adjust height based on 100% width

I've got several (100s) banners that I use for my notes, all with different dimensions. Would it be possible to have a setting that automatically scales the banner to display at 100% pane width and then have height adjust automatically?

As it is now, some banners are too wide and so I don't see the full image. if I adjust the height to display the full image then some other banners get cut off.

Example:

Banner original
image

3-pane banner
image

I'd like to see the whole banner width in the 3-pane banner example above.

Error loading banner image

Hi Danny,
thanks for this nice plugin!

I'm using Windows 10 and the plugin version 1.1.1, but I'm getting the following error after I added a banner:

Error loading banner image! Is the banner field valid?

The file content is this:

---
banner: kristaps-ungurs-DoOrFxZ6bMU-unsplash.jpg
---

# Test

Lorem Ipsum ...

![[kristaps-ungurs-DoOrFxZ6bMU-unsplash.jpg]]

The inline image is shown fine. Here's a screenshot of how it looks like for me: https://i.imgur.com/pHPxW7f.png
Any idea what is wrong here? Thanks a lot!

Workspace error

Workspace of desktop and mobile app got weird after enable the banner plugin. File explorer, tag pane, backlink pane... All were disappeared.unknown-1.png

Banner: Mis-alignment

Describe the bug

The banner alignment is covering the main text. It just happened recently

Expected behavior
The banner should not cover the main text in preview mode

To Reproduce

Steps to reproduce the behavior:

  1. Install Community Plug-in: Banners
  2. Copy an image link
  3. Command palette: Banners: Paste banner from clipboard
  4. See error in Reading mode

Screenshots

  • Reading mode: I have Heading 1 (iOS Apps) & Heading 2 (Owned)
    Screenshot - 2022-04-11 20 42 06 (Obsidian)

  • Preview mode: The Heading 1 is covered by the banner & The Heading 2 is partially covered.
    Screenshot - 2022-04-11 20 40 10 (Obsidian)

  • Pop-up window: It's fine with this one.
    Screenshot - 2022-04-11 20 44 47 (Obsidian)

OS

Where does the bug occur?

  • Desktop
  • Mobile

Obsidian Version: v0.14.6

The algorithm for walking through folders to find images is flawed

e.g.1 The file hierarchy is as follows:

  • level 1
    • level 12
      • image 1
      • image 2
  • level 2
    • image 3

If "Banners Folder "is the default, according to the current algorithm, ”image 3“ cannot be queried.

e.g.2 The file hierarchy is as follows:

  • level 1
    • image 3
  • level 2
    • level 22
      • image 1
      • image 2

If "Banners Folder "is the default,it can look up all the images.

YAML syntax is getting rendered when using banner

Screenshot 2022-02-10 at 16 27 18

Hey, here I'm just loading the banner which is coming nicely, but in reading mode I can also see the banner properties getting rendered as yaml syntax. I've seen all my plugins and no one is causing this to happen.

Can you tell me what can be done about this??

Thanks

Share the Frontmatter tag for Banner and Kanban

Kanban allows you to see an image that is in the frontmatter of the note.
http://matthewmeye.rs/obsidian-kanban/How%20do%20I/Add%20an%20image%20to%20a%20card/

It would be very interesting to be able to use the same line for banner and kanban.
The current problem is that kanban and banner use a different format.

Banner
Journal/images/Clipboard Image (2).jpg

Kanban
"![](Clipboard%20Image%20(2).jpg)"

Would it be possible to accept this format in banner?
Also in edit mode you can see the image with the kanban format.

Exported Banner

Screen Shot 2021-12-08 at 3 03 23 PM

Screen Shot 2021-12-08 at 3 03 59 PM

When I exported an md file with banner in pdf format it seems to be a bit displaced. Could it be fixed if it's not too much of a trouble?

Does not work with Export to PDF

Hi there, i've been trying to get your plugin to work with Export to PDF but it just ain't playing ball.

Screenshot of what it looks like exporting to PDF:

image
Versus what it should look like:
image

Thank you!

Feature Request: Support absolute path

Does not work:

banner: /files/201230-dolf-en-mark.png

Works

banner: files/201230-dolf-en-mark.png

I have a website build script that expects an absolute path (relative to the vault location, see above). The plugin only works with relative paths, I believe.

Could you add a standardization function, or a function that tries a few locations to find the picture?

[Feature Request] Support for video formats

Currently, you can make animated banners with gif and animated webp and png files. But gif is generally a low quality format, and webp and apng aren't very popular, so most of the time you need to convert them beforehand. The ability to use mp4 and webm files with autoplay and loop enabled would be much simpler.

Feature Request: Automatically add banners based on tag combination

It would be awesome to be able to automatically add a banner depending on the note tag or tag combination

for example

tags: [article, business, noise, avocados]

tags to look for, [article, business]
and then select a default image for that combination, for example _banners/article_business.jpg

REQ: setting to position emoji icons on banner

I really like your plugin, thanks a lot for developing it. I was wondering if you could add a setting with which you can determine the position of the emoji icon on the banner. Currently it shows like this:

20220118 Obsidian banner emoji 1

And I would love it like this:

20220118 Obsidian banner emoji 2

I know this can be done with custom CSS like:

.has-banner-icon .obsidian-banner-icon {
    font-size: 4em;
    margin-top: -.9em; /* originally -1.2em */
    margin-bottom: -0.3em;
}

But making it a setting would be great.
If you want to go all out ;-) you can make it draggable like the banner itself.
But a disadvantage would probably be another two lines in the frontmatter block for X/Y offset.

Thanks, Jan

Ability to set banner hight in frontmatter

I tried to add to the frontmatter:
banner_z: 150px

But this doesn't do anything - it was just my try to see if I could change hight dynamically
If possible, would you mind to implement also hight?
so we can style hight, depending our user case

Display a title in the banner

It would be nice in addition to displaying an icon in the banner, that a title could be provide that renders in the header.

Or better yet that the page is not pushed down by the banner but is behind the document. that way I can use markdown to control what content appears in the banner area.

Thank you for this interesting plugin.

Shift banners downwards?

Hey i really like the aestetic looks of banners. So thank you first of all for your work.

However i was wondering if there is the posibility to shift the banner downwards? I also use the Breadcrumbs plugin but it interferes with banners and overlaps.

[REQUEST] Alongside Unsplash, add other picture APIs

Hi, there are several sources of rotating pictures you could add.

Some suggestions are:

  • Bing daily pictures;
  • NASA's image of the day;
  • The Guardian's best photographs of the day;
  • Nat Geo photo of the day.

Thanks!

Can't Export PDF when Plug-in Enabled

Trying to export a note as a PDF using the built-in Obsidian functionality, I get the following error.

Error: Failed to save PDF.

Also causes generates an error using the Pandoc plugin when trying to export.

Error: Pandoc export failed: TypeError: Cannot read property 'parentElement' of null.

Disabling the Banners plug-in allows exports to work in both cases. The documents I tried to export have no Banners defined on them. Export would work on simple notes with no embedded image files.

Obsidian version: 0.13.19 and 0.13.14
Banners version: 1.2.0

Love the plug-in but I have to disabled it for now. Need the export function more.

Thank you

Banner in my kanban board

Hi, I'm using the kanban plugin and I would like to set a banner also on that note.
Apparently right now is not possible to visualize it without going to the "open as markdown" view as you can see from my screenshot:

image

and this is the markdown view:

image

Apparently, the DOM structure for the kanban view is quite different from the markdown one and it leads to do not having the banner appearing on the page.

Thank you

Display Banners in Live Preview

What

  • If in Preview Mode, Banners are displayed perfectly
  • I look forward to seeing Banners also displayed during Live Preview mode.

No rush! But thanks for your awesome plugin!

image

Recent update fails to load

I updated the plugin (via the community store) and the Banner plugin automatically turned itself off. Attempts to turn it back on bring up the "Failed to load plugin obsidian-banners" prompt.

Didn't do too much testing to see if there's a conflict but I tried disabling all my other plugins, it didn't help.

TypeError when mixed with the Tasks plugin (interferes with Preview mode processing from Tasks)

When both Tasks and Banners are enabled, there is a TypeError output to the console from Banners and the Preview mode processing of checkbox lists that Tasks performs doesn't work. The error only shows up in the console if both Banners and Tasks are enabled. If I disable Tasks then the error from the Banners code does not appear. This does not prevent Banners from putting the image at the top of Preview, though. I was going to submit a Tasks bug but the error is coming from the Banners code (at least judging by the stack trace below).

There might be issues inter-operating with other plugins but Tasks is the only one that I have that is causing an issue.

Uncaught (in promise) TypeError: Cannot read property 'hasClass' of null
    at BannersPlugin.eval (eval at <anonymous> (app.js:1), <anonymous>:1542:69)
    at Generator.next (<anonymous>)
    at eval (eval at <anonymous> (app.js:1), <anonymous>:31:71)
    at new Promise (<anonymous>)
    at __awaiter (eval at <anonymous> (app.js:1), <anonymous>:27:12)
    at eval (eval at <anonymous> (app.js:1), <anonymous>:1540:57)
    at Function.<anonymous> (app.js:1)
    at app.js:1
    at Object.next (app.js:1)
    at app.js:1

Obsidian Version: 0.12.15
Banners Version: 1.1.0
Tasks Version: 1.3.0

Banner re-inserting itself

This only seems to happen with daily notes and I'm not sure why. Whenever I navigate away from the note (whether in edit mode or not), a new YAML block gets inserted before the one already there. This new block only contains the banner and nothing else so it seems like this would be the plugin causing it

BannerBug

Questions about Emoji

Hi
I encountered some problems when using it. It seems that it can't use "Win + . " This key combination adds Emoji. If you can directly add Emoji, I believe it will be more convenient to use.
Thank you for your plug-in. It's really great. 🥰🥰🥰

动画2

Obsidian update destroyed the readable line length full image.

Hi, I had the obs version of a week ago and everything worked as I loved it. Addon is amazing. You can see in the screenshot a snippet of my daily note. Before the update the image was still shows through the complete width. So from total left to total right. That is now in live-preview not anymore the case. The second image is the reading view. That is how I wanted it to be and how it was in the previous version.
Is it intended to be only line-length at live-preview or is that a "bug" caused by the new version of obsidian.

Will an update patch follow to fix that or is that issue to small/ unimportant?

image
image

transcluded notes have a vertical offset, despite having no banners

Hi! Great plugin you made there, thanks a bunch 🤩 !

Just noticed what I think is a small bug: when transcluding a page with the ![Page] syntax, the embed contains a weird vertical offset that seems to correspond to the banner height, despite the embedded page having no banner. Here's a screenshot:

Screenshot 2021-08-29 at 20 44 15

The page that embeds ("Home") does have a banner. See vertical space in the Vrac embed in this page. I can't reproduce the bug if the embedder page ("Home" here) doesn't have a banner.

Please let me know if you need more info about my setup, and thanks for doing this plugin again 🙏

PDF-Export fails

While obsidian-banners is enabled with default settings, obsidian fails to export the selected file to pdf.
Restart or Reinstall didnt help. Disabling obsidian-banners fixed the issue.
Error in console:
image
image

Unwanted space above the banner

Hi,

neat plug-in, thanks!

I'm trying to figure out why there's space above my banners, and an expander handle that I'd like to get rid of.

I think the expander handle goes away by choosing the embed style, is that right?

I can't get rid of the extra size, and I narrowed it down to one css rule, but I don't know why it's happening or how I can fix it.

Attaching screenshots of the one css rule enabled/disabled if that helps.
Screenshot from 2022-02-17 17-09-14
Screenshot from 2022-02-17 17-09-21

I can't see the banner on reading mode

If I want to review and enjoy my past daily notes the banner is one of the most beautiful starts possible. A photo that describes my day perfectly with that gradient that flows into my daily notes. But I can only see it in live preview and nowhere else.
If that should be like this: Feature request PLS BRING AN OPTION FOR READING VIEW
If is should show in reading menu, then what could be reasons for it not working?

Native emoji in icon

Hi,

The new icon function in really great, but when I tried to add an emoji (🇺🇸), it didn't work as expected and it shows me only a big "U".
Screenshot 2022-01-19 at 19 03 51

Screenshot 2022-01-19 at 19 07 19

Would it be possible to render native emoji in icon, because those one looks a bit chunky.
Thanks

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.