Skip to content

About

Typst formatter as a dprint Wasm plugin

Topics

Resources

Stars

4 stars

Watchers

1 watching

Forks

Repository files navigation

dprint-plugin-typstyle

npm version CI

Adapter for typstyle for use as a formatting plugin in dprint. It formats Typst files (.typ).

Originally created by Kenichi Kamiya.

Install

Install and setup dprint.

Then in your project's directory with a dprint.json file, run:

dprint add typstyle

Note: You do not need typstyle installed globally as dprint will run typstyle-core from the .wasm file in a sandboxed environment.

Configuration

Works with no configuration by default. To add configuration, specify a "typst" key in your dprint.json:

{
  "typst": {
    "wrapMode": "fill", // "none" by default
  },
  "plugins": [
    // ...etc...
  ],
}

Configuration precedence

  1. typst section in dprint.json
  2. global config in dprint.json
  3. default values in typstyle-core

Option name mappings

dprint-plugin-typstyle dprint global config typstyle-core typstyle CLI
lineWidth lineWidth max_width line-width
indentWidth indentWidth tab_spaces indent-width
blankLinesUpperBound none blank_lines_upper_bound none
reorderImportItems none reorder_import_items no-reorder-import-items # disable
wrapMode none wrap_mode wrap-text (none/fill/sentence)

JS Formatting API

Versioning

This repo automatically upgrades to the latest version of typstyle once a day. You can check which version of typstyle is being used by looking at the typstyle-core entry in the Cargo.toml file in this repo:

https://github.com/dprint/dprint-plugin-typstyle/blob/main/Cargo.toml

At the moment, the version of this plugin does not reflect the version of typstyle.

License

This project is licensed under the Apache License 2.0 - see the LICENSE and NOTICE files for details.

About

Typst formatter as a dprint Wasm plugin

Topics

Resources

Stars

4 stars

Watchers

1 watching

Forks

Releases

Packages

Used by

Contributors

Languages