Skip to content

Limitations

To keep source code valid, typstyle will give up formatting in certain cases. This is a list of what typstyle will not format.

Overall

Markup lines

Typstyle only formats the code, it does not format the markup lines. It will keep the markup lines as is. Specifically, if a line contains text(ast::Expr::Text), the whole line will be kept as is.

Math mode

Overall there is very few formatting in math mode. It is not well implemented.

@typstype off

Why: It is a directive to turn off formatting.

When there are block comment child, gives up formatting the whole node.

Why: We currently cannot handle block comment in all places. It is hard to handle.

1
2
3
4
5
#let f(a, /* they */ b) = if /* are */ a > b {
  a
} /* everywhere */ else {
  b
}

Multiline raw with single backtick.

Why: it is white space dependent

1
2
3
4
5
`a
  b`
is not
`a
    b`

When a child contains # in math mode, gives up formatting the whole node.

Why: hash can appear anywhere, we cannot handle it very well.

1
$f(a+b, size: #1em)$

Args in math mode.

Why: it works very different. like 2d args, trailing commas

1
$mat(a,,;,b,;,,c)$

Special

Table

Typstyle currently tries to format tables into a rectangular shape. However, it only do such formatting when the table is simple enough. Namely:

  1. no comments
  2. no spread args
  3. no named args, or named args appears before all pos args
  4. no table/grid.vline/hline/cell
  5. columns is int or array