Always Fold or Unfold Frontmatter in Editing View (Setting + Hotkey)

Use case or problem

Each note stores its fold state (folded/unfolded) for frontmatter. I would like to request a setting to “Always Fold/Unfold Frontmatter in Editing View for all notes”. Additionally it would be useful if this setting could be toggled with a keyboard shortcut.

I almost exclusively use Editing View. This feature request would further improve the user experience in that mode by hiding the frontmatter by default but still allowing it to be unfolded easily. Compare this to Reading View which hides frontmatter all together.

  • 99% of the time I’m not editing frontmatter, so I don’t want to see it. I want all the frontmatter to be folded by default when I open a note. But I have the ability to unfold the frontmatter to edit.

  • 1% of the time, I’d like all the frontmatter unfolded so I can easily edit many notes in succession without needing to unfold the frontmatter for each note.

  • I don’t want individual notes to remember this preference, I want frontmatter to be FOLDED or UNFOLDED for all notes.

Proposed solution

Implemented two ways.

  1. Setting
  2. Hotkey to toggle Folded/Unfolded (for all notes)

I’d prefer both.

There is already a setting (“Editor > Show frontmatter”) which will show/hide frontmatter in Reading View.

I propose an additional setting (“Editor > Fold frontmatter”) which would always fold or unfold frontmatter while in Editing View. This would also affect notes currently open.

There may be a need for an additional setting to override per-note frontmatter fold settings. With the current behavior, each note remembers how the user last folded the frontmatter for each note. Some users may prefer this behavior. So an additional setting would be required, like this…

(“Override per-note frontmatter folding”)

Current workaround (optional)

  1. THEMES: Some custom themes might already support this behavior, but I prefer using the default themes from Obsidian.

  2. CUSTOM CSS TO HIDE FRONTMATTER: This other feature request had a partial work around. It hides the frontmatter but you can no longer see or edit it. However, if you place your cursor on the blank line and hit backspace, you remove one of the three dashes, which allows you to see the frontmatter and edit it. (Albeit the font size and formatting are wrong.) From this thread. Option to hide frontmatter in live preview

  3. TOGGLE CUSTOM CSS WITH A HOTKEY: Building off of #2, you can use a community plugin called “Snippet Commands” to create a hotkey for the CSS snippet. (This idea comes from user dryice in this thread.)

Related feature requests (optional)

  1. Option for Fold Frontmatter by default

This is similar to my feature request, but mine contains specifics about how the feature would function, additional requirements, and how to not step on existing functionality.

  1. Option to hide frontmatter in live preview

This feature request is similar to mine, but I don’t seek to hide the frontmatter completely, just have it folded by default.

  1. Reduced frontmatter in Reading view

This is similar, but I don’t want any information shown when folded, not even tags or aliases.

  1. Hiding YAML in Edit Mode

Another good discussion on this topic.

1 Like