Skip to content

Commit

Permalink
fix(svg): 'Render' hidden
Browse files Browse the repository at this point in the history
  • Loading branch information
epage committed Feb 17, 2024
1 parent 63b2a4a commit eba9288
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 9 deletions.
5 changes: 5 additions & 0 deletions crates/anstyle-svg/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -135,6 +135,7 @@ impl Term {
)
.unwrap();
writeln!(&mut buffer, r#" .dimmed {{ opacity: 0.7; }}"#).unwrap();
writeln!(&mut buffer, r#" .hidden {{ opacity: 0; }}"#).unwrap();
writeln!(&mut buffer, r#" tspan {{"#).unwrap();
writeln!(&mut buffer, r#" font: 14px {font_family};"#).unwrap();
writeln!(&mut buffer, r#" white-space: pre;"#).unwrap();
Expand Down Expand Up @@ -194,6 +195,7 @@ fn write_span(buffer: &mut String, style: &anstyle::Style, fragment: &str) {
let bold = effects.contains(anstyle::Effects::BOLD);
let italic = effects.contains(anstyle::Effects::ITALIC);
let dimmed = effects.contains(anstyle::Effects::DIMMED);
let hidden = effects.contains(anstyle::Effects::HIDDEN);

let fragment = html_escape::encode_text(fragment);
let mut classes = Vec::new();
Expand Down Expand Up @@ -233,6 +235,9 @@ fn write_span(buffer: &mut String, style: &anstyle::Style, fragment: &str) {
if dimmed {
classes.push("dimmed");
}
if hidden {
classes.push("hidden");
}

use std::fmt::Write as _;
write!(buffer, r#"<tspan xml:space="preserve""#).unwrap();
Expand Down
Loading

0 comments on commit eba9288

Please sign in to comment.