I love YAML.
Wait, let me back up. I love YAML that looks like this, even more than JSON:
Projects:
C/C++ Libraries:
- libyaml # "C" Fast YAML 1.1
- Syck # (dated) "C" YAML 1.0
- yaml-cpp # C++ YAML 1.2 implementation
Ruby:
- psych # libyaml wrapper (in Ruby core for 1.9.2)
- RbYaml # YAML 1.1 (PyYaml Port)
- yaml4r # YAML 1.0, standard library syck binding
...
I love YAML anchors and references too, and sometimes wish JSON had them.
But I hope most of us can agree that the following is not so human readable (I know this example is didactic, but the point is since it is valid YAML, people you're collaborating with could pollute your data with such features):
!!map {
? !!str "sequence"
: !!seq [ !!str "one", !!str "two" ],
? !!str "mapping"
: !!map {
? !!str "sky" : !!str "blue",
? !!str "sea" : !!str "green",
},
}
So I'm disappointed I can't find any widespread coups to standardize a simplified subset of YAML, at least with a cursory Google search.
Does anyone know of one?
YAML is a popular programming language because it is human-readable and easy to understand. It can also be used in conjunction with other programming languages.
YAML is a digestible data serialization language often used to create configuration files with any programming language. Designed for human interaction, YAML is a strict superset of JSON, another data serialization language.
Definition. YAML is a human-readable data serialization standard that can be used in conjunction with all programming languages and is often used to write configuration files.
YAML Ain't Markup Language is a data serialization language that matches user's expectations about data. It designed to be human friendly and works perfectly with other programming languages. It is useful to manage data and includes Unicode printable characters.
There are many such subsets. Almost every YAML library defines one implicitly by the format that results from round-tripping (loading YAML into internal data and serialising the data back to YAML).
You often can influence these subsets, but they tend to have useful defaults with block structure for larger collections and flow-style for smaller ones (each according to what the library developer considered readable).
IMO the way to deal with rogue editors is to round-trip the code through the yaml
utility (of which I am the author) that comes with ruamel.yaml parser, and then use it. If you don't like the subset it forces on you, it is should be relatively easy to make changes to its serializer settings by experimenting. Such "normalisation" is IMO a must before storing/updating any YAML file in a revision control system.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With