Working with TOML
Do you like the simplicity of INI files but wish they were formally specified and had a few more features? So did Tom Preston-Werner, founder of services such as GitHub and Gravatar. He created Tom's Obvious, Minimal Language, or TOML for short. This relatively new format is seeing increasing adoption in new projects. In fact, you have used it multiple times by now as well: Cargo's dependencies are specified in every project's Cargo.toml
file!
Getting started
At its heart, TOML is all about key-value pairs. This is the simplest TOML file you can create:
message = "Hello World"
Here, the key message has the "Hello World"
value. A value can also be an array:
messages: ["Hello", "World", "out", "there"]
A group of key-values is called a table. The following TOML lets the smileys
table contain the happy
key with the ":)"
value and the sad
key with the ":("
value:
[smileys] happy = ":)" sad = ":("
A particularly small table can be inlined, that is, written in one line. The last example...