Repository navigation
Replies: 1 comment
|
For sure! I'm definitely interested in that becoming the only way the patch operation behaves, but the behavior must be absolutely bulletproof (in that it will handle all of the idiosyncrasies of yaml formatting that are allowed and in active use -- think things like multi-line keys here) and well-tested. The only reason the patch operation behaves in the way it does today is because it's easier to just let a library handle the deserializaion/serialization. |
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Summary
Patching one frontmatter key re-serialises the whole YAML block. This changes lines that the instruction never targeted. Would you consider an opt-in option, e.g.
preserveFrontmatterFormatting, that splices only the target key’s lines and leaves the rest of the block byte-for-byte unchanged?Observed (via the Local REST API MCP
vault_patch)origin:(empty) becomesorigin: nullafter a patch to a different key.value: nullwritesdestination: "null", a string rather than an empty value. This looks like a bug regardless of the option.created: {{date:YYYY-MM-DD}}are turned into a nested mapping after a patch to another key. I appreciate this is not plain YAML, but it is common in Obsidian templates.Expected (with the option on)
Only the lines of the target key change. If the edit cannot be spliced safely (anchors, aliases, complex flow nodes), fall back to the current behaviour.
Prior art
The Preserve Frontmatter Formatting Obsidian plugin takes this approach, with the same fallback.
All reactions