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
tiramisu format [options] [files...] Options
| Flag | Default | Description |
|---|---|---|
--check | — | Check if files are formatted without modifying them. Exits with code 1 if any file needs formatting. |
--indent <n> | 2 | Number of spaces per indentation level. |
--line-width <n> | 80 | Maximum 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:
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:
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:
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=1→level = 1. - Arrays — formats inline or multi-line based on line width.
- String quoting — uses the shortest valid quoting style.
Examples
Before formatting:
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:
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.