diff --git a/src/model/styles.rs b/src/model/styles.rs index 334a01b8a..2f33ef929 100644 --- a/src/model/styles.rs +++ b/src/model/styles.rs @@ -472,8 +472,10 @@ pub struct ShowableSelector(pub Selector); impl Cast for ShowableSelector { fn is(value: &Value) -> bool { - matches!(value, Value::Str(_) | Value::Label(_) | Value::Func(_)) - || value.type_name() == "regular expression" + matches!( + value, + Value::Symbol(_) | Value::Str(_) | Value::Label(_) | Value::Func(_) + ) || value.type_name() == "regular expression" || value.type_name() == "selector" } @@ -510,6 +512,7 @@ impl Cast for ShowableSelector { CastInfo::Type("label"), CastInfo::Type("string"), CastInfo::Type("regular expression"), + CastInfo::Type("symbol"), CastInfo::Type("selector"), ]) } diff --git a/tests/ref/math/style.png b/tests/ref/math/style.png index f4a42c707..c5e722582 100644 Binary files a/tests/ref/math/style.png and b/tests/ref/math/style.png differ diff --git a/tests/typ/compiler/show-node.typ b/tests/typ/compiler/show-node.typ index c69f46bd1..27a4b6a9d 100644 --- a/tests/typ/compiler/show-node.typ +++ b/tests/typ/compiler/show-node.typ @@ -96,7 +96,7 @@ Hey = Heading --- -// Error: 7-10 expected function, label, string, regular expression, or selector, found color +// Error: 7-10 expected function, label, string, regular expression, symbol, or selector, found color #show red: [] --- diff --git a/tests/typ/math/style.typ b/tests/typ/math/style.typ index dfb7a7953..67a410aff 100644 --- a/tests/typ/math/style.typ +++ b/tests/typ/math/style.typ @@ -28,3 +28,8 @@ $text(#red, "time"^2) + sqrt("place")$ // Test different font. #show math.equation: set text(font: "Fira Math") $ v := vec(1 + 2, 2 - 4, sqrt(3), arrow(x)) + 1 $ + +--- +// Test using rules for symbols +#show sym.tack: it => $#h(1em) it #h(1em)$ +$ a tack b $