Last active
February 12, 2026 17:14
-
-
Save Boettner-eric/e15deae15ccae8605c5fcfc953e55de2 to your computer and use it in GitHub Desktop.
Toggle frontmatter in obsidian source and reading views.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| /* | |
| Hide all frontmatter by default (can still view properties in right pane) | |
| To view/edit add `show-frontmatter` class to cssclasses or toggle with Snippet Commands plugin | |
| */ | |
| /* Hide frontmatter preview for reading view */ | |
| .markdown-preview-view:not(.show-frontmatter) div.metadata-container { | |
| display: none; margin: 0px; height: 0px; visibility: hidden; | |
| } | |
| /* Hide frontmatter in source mode - hide lines containing frontmatter markers */ | |
| .markdown-source-view:not(.show-frontmatter) .cm-line:has(.cm-hmd-frontmatter) { | |
| display: none; | |
| height: 0; | |
| line-height: 0px; | |
| margin: 0; | |
| padding: 0; | |
| } | |
| /* Hide entire frontmatter block including content between --- markers */ | |
| .markdown-source-view:not(.show-frontmatter) .cm-line .cm-hmd-frontmatter { | |
| display: none; | |
| height: 0; | |
| line-height: 0; | |
| } | |
| /* Also hide the fold indicator for frontmatter lines */ | |
| .markdown-source-view:not(.show-frontmatter) .cm-line:has(.cm-hmd-frontmatter) .cm-fold-indicator { | |
| display: none; | |
| } |
Author
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
** Updated ** - made frontmatter hidden by default and added a class for showing in individual notes. This pairs better with the Snippet Commands plugin and pollutes fewer notes with cssclasses.