mirror of
https://github.com/typst/typst
synced 2025-05-19 19:45:29 +08:00
Added example to box.clip
& block.clip
(#4870)
This commit is contained in:
parent
89521c2066
commit
39b47060cc
@ -106,6 +106,18 @@ pub struct BoxElem {
|
|||||||
pub outset: Sides<Option<Rel<Length>>>,
|
pub outset: Sides<Option<Rel<Length>>>,
|
||||||
|
|
||||||
/// Whether to clip the content inside the box.
|
/// 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)]
|
#[default(false)]
|
||||||
pub clip: bool,
|
pub clip: bool,
|
||||||
|
|
||||||
@ -422,6 +434,18 @@ pub struct BlockElem {
|
|||||||
pub below: Smart<Spacing>,
|
pub below: Smart<Spacing>,
|
||||||
|
|
||||||
/// Whether to clip the content inside the block.
|
/// 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)]
|
#[default(false)]
|
||||||
pub clip: bool,
|
pub clip: bool,
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user