YAML YAML, Go Away

I have a love-hate relationship with YAML as a metadata format. I love the ability to tag out fields and using dataview to grab them - and the ability to natively use cssclass, tags, and aliases fields.

But… man, I just can’t stand having all that mess at the top of the file. I don’t want to scroll through all the junk to get to the data. I really would love to store the metadata at the end - so much so, that is what I do for now and use a table format for the metadata to make it look beautiful. But I loose the access to the growing number of plugins that honor YAML processing.

Is anyone equally bothered by the YAML at the top requirement - and found a workaround (e.g. a plugin or CSS fragment that will always keep it hidden? a plugin that could preprocess the file to force the yaml to appear at the bottom?)

Or any hint that the YAML at the top requirement will be loosened? YAML front matter

Thank you, thank you

16 Likes

Just in case you didn’t already know - dataview now supports defining key:value pairs outside of the YAML block using ::

Name:: Buffy Summers
Occupation:: Vampire Slayer

3 Likes

Yes, thanks for pointing this out @Spidrax ! Hearing that dataview supports it globally now was the primary impetus for posting here. I’m debating whether to translate all of my existing metadata into “end matter” YAML blocks at the end of the file. Before making the jump I wanted to see if anyone has good workarounds for making YAML work without it clogging the front. I would love to be able to use cssclass: for instance.

Thanks again for responding - really appreciate the active forum volunteers.

1 Like

One thing to consider is future-proofing your notes. I don’t much like YAML either but it’s commonplace, so using a non-standard schema (including dataview’s inline approach) might not be prudent.

Maybe a plugin that lets us auto-collapse the YMAL frontmatter in edit view so it’s not in the way - that’s something I would appreciate.

21 Likes

Totally agree with @Spidrax here. But I think instead of a plugin, perhaps this should be a feature request since hiding the YAML is already implemented in Obsidian, except it works only in preview. We need a hot key to enable/disable it on the fly in edit mode and it solves all issues.

6 Likes

After enabling the Fold indents in the editor setting tab, open the Command panel and search for Fold All. For me, this folds the YAML frontmatter (using minimal theme).

@Rishi I came to the same conclusion after sleeping on the idea - I’ll make a post in the feature request forum. Thanks!

I’m always loathed to add work to the developers load, but then… they are so fast at development that perhaps they are looking for some new ideas :slight_smile:

1 Like

I added it to the feature request forum.

Also, for other readers, I found an old feature request that discussed (and successfully implemented) removal of YAML in the viewer mode.

4 Likes

I have had the same gripe, with sometimes very long lists of metadata at the top of my file.

Idea for plugin: Hide YAML (and dataview properties) in the file, but show them in the sidebar, as text fields or a table or something in that vein. Quicker to edit (you click a field, it selects the text, and you just start writing), easier on the eyes, less cognitive load.

Could even style the metadata so that arrays look like lists.

9 Likes

This css worked for me to hide in reading mode :

.workspace-leaf-content[data-mode=‘preview’] .frontmatter,
.workspace-leaf-content[data-mode=‘preview’] .frontmatter-container {
display: none;
}

3 Likes

I love having local files, I’m okay with having a limited amount of metadata in YAML front matter: can be quite easy to use, and can be effective for files that are just data. But I’m certainly not okay with using YAML as a pretend database format. And I won’t tolerate it in notes, documents etc.

Whilst I like local plaintext files, there are many things that work better in a database. Format like json contain plaintext, but no-one pretends they’re documents to be read - any contained documents have to be extracted (in WriteMonkey 3’s case there’s the json database plus synchronised markdown files - which is a very practical solution).

I stopped using YAML in my files when Obsidian announced it was going to use it for plugins. I don’t use plugins that require YAML. I’m happy to use inline tags - if they become intrusive that tells me I need to reconsider what I’m doing.

So I believe that hiding it is just using a very big screen to avoid seeing the elephant in the room.

1 Like

Or maybe an option to keep them at the top of the document, but in a seperate pannel at the right of the main one ? It would change nothing for the use of YAML in the final text document, just the way the software puts it on the screen.

3 Likes
1 Like