Closed josineto closed 2 months ago
I could replace the YAML parser. Let’s see.
https://eemeli.org/yaml/#schema-options
Merge keys are a YAML 1.1 feature that is not a part of the 1.2 spec.
So feature-wise it’s deprecated but can be enabled using the merge: true
option. I can do it a quick.
In the configuration file, it's very useful to use YAML node anchors (e.g.
&date
, referenced later as*date
) to ease reading and avoid repetition. But another YAML feature, the merge key (<<
, used as<<: *date
to merge content from*date
with the current field), seems to not be supported by the Sveltia CMS' YAML parser.Whenever I use
<<
, loading an entry yelds an error: "sveltia-cms.js:37 Uncaught (in promise) TypeError: Cannot read properties of undefined (reading 'replace')". If I use<<
inside a field that itself is referenced by an anchor, there's no error in the console, but the field is created as a generic required string field regardless of its configuration.There's a question in Stack Overflow about the merge key. It seems to be optional to parsers to support it, but I think it greatly simplifies the config file.