summaryrefslogtreecommitdiff
path: root/crates/typst-library/src/layout
diff options
context:
space:
mode:
authorKronosTheLate <61620837+KronosTheLate@users.noreply.github.com>2023-11-07 16:56:09 +0100
committerGitHub <noreply@github.com>2023-11-07 16:56:09 +0100
commit3a1e47913d874647e5d8d013a7e21beca96453d6 (patch)
tree2faabde9d3f7439413e45ee84338de56cc093c78 /crates/typst-library/src/layout
parent5f922abfd840425f347b7b86b1d0d81e489faf8d (diff)
Make reference to spreading in arguments of `grid` (#2593)
Co-authored-by: Laurenz <laurmaedje@gmail.com>
Diffstat (limited to 'crates/typst-library/src/layout')
-rw-r--r--crates/typst-library/src/layout/grid.rs41
1 files changed, 26 insertions, 15 deletions
diff --git a/crates/typst-library/src/layout/grid.rs b/crates/typst-library/src/layout/grid.rs
index b29adeb9..9e9fe3ba 100644
--- a/crates/typst-library/src/layout/grid.rs
+++ b/crates/typst-library/src/layout/grid.rs
@@ -36,28 +36,39 @@ use super::Sizing;
/// instead of an array. For example, `columns:` `{3}` is equivalent to
/// `columns:` `{(auto, auto, auto)}`.
///
-/// # Example
+/// # Examples
+/// The example below demonstrates the different track sizing options.
+///
/// ```example
-/// #set text(10pt, style: "italic")
-/// #let cell = rect.with(
+/// // We use `rect` to emphasize the
+/// // area of cells.
+/// #set rect(
/// inset: 8pt,
/// fill: rgb("e4e5ea"),
/// width: 100%,
-/// radius: 6pt
/// )
+///
/// #grid(
-/// columns: (60pt, 1fr, 60pt),
-/// rows: (60pt, auto),
+/// columns: (60pt, 1fr, 2fr),
+/// rows: (auto, 60pt),
/// gutter: 3pt,
-/// cell(height: 100%)[Easy to learn],
-/// cell(height: 100%)[Great output],
-/// cell(height: 100%)[Intuitive],
-/// cell[Our best Typst yet],
-/// cell[
-/// Responsive design in print
-/// for everyone
-/// ],
-/// cell[One more thing...],
+/// rect[Fixed width, auto height],
+/// rect[1/3 of the remains],
+/// rect[2/3 of the remains],
+/// rect(height: 100%)[Fixed height],
+/// image("tiger.jpg", height: 100%),
+/// image("tiger.jpg", height: 100%),
+/// )
+/// ```
+///
+/// You can also [spread]($arguments/#spreading) an array of strings or content
+/// into a grid to populate its cells.
+///
+/// ```example
+/// #grid(
+/// columns: 5,
+/// gutter: 5pt,
+/// ..range(25).map(str)
/// )
/// ```
#[elem(Layout)]