Non-Source mode property edits detrimentally convert flow- to block-style (multi-level YAML, list of lists, sequence of sequences, ..)

Steps to reproduce

  • Create a new vault (to show it works without plugins)
  • Create a note or replace the note with the following YAML frontmatter (all examples taken from Chapter 7 flow-style productions of YAML 1.2.2, the latest version of YAML):
  • “my_use_case” is in a format that allows overview of a large list of numbers in a way that makes it simple (in Source mode) to edit individual entries. The actual data would be height, center, width, color and name of a Gaussian peak
---
test1:
 - [ one, two ]  
 - [three ,four]
test2:
 [ [ "one",
     "two" ],
   [ "three",
    "four" ] ]
test3:
 [ "double quoted",
   "single quoted",
   "plain text",
   [ "nested" ],
   { "single": "pair" } ]
test4:
 - { one : two , three: four , }
 - {five: six,seven : eight}
test5:
 [ { "one": "two",
     "three": "four" },
   { "five": "six",
     "seven": "eight" } ]
test6:
 [ { "foo": "bar" } ]
test7:
 [ [ { "YAML": "separate" } ],
   [ { null: "empty key entry" } ],
   [ { { "JSON": "like" }: "adjacent" } ] ]
test8:
 [ [ "a", "b" ],
   { "a": "b" },
   "a",
   "b",
   "c" ]
test9:
 - [ a, b ]
 - { a: b }
 - "a"
 - 'b'
 - c
test10:
 { "implicit block key":
   [ { "implicit flow key": "value" } ] }
test11:
 { "foo": "",
   "": "bar" }
my_use_case:
 [ [0, 0, 0, 0, 0], [0, 0, 0, 0, 0], [0, 0, 0, 0, 0], [0, 0, 0, 0, 0], [0, 0, 0, 0, 0], [0, 0, 0, 0, 0], [0, 0, 0, 0, 0], [0, 0, 0, 0, 0], [0, 0, 0, 0, 0], [0, 0, 0, 0, 0], [0, 0, 0, 0, 0], [0, 0, 0, 0, 0], [0, 0, 0, 0, 0], [0, 0, 0, 0, 0], [0, 0, 0, 0, 0], [0, 0, 0, 0, 0], [0, 0, 0, 0, 0], [0, 0, 0, 0, 0], [0, 0, 0, 0, 0], [0, 0, 0, 0, 0], [0, 0, 0, 0, 0], [0, 0, 0, 0, 0], [0, 0, 0, 0, 0], [0, 0, 0, 0, 0], [0, 0, 0, 0, 0], [0, 0, 0, 0, 0], [0, 0, 0, 0, 0], [0, 0, 0, 0, 0], [0, 0, 0, 0, 0], [0, 0, 0, 0, 0], [0, 0, 0, 0, 0], [0, 0, 0, 0, 0], [0, 0, 0, 0, 0], [0, 0, 0, 0, 0], [0, 0, 0, 0, 0], [0, 0, 0, 0, 0], [0, 0, 0, 0, 0], [0, 0, 0, 0, 0], [0, 0, 0, 0, 0], [0, 0, 0, 0, 0], [0, 0, 0, 0, 0] ]
---

This is displayed in the properties or bases view as:


  • Perform any action using the Properties view (such as rename a key, click to add a new key) or perform any action using Bases views (add a non-existent column and fill it in for this note)

Did you follow the troubleshooting guide? [Y/N]

Yes, this is default Obsidian behaviour

Expected result

I expect any flow-style YAML to be left as-is, given it is part of the YAML 1.2.2 specification, unless any conversion is required and immediately usable by Obsidian where the flow-style YAML was not.

Actual result

  • Observe that the entire YAML frontmatter has converted to block style YAML as follows
  • “my_use_case” has been destructively converted to a completely unusable format
---
test1:
  - - one
    - two
  - - three
    - four
test2:
  - - one
    - two
  - - three
    - four
test3:
  - double quoted
  - single quoted
  - plain text
  - - nested
  - single: pair
test4:
  - one: two
    three: four
  - five: six
    seven: eight
test5:
  - one: two
    three: four
  - five: six
    seven: eight
test6:
  - foo: bar
test7:
  - - YAML: separate
  - - "": empty key entry
  - - '{ "JSON": "like" }': adjacent
test8:
  - - a
    - b
  - a: b
  - a
  - b
  - c
test9:
  - - a
    - b
  - a: b
  - a
  - b
  - c
test10:
  implicit block key:
    - implicit flow key: value
test11:
  foo: ""
  "": bar
my_use_case:
  - - 0
    - 0
    - 0
    - 0
    - 0
  - - 0
    - 0
    - 0
    - 0
    - 0
  - - 0
    - 0
    - 0
    - 0
    - 0
  - - 0
    - 0
    - 0
    - 0
    - 0
  - - 0
    - 0
    - 0
    - 0
    - 0
  - - 0
    - 0
    - 0
    - 0
    - 0
  - - 0
    - 0
    - 0
    - 0
    - 0
  - - 0
    - 0
    - 0
    - 0
    - 0
  - - 0
    - 0
    - 0
    - 0
    - 0
  - - 0
    - 0
    - 0
    - 0
    - 0
  - - 0
    - 0
    - 0
    - 0
    - 0
  - - 0
    - 0
    - 0
    - 0
    - 0
  - - 0
    - 0
    - 0
    - 0
    - 0
  - - 0
    - 0
    - 0
    - 0
    - 0
  - - 0
    - 0
    - 0
    - 0
    - 0
  - - 0
    - 0
    - 0
    - 0
    - 0
  - - 0
    - 0
    - 0
    - 0
    - 0
  - - 0
    - 0
    - 0
    - 0
    - 0
  - - 0
    - 0
    - 0
    - 0
    - 0
  - - 0
    - 0
    - 0
    - 0
    - 0
  - - 0
    - 0
    - 0
    - 0
    - 0
  - - 0
    - 0
    - 0
    - 0
    - 0
  - - 0
    - 0
    - 0
    - 0
    - 0
  - - 0
    - 0
    - 0
    - 0
    - 0
  - - 0
    - 0
    - 0
    - 0
    - 0
  - - 0
    - 0
    - 0
    - 0
    - 0
  - - 0
    - 0
    - 0
    - 0
    - 0
  - - 0
    - 0
    - 0
    - 0
    - 0
  - - 0
    - 0
    - 0
    - 0
    - 0
  - - 0
    - 0
    - 0
    - 0
    - 0
  - - 0
    - 0
    - 0
    - 0
    - 0
  - - 0
    - 0
    - 0
    - 0
    - 0
  - - 0
    - 0
    - 0
    - 0
    - 0
  - - 0
    - 0
    - 0
    - 0
    - 0
  - - 0
    - 0
    - 0
    - 0
    - 0
  - - 0
    - 0
    - 0
    - 0
    - 0
  - - 0
    - 0
    - 0
    - 0
    - 0
  - - 0
    - 0
    - 0
    - 0
    - 0
  - - 0
    - 0
    - 0
    - 0
    - 0
  - - 0
    - 0
    - 0
    - 0
    - 0
  - - 0
    - 0
    - 0
    - 0
    - 0
---

This is displayed in the properties or bases view as:


Or: There is no visible difference after Obsidian has modified flow-style YAML unprompted.

This modification becomes irreversible within the amount of edits required to overwrite the undo history.

Environment

SYSTEM INFO:
Obsidian version: v1.9.1
Installer version: v1.7.7
Operating system: Windows 11 Home 10.0.26100
Login status: logged in
Language: en
Catalyst license: insider
Insider build toggle: on
Live preview: on
Base theme: dark
Community theme: none
Snippets enabled: 0
Restricted mode: on

RECOMMENDATIONS:
none


Additional information

This has been a bug since the Properties updates, but was manageable (despite the conversion from flow to block style being completely unnecessary) through only using Source mode.

With Bases, the bug becomes entirely undetectable to typical users and irreversibly converts YAML formats to an actively worse-to-edit format.

Obsidian should do absolutely nothing to flow-style YAML when any random part of the YAML is modified outside of Source mode. Bases should not destructively and irreparably modify YAML frontmatter. Ideally there are no changes to flow-style YAML at any point, given that the modification remains non-functional in both Properties and Bases views and has no user benefit whatsoever. Furthermore, flow-style YAML should remain intact given it is part of the current YAML specification.

All of these are multi-level YAML sequences that are indicated as not recognized in the Properties as well as the Bases views, both before and after conversion. The format conversion from YAML flow-style to block-style has no benefits to either view, has no benefits to the user and in fact it is detrimental.

Obsidian does not enforce the block style YAML at any point. This conversion is not done in any way to improve the usability of the YAML. This is clearly a bug - it is a far too aggressively run piece of code to generate only block-style YAML to no user benefit and to active user detriment.

See:

Is there any way for a user to just not let Obsidian call this function? There are no settings or core plugins or anything to access this. When I add breakpoints to App.js lines e.prototype.processFrontMatter = function(e, t, n) { and return [4, this.ctx.app.fileManager.processFrontMatter(this.file, (function(n) { it doesn’t do anything.

EDIT: I’m not sure the problem is that function - apparently Obsidian uses something internally, and this strips YAML from flow-style formatting (besides many other aspects allowable in the YAML spec).