Skip to content
Discussion options

You must be logged in to vote

In the first example you are expecting std.hide – Typst's native hide(content) function – while cetz elements only work with cetz' hide(elements).

If you want to hide cetz elements, used hide from cetz.draw.hide, if you need Typst's native hide use std.hide (see: https://cetz-package.github.io/docs/api/draw-functions/grouping/hide/).

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)
    }
  })
})

Replies: 1 comment 1 reply

Comment options

You must be logged in to vote
1 reply
@steef435
Comment options

Answer selected by steef435
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants