Snippet is hiding div in preview mode but not in reading mode

What I’m trying to do

Hello,

So, I am trying to do a little dashboard.

And one of the things I need is a link to open (or create if it does not exist) the daily notes, and I want it to just look like any other link (maybe I missed something but it feels like this is something that many people want but is so complicated to make…).

I have managed to do almost everything that I want, but I have an issue.
To go dtraight to the point, I want to hide only a part of a note, and I manage to do it on preview mode but not in reading mode.

Things I have tried

So here is what I did :

  • Installed “buttons” plugin
  • Created a “daily-notes” button and put it on a button note inside my “templates” folder
  • Put an inline version of the “daily-notes” button on my dashboard
  • Created a css snippet to make the button look like a classic link

So far so good, event though I had to put my dashboard in reading view as inline button don’t render in preview mode… (used “Homepage” plugin for that)

So far so good, I go to sleep. But when opening obsidian today, when the dashboard open… it is in reading view but the inline button is not clickable (it is like the button does not exist).

I load the button template note and I go back to the dashboard : the button is now OK

So it seem like until the button template note has not been loaded, the inline button act as if it did not exist.

Solution : put the button directly on the dashboard and then hide it with a snippet !

So I put the button on the dashboard and I put a

around.

I create a snippet that is just :

.button-to-hide { display: none !important; }

This work perfectly in live preview mode, but in reading mode, it does not work, anything I put in the div is still visible in reading mode whether it is the inline button or text.

Does any one know how to make my snippet also affect the reading mode view ?
Or is there a better way to apply a css snippet to only a part of a note ?

I hope my explanation was clear enought.
Thanks to anyone taking time to help =)

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