Releases: typstyle-rs/typstyle
v0.14.0
v0.13.19
- Bug fix: Previously, empty headings with attachments like
= <label>or= //will be formatted as= <label>or= //(an extra space is inserted), which does not converge. Now it is fixed.
v0.13.18
- Bug fix: Previously,
@typstyle offis not correctly recognized for{table,grid}.{header,footer}. Now it is fixed. - Revert: The body of strong/emph is no longer indented.
Playground
- Feature: Added some loadable sample documents.
- Feature: The active output tab is now persisted in the URL.
v0.13.17
Core
-
Feature: Improved flavor detection for list-like syntaxes.
Previously, flavor detection checked only whether the first space contained a line break, leading to unexpected multiline layout when child expressions contained line breaks or spaces. Now, a list-like syntax is considered multiline only if there is a space containing a line break before its first child expression.
For example, this code was previously treated as multiline due to the line break before), but now uses the compact layout:#f(it => it )
-
Feature: Aligned equation flavor detection with other nodes.
For example,$ a $
was previously regarded as multiline due to the break before the closing
$. Now it formats as$ a $
enabling inline block switching by adjusting the space after the opening
$. -
Feature: Raw blocks are combinable now.
-
Feature: Compact layout for markup.
For a content block, strong, or emph node, if its opening boundary is non-breakable, contains no breaks, and has exactly one primary expression (excluding labels, break symbols, and plain text), it is rendered without indentation. -
Feature: Indent the body of strong or emph expressions when not using the compact layout.
-
Fix: Corrected misplaced standalone comments in method chains.
In this example,#( foo // comment .bar() )
it previously formatted as
#( foo // comment .bar() )
Now the comment correctly stays on its own line.
-
Fix: Prevent reflow of text segments that can be parsed as enum item markers.
text 01.
Previously formatted as
text 01.
which created an unintended enum item. Now it remains on one line.
-
Fix: Do not insert an extra break at a nil boundary for headings. Now the code
#[= h1]will not be formatted as
#[ = h1 ]
in any case.
Playground
- Feature: Use system color preference as the default theme.
- Feature: Persist the current state (code and options) in the URL for easy sharing.
- Feature: Store source code in local storage; if absent from the URL, the stored code is used as a fallback.
- Feature: Enable in-place formatting (full document or selection) in the source editor.
- Feature: Added a loading spinner and error boundary.
- Feature: Toggle word wrap in the source editor.
- Feature: Option to display only the formatted selection’s output.
- Feature: Reduced indentation size in the output AST/IR from 4 spaces to 2.
Documentation
- Feature: Switched documentation theme from mdBook to Starlight.
- Feature: Added “copy code” support.
Miscellaneous
- Moved the benchmark-results repository to the
typstyle-rsorganization.
v0.13.16
- Due to ci configuration issues, we failed to publish v0.13.15. This release is a re-publish of v0.13.15 with the correct version number.
v0.13.15 - [2025-07-18]
-
Feature(CLI): Add
--diffoption to show unified diff of formatting changes. This allows users to preview what changes would be made before applying formatting.For example:
typstyle file.typ --diff
Output:
--- file.typ +++ file.typ @@ -1,3 +1,3 @@ -#let x=1+2 -#let y=(3*4) +#let x = 1 + 2 +#let y = (3 * 4)
-
Feature: Improve comment handling - line comments are now treated as line suffixes instead of separate lines, resulting in more compact and natural formatting.
For example, The following code will be accepted by typstyle now:
#let result = (x + y) / 2 + 1 // This comment stays on same line
But it will be formatted to this in previous versions. Note that the comment was moved to a new line, which is not ideal for inline comments.
// line width = 40 #let result = ( (x + y) / 2 + 1 ) // This comment stays on same line
-
Feature: Add support for sharing links in the web playground, making it easier to share formatted code snippets with others for demo or collaboration.
-
Performance: Bump prettyless to v0.3.0. This slightly improves performance and lowers memory consumption during formatting.
v0.13.14
We now employ prettyless as the layout engine. It provides more features to support us to adopt better layout logic.
-
Feature: Long lines after the first line will no longer cause compact layout to fail to fit.
For example:#figure(caption: [], { "looooooooooooooooooooooooooong" })
It now fits in the compact layout regardless of the length of any long line in the code block.
-
Feature: We now respect the flavor of arguments in any case, except that the sole argument is a code block, which is always folded. This reverts the behavior of "force folding" when the sole argument is combinable, so that users can freely decide whether the argument should be compact. This change is expected not to affect your code if it is already compact.
For example:#f( (1, 2, 3) )
was formatted to
#f((1, 2, 3))
Now it is kept unchanged given its multiline flavor.
-
Bug fix: In code mode,
std.tablewas not recognized as a table function, preventing proper table formatting. -
Bug fix: Fixed incorrect formatting of table functions with empty content blocks.
Whentable.headerortable.footerhad no parentheses (()), the formatter would incorrectly add parentheses before empty content blocks. When parenthesized args are empty, the formatter would insert a line break with short line length.
For example:#table( columns: 2, table.header[], table.footer(), )
was formatted to:
#table( columns: 2, table.header()[], table.footer(), )
or with short line length:
#table( columns: 2, table.header( )[], table.footer( ), )
-
Bug fix: Fixed incorrect handling of trailing content blocks in set rules.
Previously, when there were no parentheses, a following content block would be wrapped by(); when parentheses were already present, any trailing content block was dropped.
For example:#set circle[1] #set circle()[1] #set circle(stroke: blue)[1]
was previously formatted to:
#set circle([1]) #set circle() #set circle(stroke: blue)
v0.13.13
- Bug fix(CI): Fixed a CI misconfiguration that prevented the release of v0.13.12.
v0.13.12 - [2025-07-02]
🎉 typstyle has moved to https://github.com/typstyle-rs/typstyle !
-
Bug fix(#334): Fixed incorrect formatting when term description is empty in definition lists.
-
Feature: Improved argument layout logic - do not use compact layout when arguments have multiline flavor, providing better formatting for complex function calls.
-
Feature: Enhanced math formatting - no longer align backslashes in mathematical expressions for cleaner output.
-
Feature: Introduced
typstyle-typlugincrate for embedding typstyle as a WebAssembly plugin within Typst documents.
v0.13.11
-
Feature(CLI): (breaking) Removed deprecated
format-allcommand from CLI. This command was previously deprecated and has now been completely removed. Users should usetypstyle <dir> -iinstead. -
Feature(CLI): Added
--timingoption to CLI for displaying elapsed time during formatting operations. Users can now monitor the performance of formatting operations with this new debug flag. -
Feature: Empty code blocks no longer get extra spaces added.
For example,#{}will now be formatted as#{}instead of#{ }. This aligns with the behavior of most code formatters. -
Enhancement: Labels are no longer reflowed to the next line with text wrapping enabled.
-
Bug fix: Texts spanning multiple lines, such as strings, inline raws, or syntax nodes marked
typstyle offare correctly layouted according to their line widths. -
Bug fix: When the last arg of func call is not combinable, the flavor is respect.
v0.13.10
-
Bug fix: Fixed unexpected semicolon to comma conversion in nested math arguments. Previously, typstyle would incorrectly convert semicolons to commas in complex nested mathematical expressions like
$mat(mat(1; 2); mat(3; 4))$. -
Refactor: Extracted WASM features into a separate
typstyle-wasmcrate. This improves the modular architecture by separating WebAssembly-specific functionality from the core library. -
API Enhancement: Added rendering IR functionality to the formatter. The
Formatternow provides arender_ir()method that allows developers to inspect the pretty-printing intermediate representation, which can be useful for debugging and understanding the formatting process.
v0.13.9
-
Feature: typstyle now evaluates simple constant expressions for table columns. This enhancement allows for better column count calculation in tables. For example, if you have a table with a column count defined as
((1fr,) * 2 + 2 * (auto,)) * 3, typstyle will now correctly interpret this as 12 columns. -
Feature: typstyle now uses soft wrapping for import items. Import statements with long lists of items will now wrap more compact. This aligns with rustfmt's approach to formatting long import lists.
-
Feature: typstyle no longer collapses consecutive spaces in markup by default. This change preserves intentional spacing in markup content, maintaining the author's formatting intentions.
-
Feature: typstyle no longer adds padding to the last cell in math alignments. For example, in
cases()expressions, the formatter will no longer add trailing spaces after the last cell, keeping comments properly aligned without unnecessary padding. -
Enhancement: typstyle now formats tables in most cases, and format headers and footers as tables. This major enhancement provides better support for complex table structures.
-
Enhancement: improved detection of table and grid elements. Special rows (
header,footer) and cells (cell,hline,vline) are now recognized without needing thegrid.ortable.prefix. -
Bug fix: typstyle now preserves backslashes in single-row aligned math equations. This addresses a missed case from #294 where expressions like
math.equation($ 1 & 2 \ $.body + $ & 4 \ $.body)would incorrectly have their backslashes removed. -
Bug fix: typstyle now handles escape hatch comments (
@typstyle off) better in corner cases. Previously, escape hatch did not work forArrayItem,DictItem,Param, andDestructuringItem. Additionally,@typstyle offno longer penetrates comments, and when it appears beforeCodeorMath, it now only applies to the first non-trivial child instead of the whole syntax node.