Tiramisu Docs

Tooling

Format

Auto-format .tiramisu files for consistent whitespace, indentation, and parameter spacing with the CLI.

The tiramisu format command auto-formats .tiramisu files for consistent style. It normalises whitespace, indentation, and parameter spacing.

Usage

bash
tiramisu format [options] [files...]

Options

FlagDefaultDescription
--checkCheck if files are formatted without modifying them. Exits with code 1 if any file needs formatting.
--indent <n>2Number of spaces per indentation level.
--line-width <n>80Maximum line width before breaking function calls into multi-line format.

Format Files In-Place

Pass one or more file paths to format them in-place:

bash
tiramisu format src/docs/**/*.tiramisu

Files that are already correctly formatted are skipped (no unnecessary writes).

Stdin / Stdout

When no files are given and input is piped, the formatter reads from stdin and writes to stdout:

bash
echo 'bold{hello}' | tiramisu format
# Output: bold { hello }

This is useful for editor integrations and scripting.

Check Mode

Use --check in CI to verify formatting without modifying files:

bash
tiramisu format --check src/docs/**/*.tiramisu

If any files need formatting, the command lists them and exits with code 1.

What It Does

The formatter applies the following rules:

  • Trailing whitespace — removed from all lines.
  • Trailing newline — ensures a single trailing newline.
  • Paragraph spacing — collapses 3+ blank lines to 2.
  • Inline functions — normalises brace spacing: bold{hello}bold { hello }.
  • Multi-line functions — breaks long function calls across lines when they exceed the line width.
  • Parameters — normalises spacing around =: level=1level = 1.
  • Arrays — formats inline or multi-line based on line width.
  • String quoting — uses the shortest valid quoting style.

Examples

Before formatting:

tiramisu
callout{type=warning,Don't forget to install the peer dependencies.}

h2{Quick  Start}

list{First item,Second item,Third item}

After running tiramisu format:

tiramisu
callout { type = warning, Don't forget to install the peer dependencies. }

h2 { Quick Start }

list {
  First item,
  Second item,
  Third item
}

The formatter is idempotent — running it multiple times produces identical output.