SNIPPET
lajawi

Snippets

My personal Obsidian Snippets

Obsidian Snippets

My personal Obsidian snippets.

Adding & Enabling Snippets

Learn to add and enable a snippet on Obsidian's Help Site.

[!IMPORTANT] For all of the below snippets, make sure to enable the relevant snippet file for the snippet to take effect.

CSS Classes

[!TIP] How to add a cssclass to a note?

  1. First, add a property named cssclasses (this is a default one provided by Obsidian)
  2. Add the class name detailed below to apply it to the note

Properties syntax at the top of the note

---
cssclasses:
  - cssclass-goes-here
---
CSS ClassDescriptionSnippet File
full-widthNegates the setting Readable line length for a notenote-full-line-width.css
bases-no-toolbarHides a base's toolbar, including those in code blocks1bases-no-toolbar.css
callout-blend-mode-unsetSets all callouts' blend mode in the note to normal2callout-blend-mode-unset.css

Callouts

More info on callouts.

Types

TypeDescriptionSnippet File
[!chat]Display chats with nested callouts, more infocallout-chat.css
[!grid]Structure content inside this callout in a grid, more infocallout-grid.css
[!caption]Caption images or other content, more infocallout-captions

Metadata

[!TIP] Metadata is added to a callout in the square brackets of the type identifier, after the type itself with a pipe (|):

> [!type|metadata another-metadata]
MetadataAbbreviationDescriptionSnippet File
hide-titleHides the callout's titlecallout-hide-title
hide-backgroundhide-bgHides the callout's backgroundcallout-hide-background.css
borderAdds a border to the calloutcallout-border.css
blend-unsetSets the callout's blend mode to normal3callout-blend-mode-unset.css

Bases

Alt

[!TIP] Alt text is added to an embedded base in the square brackets, after the file name itself with a pipe (|):

![[Games.base|alt another-alt]]

[!IMPORTANT] Alt text can only be added to bases that are not embedded through a code block directly. To apply the no-toolbar class to the full note, see CSS Classes.

AltDescriptionSnippet File
no-toolbarHides the base's toolbar3bases-no-toolbar.css

Other

[!TIP] These snippets only need to be enabled, and take effect on the full vault.

Snippet FileDescription
print-no-breaks-after-heading.cssAvoids putting a page break right after any heading or callout title when exporting to PDF or printing
table-alternating-colours.cssAlternates the colours of markdown tables
page-preview-show-title.cssMakes the title visible in the page previews
bases-list-unset-min-height.cssUnsets the minimum height imposed on only the list view of Bases
callout-embedded-images-remove-scrolling.cssFixes a bug where internal images when embedded in a callout cause the callout to have a scrollbar, due to the image automatically getting a 3px padding on the right and bottom. Forum post about it can be found here.

Footnotes

  1. Can be applied to individual embedded bases too, see Bases > Alt for more

  2. Can be applied to individual callouts too, see Callouts > Metadata for more

  3. Can be applied to the full note too, see CSS Classes for more 2

Related

How to Install

  1. Download the repository ZIP below
  2. Unzip it and find the CSS snippet file
  3. Move the CSS file into your vault's .obsidian/snippets/ folder
  4. Open Obsidian → Settings → Appearance → CSS Snippets → Enable it

Stats

Stars

2

Forks

0

Last updated 2mo ago

Categories

Tags

obsidian