https://github.com/kachick/dprint-plugin-typstyle
Typst formatter as a dprint WASM plugin
https://github.com/kachick/dprint-plugin-typstyle
dprint-plugin typst
Last synced: 12 months ago
JSON representation
Typst formatter as a dprint WASM plugin
- Host: GitHub
- URL: https://github.com/kachick/dprint-plugin-typstyle
- Owner: kachick
- License: apache-2.0
- Created: 2024-09-23T06:09:58.000Z (over 1 year ago)
- Default Branch: main
- Last Pushed: 2025-02-04T00:19:22.000Z (over 1 year ago)
- Last Synced: 2025-02-04T01:22:58.968Z (over 1 year ago)
- Topics: dprint-plugin, typst
- Language: Rust
- Homepage:
- Size: 147 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 2
-
Metadata Files:
- Readme: README.md
- Contributing: CONTRIBUTING.md
- License: LICENSE
Awesome Lists containing this project
README
# dprint-plugin-typstyle
[](https://github.com/kachick/dprint-plugin-typstyle/actions/workflows/nix.yml?query=branch%3Amain+)
[Typst](https://github.com/typst/typst) formatter as a [dprint](https://github.com/dprint/dprint) WASM plugin, powered by [typstyle](https://github.com/Enter-tainer/typstyle)
## Installation
```bash
dprint config add 'kachick/typstyle'
```
This plugin delegates the formatter feature to the upstream typstyle-core [crate](https://crates.io/crates/typstyle).
## Configuration example
Minimum
```json
{
"plugins": [
"https://plugins.dprint.dev/kachick/typstyle-0.3.5.wasm"
]
}
```
Customize if necessary
```json
{
"typst": {
"indentWidth": 3,
"lineWidth": 78,
"blankLinesUpperBound": 5
},
"plugins": [
"https://plugins.dprint.dev/kachick/typstyle-0.3.5.wasm"
]
}
```
## Order of determines the values
1. typst section in dprint.json
1. [global config in dprint.json](https://dprint.dev/config/#global-configuration)
1. [default values in typstyle-core](https://github.com/Enter-tainer/typstyle/blob/v0.13.5/crates/typstyle-core/src/config.rs#L18-L28)
## Relationships of the option names
| dprint-plugin-typstyle | dprint global config | typstyle-core | typstyle CLI |
| ---------------------- | -------------------- | ----------------------- | --------------------------------- |
| lineWidth | lineWidth | max_width | column |
| indentWidth | indentWidth | tab_spaces | tab-width |
| blankLinesUpperBound | `none` | blank_lines_upper_bound | `none` |
| reorderImportItems | `none` | reorder_import_items | no-reorder-import-items # disable |
| wrapText | `none` | wrap_text | wrap-text |
## Versioning
Versions are updated based on changes in dprint and typestyle-core, and do not correspond to upstream version numbers.