diff --git a/Cargo.lock b/Cargo.lock index 649781a..c4bb4ff 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -443,9 +443,9 @@ checksum = "1261fe7e33c73b354eab43b1273a57c8f967d0391e80353e51f764ac02cf6775" [[package]] name = "osvg" -version = "0.1.1" +version = "0.1.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5b048498a64f5d64706880cef43675daa3ea2ec9721a2a2c27c264ce5bc4e091" +checksum = "d64287d0fbacc1f8154c5673a41d5c7f100794bc84b9a0da14bbb0a34911fbbc" dependencies = [ "rquickjs", ] diff --git a/Cargo.toml b/Cargo.toml index 74a0029..3865a0d 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -19,7 +19,7 @@ html-escape = "0.2" base64 = "0.22.1" wasm-bindgen-test = "0.3.45" ansi2 = { path = "./ansi2", features = ["wasm"] } -osvg = { version = "0.1.1", features = ["bindgen"] } +osvg = { version = "0.1.3", features = ["bindgen"] } insta = { version = "1.40.0" } [profile.release] diff --git a/ansi2-wasm/src-ts/cli.ts b/ansi2-wasm/src-ts/cli.ts index a0d9c50..59ba6aa 100644 --- a/ansi2-wasm/src-ts/cli.ts +++ b/ansi2-wasm/src-ts/cli.ts @@ -91,7 +91,20 @@ async function main() { options.lightBg, options.darkBg, ) - const result = compress ? optimize(s).data : s + const result = compress + ? optimize(s, { + plugins: [ + { + name: "preset-default", + params: { + overrides: { + inlineStyles: false, + }, + }, + }, + ], + }).data + : s process.stdout.write(result) break } diff --git a/ansi2/src/main.rs b/ansi2/src/main.rs index 093da52..fb7cbe2 100644 --- a/ansi2/src/main.rs +++ b/ansi2/src/main.rs @@ -74,7 +74,25 @@ fn main() { Format::Svg => { let mut svg = to_svg(s, theme, width, base64, mode, args.light_bg, args.dark_bg); if args.compress { - svg = osvg::osvg(&svg).expect("compress error"); + svg = osvg::osvg( + &svg, + Some( + r#" +{ + plugins: [ + { + name: "preset-default", + params: { + overrides: { + inlineStyles: false, + }, + }, + }, + ], +}"#, + ), + ) + .expect("compress error"); } svg } diff --git a/assets/update.sh b/assets/update.sh index 9187b64..a75fe62 100755 --- a/assets/update.sh +++ b/assets/update.sh @@ -2,7 +2,7 @@ for i in win11 vitest 8bit-color 24bit-color nu-ls do - cat "$i.ans" | node ../ansi2-wasm/bin/cli.js > "$i.svg" + cat "$i.ans" | node ../ansi2-wasm/bin/cli.js -c > "$i.svg" cat "$i.ans" | node ../ansi2-wasm/bin/cli.js --mode=light -c > "$i-light.svg" cat "$i.ans" | node ../ansi2-wasm/bin/cli.js --mode=dark -c > "$i-dark.svg" echo "$i done"