TOML¶
Files ending in .toml are formatted by the TOML pack
(rainbow_fmt.languages.toml, grammar
tree-sitter-toml).
title = "Example" # a comment
[ owner ]
name='Tom'
ports = [ 8000, 8001,
8002 ]
becomes
title = "Example" # a comment
[owner]
name = 'Tom'
ports = [8000, 8001, 8002]
What changes and what does not¶
The pack changes layout only; every value (strings in all four forms, numbers, dates and times, booleans) and every key is printed as written.
key = valuewith one space around=; one pair per line.- Table headers without spaces inside the brackets:
[owner],[servers.alpha],[[products]]; dotted keys without spaces around the dots. - An array on one line when it fits, otherwise one item per line, with a
trailing comma when
shared.trailing_comma = "multiline"(the default"never"writes none); an array with a comment inside always breaks. - An inline table as
{ a = 1, b = 2 }(TOML allows no line break inside one; a long one stays long). - Comments stay where they are: after the value or header on their line
(one space before them; two or more consecutive pairs or items whose
comments start in the same column keep that column, so aligned comments
stay aligned), or on a line of their own. A comment on its own line belongs to the
pair or table below it; blank lines between the two (a file header) are
kept, at most
core.max_blank_lines. A comment between=and the value keeps the pair as written. - Blank lines between pairs and before tables are kept, at most
core.max_blank_lines(default 1); none are added.
Inline directives (# rainbow: off … # rainbow: on, # rainbow:
skip-next) keep pairs and tables as written
(configuration.md).
Options¶
The pack declares no options of its own; shared.trailing_comma and
core.max_blank_lines apply, and the core options for width and
indentation (arrays are indented by core.indent_size).