Learn the YINI Config Format

A clear, 10–15 minute step-by-step guide to the YINI configuration format — covering syntax, structure, and practical features.

Prefer examples? See real YINI configs.

1. Sections

Sections group related configuration settings under a named header. A section starts with a section marker such as ^.

^ App
title = "AppName"

If ^ causes issues in a specific environment, § may be used as a Unicode-based alternative.

See section 9 for more advanced marker and naming options.


2. Keys and Values

Each configuration setting is written as a key-value pair, separated by =:

maxConnections = 100
enableLogging  = true

Use backticks for section or key names that contain spaces, punctuation, or special characters:

user id = 1      # ❌ Invalid
`user id` = 1    # ✅ Valid

See section 9 for more advanced marker and naming options.


3. Values

Values define the actual configuration data and support several common data types.

Values can be:

  • Strings (always quoted): 'hello' or "world". (Either single or double quotes.)

    file = "C:\Users\john"  // Backslashes work without escaping

    👉 Strings are raw by default — no escape sequences are interpreted.
    Backslashes (\), slashes (/), and even \n are treated as normal text.

    👉 If you need escape sequences (such as \n for newline), use a C-string by prefixing the string with C or c:

    path = "E:\logs\app.log"      // Raw string (recommended for paths)
    
    message = C"Server started\nReady."

    C-strings interpret common escape sequences like \n, \t, and \\.

    For multi-line text, use triple-quoted strings:

    description = """
    This is a longer text.
    It can span multiple lines.
    """

    Triple-quoted strings are raw by default. Use C"""...""" only when a multi-line string needs escape sequences.

  • Numbers: 42, 3.14, -10 or 10_000_000

    Underscores may be used as visual separators in numbers.
    10_000_000 has the same value as 10000000.

  • Booleans: true, false, on, off, yes, no (all case-insensitive)

  • Nulls: Use null or leave the value blank after = (in lenient mode)

  • Lists: ["red", "green", "blue"] (JSON‑style)

  • Inline objects: { host: "localhost", port: 5432 }


4. Comments

Comments help document configuration files and are ignored by the parser.

Various commenting styles are supported:

// This is a line comment
timeout = 30  // inline comment

#This is also a line comment
interval = 30  #inline comment

/* Block comment spanning
   multiple lines */

; Full line comment (must be whole line).

Tip: //, #, and block comments can be used inline or around settings. ; is only for full-line comments.

👆 Caveat 1: In RC 6, # always starts a comment outside string literals. No whitespace is required after #, and #336699 is a comment, not a hex number.

👆 Caveat 2: ; is only a full-line comment marker. It must be the first non-whitespace character on the line.

💡Tip: You can use any comment style in your file. For best readability, try to stick to one style per file.


5. Nested Sections

Nested sections allow hierarchical configuration structures.

Use extra carets ^ for sub‑sections:

^ Parent
^^ Child

// Add another caret `^` and you get a sub-section
// of the previous section, and so...
^^^ SubChild

Repeated markers are supported up to level 9; for deeper levels, use numeric shorthand such as ^10 VeryDeep.

If you prefer, you can indent the nested section for visibility:

^ Main
    ^^ Sub
    host = "db.example.com"

You can nest sections to multiple levels:

^ Root
^^ Sub
^^^ SubSub
^ BackToRoot

Example with indented sections:

^ Root
value = 'At level 1'
    ^^ Sub
    value = 'At level 2'
        ^^^ SubSub
        value = 'At level 3'

^ BackToRoot
value = 'Back at level 1'

The above YINI code produces the following JavaScript object:

// JS object
{
  Root: {
    value: 'At level 1',
    Sub: { value: 'At level 2', SubSub: { value: 'At level 3' } }
  },
  BackToRoot: { value: 'Back at level 1' }
}

See section 9 for more advanced marker and naming options.


6. Lists

Lists let you store multiple values under a single key.

In YINI, lists are written using = and square brackets [ ... ].

// JSON‑style lists
colors = ["red", "green", "blue"]

numberList = [
    10,
    20,
    30
]

Lists can contain different supported value types, such as strings, numbers, booleans, null, inline objects, and even other lists.

mixed = [
    "Pear",
    42,
    true,
    null,
    { name: "Cherry", color: "red" },
    ["nested", "list"]
]

You can use either single or double quotes for string values in YINI.


7. Document Terminator (strict mode)

The document terminator explicitly marks the end of a configuration file.

The /END marker is optional in lenient mode (the default) and required in strict mode.

End a file explicitly with:

^ App
title = "MyTitle"

/END    // Required in strict mode; optional in lenient mode.

8. Disabled Lines

Disabled lines allow temporarily turning off configuration entries.

Prefix any valid line with -- to skip it entirely:

--maxRetries = 5

9. Advanced: Alternative Section Markers & Naming

Advanced syntax options provide additional flexibility for section markers and naming.

In addition to the standard syntax, YINI supports several advanced options:

  • (a.) Alternative section marker:
    The recommended section marker is ^. If ^ causes problems in a specific environment, § may be used as a Unicode alternative.

    ^ App
    § Settings

    For most files, prefer ^.

    Other marker forms exist for compatibility or special cases, but they are not recommended for normal YINI files.

  • (b.) Backticked section names and key names:
    Use backticks (`) to allow spaces or special characters in section or key names:

    ^ `Section name with spaces`
    `user id` = 42
  • (c.) Numeric shorthand section markers:
    Repeated section markers are supported up to level 9. For deeper nesting, use numeric shorthand:

    ^^^^^^^^^ DeepSection  # Level 9, maximum repeated-marker form.
    ^10 VeryDeep           # Level 10, use numeric shorthand.

    Numeric shorthand requires a space after the number: ^10 VeryDeep, not ^10VeryDeep.

  • (d.) More features:
    The YINI format supports even more features than listed here, such as additional number notations, string types, and advanced escaping. For full details, see the YINI Specification.


10. Complete Example

This example combines the most common YINI features in a single configuration file.

@yini       # Optional marker to identify YINI format.

^ App
name    = "MyApp"
version = "1.0.0"
debug   = off  // Turn on for debugging.

^^ Database
host     = "db.local"
port     = 5432
--user   = "secret"  # This line is disabled due to --.
userList = ["alice", "bob", "carol"]

This example uses lenient mode (the default), so /END is not required.


Next Steps