diff options
| author | Sébastien d'Herbais de Thun <sebastien.d.herbais@gmail.com> | 2024-09-02 14:43:07 +0200 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2024-09-02 12:43:07 +0000 |
| commit | 39b47060ccb214290d49d9767372231877e2921f (patch) | |
| tree | afcb641ab3e4a43e5f9395eafaef303d5f20da42 | |
| parent | 89521c2066c8a8919da6f90f427edb663de05a18 (diff) | |
Added example to `box.clip` & `block.clip` (#4870)
| -rw-r--r-- | crates/typst/src/layout/container.rs | 24 |
1 files changed, 24 insertions, 0 deletions
diff --git a/crates/typst/src/layout/container.rs b/crates/typst/src/layout/container.rs index 83523861..443e660a 100644 --- a/crates/typst/src/layout/container.rs +++ b/crates/typst/src/layout/container.rs @@ -106,6 +106,18 @@ pub struct BoxElem { pub outset: Sides<Option<Rel<Length>>>, /// Whether to clip the content inside the box. + /// + /// Clipping is useful when the box's content is larger than the box itself, + /// as any content that exceeds the box's bounds will be hidden. + /// + /// ```example + /// #box( + /// width: 50pt, + /// height: 50pt, + /// clip: true, + /// image("tiger.jpg", width: 100pt, height: 100pt) + /// ) + /// ``` #[default(false)] pub clip: bool, @@ -422,6 +434,18 @@ pub struct BlockElem { pub below: Smart<Spacing>, /// Whether to clip the content inside the block. + /// + /// Clipping is useful when the block's content is larger than the box itself, + /// as any content that exceeds the box's bounds will be hidden. + /// + /// ```example + /// #block( + /// width: 50pt, + /// height: 50pt, + /// clip: true, + /// image("tiger.jpg", width: 100pt, height: 100pt) + /// ) + /// ``` #[default(false)] pub clip: bool, |
