1. Introduction
  2. User Guide
  3. 1. Installation
  4. 2. Quick Start
  5. 3. Changelog
  6. Usage
  7. 4. Command Line Interface
  8. 5. Editor Integration
  9. Features
  10. 6. Formatting Features
    1. 6.1. Markup
    2. 6.2. Code
    3. 6.3. Math Equations
    4. 6.4. Tables
  11. 7. Escape Hatch
  12. 8. Limitations
  13. Advanced
  14. 9. How It Works
  15. 10. Developer Guide
    1. 10.1. Core
    2. 10.2. Documentation
    3. 10.3. Playground

typstyle

#

Markup Formatting

#

Lists and Enumerations

#

List Indentation

List indentation is automatically corrected and standardized:

Example
Before
 -   Fruit
      - Apple
  -     Banana
- Vegetable
      -    Carrot
      - Tomato
After
- Fruit
  - Apple
  - Banana
- Vegetable
  - Carrot
  - Tomato

#

Lists in Content Blocks

Lists within content blocks are properly formatted with surrounding linebreaks:

Example
Before
#{
  [- single]
  [- indented
  - less
  ]
  [- indented
   - same
  - then less
   - then same
  ]
  [- indented
    - more
   - then same
  - then less
  ]
}
After
#{
  [- single]
  [
    - indented
    - less
  ]
  [
    - indented
    - same
    - then less
      - then same
  ]
  [
    - indented
      - more
    - then same
    - then less
  ]
}

#

Text Wrapping

When text wrapping is enabled with --wrap-text, typstyle intelligently wraps long lines while preserving important formatting and semantic structure:

Example wrap_text: true, max_width: 30
Before
Let's say you have a long text that needs to be wrapped in the markup. This is a very long sentence.
After
Let's say you have a long text
that needs to be wrapped in
the markup. This is a very
long sentence.

#

Wrapping Rules

typstyle applies specific wrapping logic based on node types:

  • Cannot break before: Markup markers (=, +, -, /) and labels to prevent misinterpretation
  • Force hard breaks: Around block equations to keep them on exclusive lines
  • Preserve breaks after: Block elements, line comments, and structural nodes (code blocks, conditionals, loops)
  • Exclusive lines: Single non-text nodes or hash-prefixed expressions (e.g., #figure())
  • Soft breaks: Regular spaces become flexible break points unless restricted by above rules
Example wrap_text: true, max_width: 30
Before
Some pieces should be exclusion except $"inline equation"$ and `raw`:
- This is a list
$ "block equation" $
#figure([Figures])
#figure([Labeled figures]) <label>
That's all! Wait, a linebreak \
should be \ kept at the end
\ of the line. \
But \ / never \ = break \ + before \ - markers
#[Never \ / Give \ = You \ + Up \
]
#([Man!\ ], [\ What\ can\ I\ say\ ?])

#let fig = (..) => []
#fig("image1")[Caption] <label1>
#fig("image2")[Caption] <label2>

This is a code block: #{
  // code block!
}
I don't want to eat the linebreak.
A blocky node should not stick #[

]
the content after it.
Not #if true { }
Not #while false { }
Not #for i in range(5) {}
Not #context 1
And block equations: $ eq $
And
also ``` block
  raw ```
but not ``` non-block raw ```
End
...
After
Some pieces should be
exclusion except
$"inline equation"$ and `raw`:
- This is a list
$ "block equation" $
#figure([Figures])
#figure([Labeled
  figures]) <label>
That's all! Wait, a linebreak
\
should be \ kept at the end \
of the line. \
But \ / never \ = break \ +
before \ - markers
#[Never \ / Give \ = You \ +
  Up \
]
#(
  [Man!\ ],
  [\ What\ can\ I\ say\ ?],
)

#let fig = (..) => []
#fig(
  "image1",
)[Caption] <label1>
#fig(
  "image2",
)[Caption] <label2>

This is a code block: #{
  // code block!
}
I don't want to eat the
linebreak. A blocky node
should not stick #[

]
the content after it. Not
#if true {}
Not #while false {}
Not #for i in range(5) {}
Not #context 1
And block equations:
$ eq $
And also ``` block
raw ```
but not ``` non-block raw ```
End
...

#

Multilingual Text Support

typstyle measures Unicode width and will not break between words if no space exists in the original text.

Example wrap_text: true, max_width: 40
Before
这是一个中文段落,包含链接 https://typst.app/ 和*强调文本*。
続いて`コード要素`と https://docs.typst.app/ を含む日本語の段落です。

Mixed CJK and Latin: Visit 访问 https://example.com/文档 for documentation.
한글과 URL: https://한글.kr/ contains Korean text mixed with $alpha + beta$.

Multiple scripts: أهلاً بك في *타이프스트* เอกสาร with `inline code`.
After
这是一个中文段落,包含链接
https://typst.app/ 和*强调文本*。
続いて`コード要素`と
https://docs.typst.app/
を含む日本語の段落です。

Mixed CJK and Latin: Visit 访问
https://example.com/文档 for
documentation. 한글과 URL:
https://한글.kr/ contains Korean text
mixed with $alpha + beta$.

Multiple scripts: أهلاً بك في *타이프스트*
เอกสาร with `inline code`.