Indentation Examples
YINI is not indentation-sensitive. Indentation can make a file easier
to scan, but the structure is defined by explicit section markers
such as ^, ^^, and ^^^.
The examples below show the same kind of nested structure formatted
in different readable styles. Pick one style per file and keep it
consistent.
New to the core syntax?
Start with the basic examples
or the format guide.
Indentation styles
// Indentation example 1 of Basic App Config - indent-ex-conf1.yini
/*
* Indentation is optional - section markers (^, ^^, ^^^)
* define the section nesting.
*
* Style 1: indent the entire nested section, including the section header.
*/
^ App
name = "My Application"
version = "1.0.0"
debug = off // Disable debugging
^^ Database // Nested section of App
host = "localhost"
port = 5432
user = "admin"
password = "secret"
^^^ Pool // Nested section of Database
min = 2
max = 10
idleTimeout = 300
^^ Logging // Another section of App
level = "info"
logToFile = true
filePath = "./logs/app.log"
// Indentation example 2 of Basic App Config - indent-ex-conf2.yini
/*
* Indentation is optional - section markers (^, ^^, ^^^)
* define the section nesting.
*
* Style 2: indent only the section body, not the section header.
*/
^ App
name = "My Application"
version = "1.0.0"
debug = off // Disable debugging
^^ Database // Nested section of App
host = "localhost"
port = 5432
user = "admin"
password = "secret"
^^^ Pool // Nested section of Database
min = 2
max = 10
idleTimeout = 300
^^ Logging // Another section of App
level = "info"
logToFile = true
filePath = "./logs/app.log"
// Indentation example 3 of Basic App Config - indent-ex-conf3.yini
/*
* Indentation is optional - section markers (^, ^^, ^^^)
* define the section nesting.
*
* Style 3: no indentation for nested sections.
*/
^ App
name = "My Application"
version = "1.0.0"
debug = off // Disable debugging
^^ Database // Nested section of App
host = "localhost"
port = 5432
user = "admin"
password = "secret"
^^^ Pool // Nested section of Database
min = 2
max = 10
idleTimeout = 300
^^ Logging // Another section of App
level = "info"
logToFile = true
filePath = "./logs/app.log"