Files
oam/knowledge base/toml.md
2024-07-17 18:31:47 +02:00

1.8 KiB

TOML

Tom's Obvious, Minimal Language.

Minimal configuration file format. Supposedly easy to read for its "obvious" semantics.
Designed to map unambiguously to a hash table.

  1. TL;DR
  2. Further readings
    1. Sources

TL;DR

Case-sensitive.
Must be a valid UTF-8 encoded Unicode document.

Hash symbols mark the rest of the line as a comment, except when they are inside strings.

# Full line comment
key1 = "value"  # EOL comment
key2 = "# string, not comment"

Key-value pairs are the basic building blocks of TOML.
Keys stay on the left of = signs, values are on the right of them.
Whitespace is ignored around keys and values.
Key, = and value must be on the same line.
Key-value pairs must be separated by new lines.
Keys must be unique.

# valid pairs
key1 = "value1"
     key2           =                  "value2"
key3="value2"

# invalid pairs
key4 =
key5 = "value5" key5 = "value6"
key2 = "value7"

Keys may be bare, quoted, or dotted.
Bare keys allow only ASCII characters, quoted keys allow any string and dotted keys group similar properties together.
Whitespace around dot-separated parts is ignored.

bare_key_1   =  42
2bare-2key = true
fruit.name = "banana"
fruit. color = "yellow"
fruit . flavor = "banana"
"ʎǝʞ" = "value"
'key2' = "value"
'quoted "value"' = "value"

Further readings

Sources