svg-format
Structural formatter for SVG documents.
This crate formats SVG by parsing with tree-sitter and rebuilding a normalized structure with tab indentation, deterministic attribute ordering, and stable tag layout. Style/script text blocks are preserved without trying to parse and rewrite CSS/JS semantics.
API
use ;
let pretty = format;
let pretty_custom = format_with_options;
CLI
svg-format is also available as a CLI binary from the same crate
(cargo install svg-format or npm install --global svg-format).
# Format from stdin to stdout
|
# Check whether a file would change
# Format file in place