summaryrefslogtreecommitdiff
path: root/library/src/layout
diff options
context:
space:
mode:
authorLaurenz <laurmaedje@gmail.com>2023-02-12 22:39:20 +0100
committerLaurenz <laurmaedje@gmail.com>2023-02-12 22:39:20 +0100
commit10b17a04bc27a4b38a0534446d29151d4f6303b3 (patch)
treeb2d27d662822a969c6cb3718a1cc05908f8731a7 /library/src/layout
parentfd90736fb6239409210f845a8589ba3d6b849ef3 (diff)
Fix docs
Diffstat (limited to 'library/src/layout')
-rw-r--r--library/src/layout/container.rs24
-rw-r--r--library/src/layout/place.rs17
-rw-r--r--library/src/layout/transform.rs31
3 files changed, 34 insertions, 38 deletions
diff --git a/library/src/layout/container.rs b/library/src/layout/container.rs
index 930a27e7..49ce0372 100644
--- a/library/src/layout/container.rs
+++ b/library/src/layout/container.rs
@@ -6,14 +6,9 @@ use crate::prelude::*;
/// An inline-level container that sizes content.
///
/// All elements except inline math, text, and boxes are block-level and cannot
-/// occur inside of a paragraph. The box element is an inline-level container.
-/// Boxes take the size of their contents by default but can also be sized
-/// explicitly.
-///
-/// _Note:_ While the behavior above will be the default in the future, the
-/// transformation functions [`scale`]($func/scale), [`rotate`]($func/rotate),
-/// and [`move`]($func/move) will currently yield inline nodes within
-/// paragraphs.
+/// occur inside of a paragraph. The box function can be used to integrate such
+/// elements into a paragraph. Boxes take the size of their contents by default
+/// but can also be sized explicitly.
///
/// ## Example
/// ```example
@@ -29,9 +24,20 @@ use crate::prelude::*;
/// - body: `Content` (positional)
/// The contents of the box.
///
-/// - width: `Rel<Length>` (named)
+/// - width: `Sizing` (named)
/// The width of the box.
///
+/// Boxes can have [fractional]($type/fraction) widths, as the example
+/// below demonstrates.
+///
+/// _Note:_ Currently, only boxes and only their widths might be fractionally
+/// sized within paragraphs. Support for fractionally sized images, shapes,
+/// and more might be added in the future.
+///
+/// ```example
+/// Line in #box(width: 1fr, line(length: 100%)) between.
+/// ```
+///
/// - height: `Rel<Length>` (named)
/// The height of the box.
///
diff --git a/library/src/layout/place.rs b/library/src/layout/place.rs
index c6e26b72..d5edaa79 100644
--- a/library/src/layout/place.rs
+++ b/library/src/layout/place.rs
@@ -37,18 +37,11 @@ use crate::prelude::*;
/// The horizontal displacement of the placed content.
///
/// ```example
-/// #set align(center)
-///
-/// #box(
-/// width: 80pt,
-/// height: 80pt,
-/// {
-/// for i in range(18) {
-/// let amount = i * 4pt
-/// place(dx: amount, dy: amount)[A]
-/// }
-/// }
-/// )
+/// #set page(height: 100pt)
+/// #for i in range(16) {
+/// let amount = i * 4pt
+/// place(center, dx: amount - 32pt, dy: amount)[A]
+/// }
/// ```
///
/// - dy: `Rel<Length>` (named)
diff --git a/library/src/layout/transform.rs b/library/src/layout/transform.rs
index 5977e90b..e0014ac0 100644
--- a/library/src/layout/transform.rs
+++ b/library/src/layout/transform.rs
@@ -26,10 +26,6 @@ use crate::prelude::*;
/// - body: `Content` (positional, required)
/// The content to move.
///
-/// ```example
-/// Hello, world!#move(dy: -2pt)[!]#move(dy: 2pt)[!]
-/// ```
-///
/// - dx: `Rel<Length>` (named)
/// The horizontal displacement of the content.
///
@@ -92,11 +88,12 @@ impl Layout for MoveNode {
///
/// ## Example
/// ```example
-/// #{
-/// range(16)
-/// .map(i => rotate(24deg * i)[X])
-/// .join(h(1fr))
-/// }
+/// #stack(
+/// dir: ltr,
+/// spacing: 1fr,
+/// ..range(16)
+/// .map(i => rotate(24deg * i)[X]),
+/// )
/// ```
///
/// ## Parameters
@@ -107,7 +104,7 @@ impl Layout for MoveNode {
/// The amount of rotation.
///
/// ```example
-/// #rotate(angle: -1.571rad)[To space!]
+/// #rotate(angle: -1.571rad)[Space!]
/// ```
///
/// ## Category
@@ -135,10 +132,10 @@ impl RotateNode {
/// #set text(spacing: 8pt)
/// #let square = square.with(width: 8pt)
///
- /// #square()
- /// #rotate(angle: 30deg, origin: center, square())
- /// #rotate(angle: 30deg, origin: top + left, square())
- /// #rotate(angle: 30deg, origin: bottom + right, square())
+ /// #box(square())
+ /// #box(rotate(angle: 30deg, origin: center, square()))
+ /// #box(rotate(angle: 30deg, origin: top + left, square()))
+ /// #box(rotate(angle: 30deg, origin: bottom + right, square()))
/// ```
#[property(resolve)]
pub const ORIGIN: Axes<Option<GenAlign>> = Axes::default();
@@ -188,7 +185,7 @@ impl Layout for RotateNode {
/// ## Example
/// ```example
/// #set align(center)
-/// #scale(x: -100%)[👍]👩‍🦱👍
+/// #scale(x: -100%)[This is mirrored.]
/// ```
///
/// ## Parameters
@@ -224,8 +221,8 @@ impl ScaleNode {
/// By default, the origin is the center of the scaled element.
///
/// ```example
- /// A#scale(75%)[A]A \
- /// B#scale(75%, origin: bottom + left)[B]B
+ /// A#box(scale(75%)[A])A \
+ /// B#box(scale(75%, origin: bottom + left)[B])B
/// ```
#[property(resolve)]
pub const ORIGIN: Axes<Option<GenAlign>> = Axes::default();