YAML operators
Custom operators for converting YAML
indent?: number
2
Indentation width to use (in spaces) when serializing.
skipInvalid?: boolean
true
Do not throw on invalid types (like function in the safe schema) and skip pairs and single values with such types.
flowLevel?: number
-1
Specifies level of nesting, when to switch from block to flow style for collections. -1 means block style everwhere.
styles?: {[tag: string]: string}
"tag" => "style" map. Each tag may have own set of styles.
sortKeys?: boolean | ((a: any, b: any) => number);
false
If true, sort keys when dumping YAML. If a function, use the function to sort the keys.
lineWidth?: number
80
Set max line width for serialized output.
noRefs?: boolean
false
If true, don't convert duplicate objects into references.
noCompatMode?: boolean
false
If true don't try to be compatible with older yaml versions. Currently: don't quote "yes", "no" and so on, as required for YAML 1.1
condenseFlow?: boolean;
false
If true flow sequences will be condensed, omitting the space between a, b. Eg. '[a,b]', and omitting the space between key: value and quoting the key. Eg. '{"a":b}'. Can be useful when using yaml for pretty URL query params as spaces are %-encoded.
When using the Nabu storage engine, the YAML plugin is included by default. If you want to pass configuration options you can do it like this
If you are using the memory storage engine the YAML plugin must be configured
{ $yamlToObject: <expression> }
Convert a YAML string to an object
To convert YAML as front matter we need to specify some extra parameters
{ $objectToYaml: <expression> }
Convert an object to a YAML string