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 (see a summary with '-h') -V, --version Print versionFormat 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] [alias: --tab-width] --line-ending <LINE_ENDING> Line-ending policy for formatted source output Possible values: - lf: Generate LF breaks, preserving literal source text - crlf: Generate CRLF breaks, preserving literal source text - preserve: Generate CRLF only when the input contains CRLF and no bare LF or CR [default: preserve] --no-reorder-import-items Disable alphabetical reordering of import items --wrap-text[=<WRAP_TEXT>] Text wrapping mode: none (default), fill (wrap to line width), sentence (one per line), or fill-sentence (both) Possible values: - none: Do not wrap text (default) - fill: Wrap text to fit within line width - sentence: Place each sentence on its own line - fill-sentence: Place each sentence on its own line, wrapping long sentences to the line width [default: none]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 formatterLog 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 (see a summary with '-h') -V, --version Print versionFormat 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] [alias: --tab-width] --line-ending <LINE_ENDING> Line-ending policy for formatted source output Possible values: - lf: Generate LF breaks, preserving literal source text - crlf: Generate CRLF breaks, preserving literal source text - preserve: Generate CRLF only when the input contains CRLF and no bare LF or CR [default: preserve] --no-reorder-import-items Disable alphabetical reordering of import items --wrap-text[=<WRAP_TEXT>] Text wrapping mode: none (default), fill (wrap to line width), sentence (one per line), or fill-sentence (both) Possible values: - none: Do not wrap text (default) - fill: Wrap text to fit within line width - sentence: Place each sentence on its own line - fill-sentence: Place each sentence on its own line, wrapping long sentences to the line width [default: none]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 formatterLog Levels: -v, --verbose Enable verbose logging -q, --quiet Print diagnostics, but nothing else
# Format multiple filestypstyle -i chapter1.typ chapter2.typ appendix.typ# Format entire projecttypstyle -i .# Format with specific configurationtypstyle -l 100 -t 4 --wrap-text -i src/
# Format multiple filestypstyle -i chapter1.typ chapter2.typ appendix.typ# Format entire projecttypstyle -i .# Format with specific configurationtypstyle -l 100 -t 4 --wrap-text -i src/
# Format from stdin (default)cat file.typ | typstyle# Format specific filestypstyle file1.typ file2.typ# Format directories (recursively)typstyle src/ docs/
# Format from stdin (default)cat file.typ | typstyle# Format specific filestypstyle file1.typ file2.typ# Format directories (recursively)typstyle src/ docs/
# Modify files directlytypstyle -i file.typtypstyle --inplace file.typ
# Modify files directlytypstyle -i file.typtypstyle --inplace file.typ
# Exit with non-zero if formatting neededtypstyle --check src/
# Exit with non-zero if formatting neededtypstyle --check src/
# Like --check, but shows unified diff of what formatting changes would be madetypstyle --diff src/
# Like --check, but shows unified diff of what formatting changes would be madetypstyle --diff src/
The default preservepreserve policy retains consistent LF or CRLF conventions. Use lflf or crlfcrlf to force generated breaks:
# Force LF, including when checking in CItypstyle --line-ending=lf file.typ# Force CRLFtypstyle --line-ending=crlf --inplace file.typ# Preserve the existing convention (the default)typstyle --line-ending=preserve --inplace file.typ
# Force LF, including when checking in CItypstyle --line-ending=lf file.typ# Force CRLFtypstyle --line-ending=crlf --inplace file.typ# Preserve the existing convention (the default)typstyle --line-ending=preserve --inplace file.typ
preservepreserve generates CRLF only when the input contains at least one CRLF and no bare LF or bare CR. Mixed endings, bare CR, and inputs without newlines fall back to LF. Detection uses the whole original document, including for range formatting. All policies select generated layout breaks; newlines in strings, verbatim raw spans, and format-disabled source remain verbatim. Raw-block boundary breaks follow the layout policy. Diff control lines retain their normal LF output. The default --check--check accepts formatted CRLF files; use --line-ending=lf--line-ending=lf to enforce LF.
# Set maximum line width (default: 80)typstyle -l 100 file.typtypstyle --line-width 100 file.typ
# Set maximum line width (default: 80)typstyle -l 100 file.typtypstyle --line-width 100 file.typ
# Set indentation width (default: 2)typstyle -t 4 file.typtypstyle --indent-width 4 file.typ
# Set indentation width (default: 2)typstyle -t 4 file.typtypstyle --indent-width 4 file.typ
# Wrap text in markup to fit line width (`--wrap-text` is shorthand)typstyle --wrap-text file.typtypstyle --wrap-text=fill file.typ# Place each sentence on its own linetypstyle --wrap-text=sentence file.typ# Place each sentence on its own line, and wrap long sentences to the line widthtypstyle --wrap-text=fill-sentence file.typ
# Wrap text in markup to fit line width (`--wrap-text` is shorthand)typstyle --wrap-text file.typtypstyle --wrap-text=fill file.typ# Place each sentence on its own linetypstyle --wrap-text=sentence file.typ# Place each sentence on its own line, and wrap long sentences to the line widthtypstyle --wrap-text=fill-sentence file.typ
# Print the Abstract Syntax Treetypstyle -a file.typtypstyle --ast file.typ
# Print the Abstract Syntax Treetypstyle -a file.typtypstyle --ast file.typ
# Print the internal pretty document representationtypstyle -p file.typtypstyle --pretty-doc file.typ
# Print the internal pretty document representationtypstyle -p file.typtypstyle --pretty-doc file.typ
# Show elapsed time taken by the formattertypstyle --timing file.typ
# Show elapsed time taken by the formattertypstyle --timing file.typ
See CLI help.