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

#

Introduction

latest packaged version(s)

typstyle is a beautiful and reliable code formatter for Typst.

Typstyle automatically formats your Typst source code to ensure consistency and readability. It's fast, opinionated, and preserves the semantic meaning of your code while improving its appearance.

#

Key Features

  • Fast: Formats large documents (1000+ lines) under 5ms, or a document with 300 huge equations in 15ms.
  • Reliable: Preserves semantic meaning while improving code appearance.
  • Opinionated: Consistent style with minimal configuration.
  • Convergent: Multiple runs produce identical results.

#

Try It Online

Try typstyle in your browser: playground

The playground integrates the latest version of typstyle. If you encounter formatting issues, please verify them in the playground first before reporting bugs.

#

How It Works

Typstyle parses your code into an Abstract Syntax Tree (AST), applies formatting rules based on Philip Wadler's pretty printing algorithms, and outputs clean, consistently formatted code.