typst_library/layout/hide.rs
1use crate::foundations::{Content, elem};
2use crate::introspection::Tagged;
3
4/// Hides content without affecting layout.
5///
6/// The `hide` function allows you to hide content while the layout still "sees"
7/// it. This is useful for creating blank space that is exactly as large as some
8/// content.
9///
10/// # Example
11/// ```example
12/// Hello Jane \
13/// #hide[Hello] Joe
14/// ```
15///
16/// # Redaction
17/// This function may also be useful for redacting content as its arguments are
18/// neither present visually nor accessible to Assistive Technology. That said,
19/// there can be _some_ traces of the hidden content (such as a bookmarked
20/// heading in the PDF's Document Outline).
21///
22/// Note that, depending on the circumstances, it may be possible for content to
23/// be reverse engineered based on its size in the layout. We thus do not
24/// recommend using this function to hide highly sensitive information.
25#[elem(Tagged)]
26pub struct HideElem {
27 /// The content to hide.
28 #[required]
29 pub body: Content,
30
31 /// This style is set on the content contained in the `hide` element.
32 #[internal]
33 #[ghost]
34 pub hidden: bool,
35}