Properties: Alias key gets changed to "aliases"

Whitenoise says, “you indirectly interact with that API (and the underling parsing library) every time you use the properties UI”. I believe if you use the source view setting then you aren’t interacting with the properties UI and so won’t experience rewriting. Perhaps I’ve misunderstood (I only use properties for an occasional alias), but, it’s easy to test.

1 Like

Around v1.4.3, I did a small and hardly scientific test, but I think it was sound, watching for file changes. As long as I didn’t touch the Properties view UI in the note or the sidebar, no YAML was changed by Obsidian.

I think what they were saying is that Obsidian (and plugins) has had the ability to do it for some time, but Obsidian hasn’t itself until now (out of necessity to get Properties view to work). That’s how I read it.

2 Likes

Thanks for the replies. Would be nice if the team made it crystal clear.

Was just skimming through info here so I may not have the relevant input (as usual :slight_smile: ):
In an another thread I already pointed out that in my v1.3.5 Obsidian, the Linked Data Vocabularies and Link with Alias plugins were already making changes to my YAML format: it was not about the alias key being changed to aliases but alias values turned to multiline versions, which is why I made vault-wide changes to my YAML (and felt my installs even a little bit lighter and faster for some reason) and set different settings in my Linter afterwards. So under the hood it was Obsidian making these changes, before Properties for Insiders came out.

So I start with a file created in TextEdit with the following YAML:

---
alias: [the cat, sat on, the mat]
tag: kitty, kat
cssclass: mewot
---

I put the file in a folder and open the folder in Obsidian as a new vault.

I open the file properties pane in the sidebar, and alias is shown as aliases with three different aliases. If I remove the commas in the alias, it is shown as a single alias.

tag is changed to tags and cssclass is changed to cssclasses.

In source mode, the YAML header in the note shows the original text.

In preview and reading modes, the YAML header in the note shows the rewritten properties.

When I display all properties in the sidebar, I see alias (1) and aliases (0); cssclass (1) and cssclasses (0); and tag (1) and tags (0).

So properties changes how a YAML header is displayed but doesn’t rewrite the underlying text?

1 Like

And now try editing the YAML in Obsidian, first in source mode and then in live preview:
If you do it in source mode, all formatting stays, but if you do it in live preview, the formatting changes (forever: unless you CONTRL+Z out of it and make changes in source mode, then one can go back).

Interesting. I am interested to know if this is intended. I think it could be worth leaving it like this as a “feature”.

1 Like

Ah, yes. As soon as I edit in live preview (in the middle pane in my screenshot), the YAML is rewritten and I can see the changes in the source pane (in the top of the screenshot).

Not entirely transparent. Would all the files in a vault be rewritten if only one file is edited in live preview, or just the file being worked on? (Guess I can test that.) Wish this was clear in the documentation rather than leaving it to users to figure out.

I think you need to go inside the properties.
But I wonder what Linter or plugins that update date modified would do to change it. Probably you need to go inside to have the YAML be rewritten.

1 Like

My head → :melting_face: and :exploding_head:

changes

My head when trying to figure out where other people’s GIFs start and end: :melting_face: and :exploding_head:.
:)))

*Then Gino finds pause button and plays with it and not watch USA get beaten by Germany.*

1 Like

In the hope that this is a little clearer:

8486481749241180880b030642d92ee7b4fe1393

Ahm. Germany won.

1 Like

Obsidian is displaying the non-deprecated versions of deprecated property names (that it still recognizes for backward compatibility). https://help.obsidian.md/Editing+and+formatting/Properties#Deprecated+properties

I would expect it to rewrite them if you use the properties UI to change the note’s properties and to not rewrite them if you edit outside the UI.

1 Like

Just the file being worked on. The properties UI shows you the properties of the current file, you change them, and it saves those changes to the current file in the standard format that it uses (which may change the existing format if the existing format was written by hand).

1 Like

I thought the idea was for Obsidian to sanitize the entire vault, so I assumed that all files would be checked and rewritten (if necessary). A mix (if that is what is happening) of sanitized and not-sanitized seems a little odd … in my tiny mind.

I’m wondering if there’s some kind of OR solution to my alias v aliases problem…

currently one of my table columns is list(org, alias, note) - which works on files that haven’t had that property changed to “aliases”. I’ve tried a couple “OR” permutations thus far, but neither have worked:

  • list(org, alias OR aliases, note)
  • list(org, (alias OR aliases), note)

Anyone know whether I’m barking up the wrong tree entirely?
Would love to not go through & find/replace thousands of files, but could embark on that if necessary.

Please start a new thread for that question. Thanks!

1 Like

A goal of the new setup is to prevent users from writing bad YAML, but the reformatting of existing YAML is largely a side effect. YAML is horribly complicated and has numerous ways to write any given thing; Obsidian doesn’t preserve the exact formatting when it writes back to your file. From API: processFrontMatter removes string quotes, comments, types, formatting - #6 by Licat which I linked earlier:

The decision we made is for plugins to be able to interact with frontmatter easily. We do this by converting YAML into a JS object, which means it lose all of its YAML specific formatting and comments. This makes it easy for plugin developers to read and modify properties of a note, without requiring them to interact with an excessively complex YAML syntax tree, which would require them to understand how YAML is parsed internally.

Thanks for the reply and additional advice.

I have decided to move my notes to a different app.

As you are a moderator, can I ask you to close (delete, lock, anonymize, or whatever is possible) my forum account so that my personal data is removed / locked against future use?

Thanks in advance.

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.