Hiding YAML in Edit Mode

Use case or problem

YAML appears to have won the battle for the preferred metadata section format. Obsidian is also supporting it more directly with support for aliases. This frontmatter is only going to grow in size - and is potentially in every file.

Unfortunately, the requirement to place the metadata at the top of the text file goes against many design rules by getting in between the meat of note and the interface. As yaml headers expand, the true content of the note will get pushed further and further down and the visual clutter will increase.

Ideally, it would be nice to have the YAML metadata be visible only when you need to access it, and not take front stage for every note at the top of the page.

Similar discussions from other forums:

Proposed solution

A couple of options:

  1. Provide a global hotkey that turns on and off the display of YAML headers that is persistent. That way you can turn it off and forget about it.
  2. Provide a separate YAML editor panel that will move the YAML text out of the primary view (See the discussion here)
  3. Support having the YAML code at the end of the document - this would at least get it out of the way

Current workaround (optional)

Currently I’ve moved all YAML text to the bottom just to get it out of the way. Dataview still supports this, but Obsidian known keys like aliases: will not support it.

Also, you can hide the metadata by switching to the preview mode. Even if you use this as compromise, a WYSIWYG editor will reopen this problem.

Related feature requests (optional)

Thanks for considering this!

13 Likes

I like the idea of a hotkey to collapse/expand YAML in the editor.

3 Likes

I just fold the YAML whenever I need to hide it. As long as Fold indent is enabled in settings, you can fold/unfold a YAML and even set a hotkey

2 Likes

That works great! But I don’t want to fold my indents. So a dedicated “Fold YAML” toggle would be appreciated.

3 Likes

Great feedback @DEV_Scribbles but it is admittedly one more step away from a clean interface - and collapsing also still leaves behind a trigger.

And as to the fact that it is supported on preview mode and why isn’t that sufficient? I would argue (again design aesthetics and usability) that it is in Edit mode that the need for clean space is the most important. It is why iaWriter was successful with its super-clean writer focus mode.

There is something beautiful about starting a new card with it being completely a blank page, ready for filling. Having to see a computer-ese YAML header with metadata fields for every card is a quick mind sucker for creativity.

Of course, just my thoughts on the matter and putting it out there. :slight_smile: Welcome the discussion!

1 Like

This would be my preference because I don’t want a separate YAML editor panel as that gets confusing and tight on smaller screens and hot keys to turn on and off the display isn’t how I think. I like having the indexing, tags aliases and all the metadata stuff at the end. I can get to it easily if I need to see or edit it but it is toof the way for my normal note use.

1 Like

I second the global hotkey solution. Putting the YAML frontmatter at the end of the document breaks too much compatibility with other software. Especially when you’re interested to work with stuffs that make it popular. Like static site generators.

1 Like