Typstyle Docs

CLI Usage

Usage: typstyle [OPTIONS] [INPUT]...

Arguments:
  [INPUT]...  List of files or directories to format [default: stdin]

Options:
  -i, --inplace  Format the file in place
      --check    Run in 'check' mode. Exits with 0 if input is formatted correctly. Exits with a non-zero status code if formatting is required
      --diff     Run in 'diff' mode. Shows unified diff of what formatting changes would be made. Exits with 0 if input is formatted correctly. Exits with a non-zero status code if formatting is required
  -h, --help     Print help
  -V, --version  Print version

Format Configuration:
  -l, --line-width <LINE_WIDTH>      Maximum width of each line [default: 80] [aliases: -c, --column]
  -t, --indent-width <INDENT_WIDTH>  Number of spaces per indentation level [default: 2] [aliases: --tab-width]
      --no-reorder-import-items      Disable alphabetical reordering of import items
      --wrap-text                    Wrap text in markup to fit within the line width. Implies `--collapse-spaces`

Debug Options:
  -a, --ast         Print the AST of the input file
  -p, --pretty-doc  Print the pretty document
      --timing      Show elapsed time taken by the formatter

Log Levels:
  -v, --verbose  Enable verbose logging
  -q, --quiet    Print diagnostics, but nothing else
Usage: typstyle [OPTIONS] [INPUT]...

Arguments:
  [INPUT]...  List of files or directories to format [default: stdin]

Options:
  -i, --inplace  Format the file in place
      --check    Run in 'check' mode. Exits with 0 if input is formatted correctly. Exits with a non-zero status code if formatting is required
      --diff     Run in 'diff' mode. Shows unified diff of what formatting changes would be made. Exits with 0 if input is formatted correctly. Exits with a non-zero status code if formatting is required
  -h, --help     Print help
  -V, --version  Print version

Format Configuration:
  -l, --line-width <LINE_WIDTH>      Maximum width of each line [default: 80] [aliases: -c, --column]
  -t, --indent-width <INDENT_WIDTH>  Number of spaces per indentation level [default: 2] [aliases: --tab-width]
      --no-reorder-import-items      Disable alphabetical reordering of import items
      --wrap-text                    Wrap text in markup to fit within the line width. Implies `--collapse-spaces`

Debug Options:
  -a, --ast         Print the AST of the input file
  -p, --pretty-doc  Print the pretty document
      --timing      Show elapsed time taken by the formatter

Log Levels:
  -v, --verbose  Enable verbose logging
  -q, --quiet    Print diagnostics, but nothing else

Basic Usage

# Format multiple files
typstyle -i chapter1.typ chapter2.typ appendix.typ

# Format entire project
typstyle -i .

# Format with specific configuration
typstyle -l 100 -t 4 --wrap-text -i src/
# Format multiple files
typstyle -i chapter1.typ chapter2.typ appendix.typ

# Format entire project
typstyle -i .

# Format with specific configuration
typstyle -l 100 -t 4 --wrap-text -i src/

Arguments

Input Files

# Format from stdin (default)
cat file.typ | typstyle

# Format specific files
typstyle file1.typ file2.typ

# Format directories (recursively)
typstyle src/ docs/
# Format from stdin (default)
cat file.typ | typstyle

# Format specific files
typstyle file1.typ file2.typ

# Format directories (recursively)
typstyle src/ docs/

Main Options

Format Control

In-Place Formatting

# Modify files directly
typstyle -i file.typ
typstyle --inplace file.typ
# Modify files directly
typstyle -i file.typ
typstyle --inplace file.typ

Check Mode

# Exit with non-zero if formatting needed
typstyle --check src/
# Exit with non-zero if formatting needed
typstyle --check src/
# Like --check, but shows unified diff of what formatting changes would be made
typstyle --diff src/
# Like --check, but shows unified diff of what formatting changes would be made
typstyle --diff src/

Format Configuration

Line Width

# Set maximum line width (default: 80)
typstyle -l 100 file.typ
typstyle --line-width 100 file.typ
# Set maximum line width (default: 80)
typstyle -l 100 file.typ
typstyle --line-width 100 file.typ

Indentation

# Set indentation width (default: 2)
typstyle -t 4 file.typ
typstyle --indent-width 4 file.typ
# Set indentation width (default: 2)
typstyle -t 4 file.typ
typstyle --indent-width 4 file.typ

Text Wrapping

# Wrap text in markup to fit line width
typstyle --wrap-text file.typ
# Wrap text in markup to fit line width
typstyle --wrap-text file.typ

Debug Options

AST Output

# Print the Abstract Syntax Tree
typstyle -a file.typ
typstyle --ast file.typ
# Print the Abstract Syntax Tree
typstyle -a file.typ
typstyle --ast file.typ

Pretty Document Output

# Print the internal pretty document representation
typstyle -p file.typ
typstyle --pretty-doc file.typ
# Print the internal pretty document representation
typstyle -p file.typ
typstyle --pretty-doc file.typ

Timing Information

# Show elapsed time taken by the formatter
typstyle --timing file.typ
# Show elapsed time taken by the formatter
typstyle --timing file.typ

Logging Options

See CLI help.