How is hide() supposed to work? #980
-
|
If I do: The content is not hidden. But if I do it is. Is this intended behavior? (I'm trying to hide certain tree nodes, but it seems I can only hide the whole tree.) |
Beta Was this translation helpful? Give feedback.
Answered by
johannes-wolf
Oct 23, 2025
Replies: 1 comment 1 reply
-
|
In the first example you are expecting If you want to hide cetz elements, used The following example works fine for me: #let data = (
[Root], ([Child A], ([Child B], [Child C], [Child D]))
)
#cetz.canvas({
import cetz.draw: *
cetz.tree.tree(data, draw-node: (node) => {
if node.depth == 2 {
hide(content((), node.content))
} else {
content((), node.content)
}
})
})
|
Beta Was this translation helpful? Give feedback.
1 reply
Answer selected by
steef435
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment

In the first example you are expecting
std.hide– Typst's nativehide(content)function – while cetz elements only work with cetz'hide(elements).If you want to hide cetz elements, used
hidefromcetz.draw.hide, if you need Typst's nativehideusestd.hide(see: https://cetz-package.github.io/docs/api/draw-functions/grouping/hide/).The following example works fine for me: