dprint-plugin-svg
A dprint Wasm plugin for formatting SVG files.
Install
dprint add kjanat/svg
Quick start
Add plugin-level options under the "svg" key in your dprint config:
{
"svg": {
"attributeSort": "canonical",
"attributeLayout": "auto",
"spaceBeforeSelfClose": true
},
"plugins": [
"https://plugins.dprint.dev/kjanat/svg-v0.4.1.wasm"
]
}
Top-level config inheritance
Several options fall back to the top-level keys in the same dprint.json
(not the user-profile “global” config — those are the per-file root
keys dprint passes to every plugin). When omitted from the svg section:
| Plugin option | Falls back to top-level |
|---|---|
lineWidth | lineWidth (default 100) |
useTabs | useTabs (default false) |
indentWidth | indentWidth (default 2) |
newLineKind | newLineKind (default "auto") |
Plugin-owned defaults
Every other option resolves from
svg_format::FormatOptions::default() via
the plugin’s config-enum mappers. The table below is generated from the
live schema on every mdbook build; values shown are whatever the
current source ships.
| Option | Type | Default |
|---|---|---|
| attributeLayout | "auto" | "single-line" | "multi-line" | "auto" |
| attributeSort | "none" | "canonical" | "alphabetical" | "canonical" |
| attributesPerLine | integer | 1 |
| blankLines | "remove" | "preserve" | "truncate" | "insert" | "truncate" |
| formatEmbeddedContent | boolean | true |
| indentWidth | integer | top-level |
| lineWidth | integer | top-level |
| maxInlineTagWidth | integer | top-level |
| newLineKind | "auto" | "lf" | "crlf" | top-level |
| quoteStyle | "preserve" | "double" | "single" | "preserve" |
| spaceBeforeSelfClose | boolean | true |
| textContent | "collapse" | "maintain" | "prettify" | "maintain" |
| useTabs | boolean | top-level |
| wrappedAttributeIndent | "one-level" | "align-to-tag-name" | "align-to-tag-name" |
Configuration reference
Browse the sidebar for per-option documentation with before/after examples.