apcamargo/dprint-plugin-typstyle · 文件
文件最后提交记录最后更新时间
README.md
dprint-plugin-typstyle
Adapter plugin for dprint that formats Typst files via Typstyle.
Install
Add the plugin release URL to your dprint.json:
{
"typstyle": {
// typstyle's config goes here
},
"plugins": [
"https://plugins.dprint.dev/apcamargo/typstyle-0.1.0.wasm"
]
}
Configuration
To add configuration, specify a "typstyle" key in your dprint.json:
{
"typstyle": {
"lineWidth": 100,
"indentWidth": 2,
"blankLinesUpperBound": 1,
"collapseMarkupSpaces": false,
"reorderImportItems": true,
"wrapMode": "none",
"lineEnding": "lf",
},
"plugins": [
// ...etc...
]
}
Properties
| Property | Type | Default | Description |
|---|---|---|---|
lineWidth | integer | 80 | Maximum width of each line. Minimum 1. |
indentWidth | integer | 2 | Number of spaces per indentation level. Minimum 0. |
blankLinesUpperBound | integer | 1 | Maximum number of consecutive blank lines preserved. Minimum 0. |
collapseMarkupSpaces | boolean | false | Collapse consecutive whitespace in markup into a single space. |
reorderImportItems | boolean | true | Sort the items of an import statement alphabetically. |
wrapMode | string | "none" | Text wrapping mode: "none" (do not wrap text), "fill" (wrap text to fit within line width), or "sentence" (place each sentence on its own line). |
lineEnding | string | "lf" | The line ending style to use when writing files: "lf" (line feed) or "crlf" (carriage return, line feed). |
Versioning
This plugin is released independently from Typstyle. The version of typstyle-core used by the plugin is listed in Cargo.toml and is checked for updates by this repository's monthly update workflow.
Development
Build and test locally:
# Run unit and spec tests
cargo test
# Run clippy checks
cargo clippy --all-targets --all-features -- -D warnings
# Build Wasm module
rustup target add wasm32-unknown-unknown
cargo build --target wasm32-unknown-unknown --features wasm --release