Unable to get any snippet to work in obsidian. Please help!

Things I have tried

Hey kind people of Obsidian,

I am a new user & it’s the latest version. The problem is that I cannot get any snippet to work! I copied a simple snippet to TextEdit & saved it. I placed it in the Snippets folder with the .css extension. The snippet shows up when I reload but it does not seem to work. I use the default dark theme with no plug-ins installed. What am I missing? Please help!!!

This is a difficult question to answer. Likely, the css is being loaded just fine, but the content fails to successfully select any element to apply its style to.

To test that the css is being loaded, put a unique string in the file as a comment (e.g. /* You can't find this in any other file. */). Then open the console (ctrl + shift+I) and search in the element windows for your string. It should appear in one of the loaded styles.

In the element window of the console, if you can select the elements you expected to style and expand the applied styles to see if yours is being overridden by a more specific selector.

1 Like

Hi, thanks for replying.

In which file exactly should I put a unique string? I did open the console and the element window has a bunch of code in it. Sorry, I am totally new to this.

In the Appearance options, make to toggle the snippet on.

Hi, thanks for replying.

I have toggled it on but it doesn’t work! This is driving me crazy. Such a simple thing but I can’t get it to work!

Attached is a simple CSS file in a Zip.

  1. Download the Zip
  2. Decompress the Zip and extract the CSS file inside
  3. Add the CSS file to your snippets folder
  4. Reload the snippets folder from: Obsidian → Settings → Appearance → CSS snippets
  5. Toggle the snippet on
  6. Look at your vault. The title at the very top of every note (and even the title of the vault itself) should have turned red

Does this work? If yes:

  1. Check that your current CSS snippets are in plain text, not RTF. If using TextEdit on a Mac, select: Format → Make Plain Text
  2. Check the CSS snippets have the file extension: .css (not .txt)
  3. Bin the CSS snippet that we used to test your settings

Angel

EDIT: This attachment…
TitleAboveNoteCSS.zip (773 Bytes)

2 Likes

Turn off all other plugins.

You’re not providing enough information for people to help! To begin with, please share your:

  1. Appearance setting screenshot, especially the snippet part;
  2. CSS file;
  3. What you expect the CSS to accomplish.

Maybe the CSS file does work, it’s just faulty and doesn’t do what you want somehow… Simply “it doesn’t work” will make anyone who tries to help you scratch their head, so providing as much as detail on how it doesn’t work would be super helpful, thanks!

1 Like

Hi, thanks for your reply.

Hi, thanks for your reply.

You’re right, I should have provided more detail. The issue has now been solved.

Hi, thank you so much.

This worked!!! I was converting the RTFs directly to .css when I should have converted it to Plain Text first. I am new to Mac OS & had no idea about RTFs. Thank you for taking the time to help me out.

Good to hear you’ve got it working. Happy for you.

In TextEdit → Preferences, you can set whether you want new documents to default to Rich or Plain text. And it is always easy to convert between the two formats using the Format → Make Rich / Plain Text toggle.

Angel

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