typst: `hide` function does not work with lines and paths

Description

#set page(height: auto, width: auto, margin: 0pt)
#set text(size: 2em)

#hide[
  This is some text

  #table(rows: 2, columns: 2)[a][b][c][d]
]

This is more text

This should hide all content before “this is more text”, but here is the result:

image

Is this desired behavior?

Reproduction URL

No response

Operating system

Web app, Windows

Typst version

  • I am using the latest version of Typst

About this issue

  • Original URL
  • State: closed
  • Created 10 months ago
  • Reactions: 4
  • Comments: 15 (13 by maintainers)

Most upvoted comments

I feels like hide should be redesigned.

@Enter-tainer I’ve pushed https://github.com/typst/typst/commit/50741209a8f4c5e91d35281eb44b7425b3d022b2, which should make things at least a bit more robust. The link & hide metadata is now applied in a few select places where styles are already manually managed (flow, par, math) and not for each content leaf individually (line, polygon, image, text, etc.)

ty, i will try and update my pr

The hide function also does not work with images:

#hide(image("myimage.svg"))

still shows the image

Which typst version are you using? This is not reproduceable in latest main and v0.10.0

Ah, it tested it again, and it turns out: It hides it if the aspect ratio of the image is unchanged, but #hide(image(width: 5cm, height: 1cm, "myimage.svg")) prevents the hiding, I just left that out to make the example above easier but that is apparently relevant. 😅

I’ve updated the comment above and attached the svg (I’m using v0.10.0 btw)

I feels like hide should be redesigned.

Definitely. I just don’t know how. 😕