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.

Group settings under a named header. A section header name starts with ^.

Start a section with ^, e.g.:

^ App
title = "AppName"

Alternative section markers to ^ are also supported if ^ is unavailable: <, §, (e.g. < Section).

See section 9 for more advanced marker and naming options.


2. Keys and Values

Each configuration setting is written as a key and value pair.

Each line inside a section is a key (name) and value, separated by =.

Write settings as key = value:

maxConnections = 100
enableLogging  = true

See section 9 for more advanced marker and naming options.

💡Tip

Use backticks (`) to quote section or key names that contain spaces or special characters.

Key names with spaces/special characters can be backticked:

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

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 \\.

  • Numbers: 42, 3.14 or -10

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

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

  • Lists:

    • JSON‑style: ["red", "green", "blue"]
    • Colon‑style: (Planned – not yet implemented in parser)

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 (must have a space after #)
interval = 30  # inline comment (must have a space after #)

/* Block comment spanning
   multiple lines */

; Full line comment (must be whole line).

Tip: You can add comments anywhere—above, beside, or below any setting or section.

👆 Caveat 1: If you use # for comments, always put a space after the #. (Otherwise, the parser might misinterpret it as part of a value.)

👆 Caveat 2: ; is used only for full-line comments. The ; must be the first non-whitespace character on a line (only spaces or tabs are allowed before it). (If ; appears later in the line, the parser may treat it as part of a value or as a line delimiter, not as a comment.)

💡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

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

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

One can nest multiple sections:

^ 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 will produce 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 store multiple values in a single configuration field.

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

numberList = [
    10,
    20,
    30
]


// Colon‑style list
// 👆 Colon‑style list support is planned for an upcoming release.
fruits:
  "Pear",
  "Cherry",
  "Banana"

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


7. Document Terminator (strict mode)

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

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

End a file explicitly with:

^ App
title = "MyTitle"

/END    // Is only optional.

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 markers:
    Besides ^, you can use <, §, or as section header markers.

    < MySection
    § Settings
    € MyApp
  • (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:
    To create deeply nested sections (beyond 6 levels), use numeric shorthand:

    ^7 DeepSection    # Equivalent to 7 carets: ^^^^^^^ DeepSection
    <10 VeryDeep      # Equivalent to <<<<<<<<<<< VeryDeep

    👆 Though, can not mix standard/classic and numeric shorthand markers in the same section header.

  • (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"]

/END // (optional)

Next Steps