YAML
YAML operators
Introduction
Custom operators for converting YAML
Usage
Configuration options
Option | Default | Description |
---|---|---|
|
| Indentation width to use (in spaces) when serializing. |
|
| Do not throw on invalid types (like function in the safe schema) and skip pairs and single values with such types. |
|
| Specifies level of nesting, when to switch from block to flow style for collections. -1 means block style everwhere. |
| "tag" => "style" map. Each tag may have own set of styles. | |
|
| If true, sort keys when dumping YAML. If a function, use the function to sort the keys. |
| 80 | Set max line width for serialized output. |
| false | If true, don't convert duplicate objects into references. |
|
| 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 |
|
| 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. |
Nabu
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
Memory storage engine
If you are using the memory storage engine the YAML plugin must be configured
Operators
$yamlToObject
{ $yamlToObject: <expression> }
Convert a YAML string to an object
To convert YAML as front matter we need to specify some extra parameters
$objectToYaml
{ $objectToYaml: <expression> }
Convert an object to a YAML string
Last updated