summaryrefslogtreecommitdiff
path: root/library/src/visualize
diff options
context:
space:
mode:
authorLaurenz <laurmaedje@gmail.com>2023-04-26 13:46:42 +0200
committerLaurenz <laurmaedje@gmail.com>2023-04-26 15:37:21 +0200
commit3680c854a21db665d64cdb8f31aa0f9a1af16ceb (patch)
tree39dfa33059293251f1e2890f9b3d0e3dc178ed03 /library/src/visualize
parent59957746e91c1322a8ca6d228bcaa0f31941ee1b (diff)
Touch up docs
Diffstat (limited to 'library/src/visualize')
-rw-r--r--library/src/visualize/line.rs54
-rw-r--r--library/src/visualize/shape.rs4
2 files changed, 35 insertions, 23 deletions
diff --git a/library/src/visualize/line.rs b/library/src/visualize/line.rs
index 0555ddec..4a1cb87c 100644
--- a/library/src/visualize/line.rs
+++ b/library/src/visualize/line.rs
@@ -5,8 +5,13 @@ use crate::prelude::*;
/// ## Example
/// ```example
/// #set page(height: 100pt)
+///
/// #line(length: 100%)
/// #line(end: (50%, 50%))
+/// #line(
+/// length: 4cm,
+/// stroke: 2pt + maroon,
+/// )
/// ```
///
/// Display: Line
@@ -41,30 +46,37 @@ pub struct LineElem {
/// - A stroke combined from color and thickness using the `+` operator as
/// in `{2pt + red}`.
/// - A stroke described by a dictionary with any of the following keys:
- /// - `color`: the color to use for the stroke
- /// - `thickness`: the stroke's thickness
- /// - `cap`: one of `"butt"`, `"round"` or `"square"`, the line cap of the stroke
- /// - `join`: one of `"miter"`, `"round"` or `"bevel"`, the line join of the stroke
- /// - `miter-limit`: the miter limit to use if `join` is `"miter"`, defaults to 4.0
- /// - `dash`: the dash pattern to use. Can be any of the following:
- /// - One of the strings `"solid"`, `"dotted"`, `"densely-dotted"`, `"loosely-dotted"`,
- /// `"dashed"`, `"densely-dashed"`, `"loosely-dashed"`, `"dashdotted"`,
- /// `"densely-dashdotted"` or `"loosely-dashdotted"`
- /// - An array with elements that specify the lengths of dashes and gaps, alternating.
- /// Elements can also be the string `"dot"` for a length equal to the line thickness.
- /// - A dict with the keys `array`, same as the array above, and `phase`, the offset to
- /// the start of the first dash.
- ///
+ /// - `paint`: The [color]($type/color) to use for the stroke.
+ /// - `thickness`: The stroke's thickness as a [length]($type/length).
+ /// - `cap`: How the line terminates. One of `{"butt"}`, `{"round"}`, or
+ /// `{"square"}`.
+ /// - `join`: How sharp turns of a contour are rendered. One of
+ /// `{"miter"}`, `{"round"}`, or `{"bevel"}`. Not applicable to lines
+ /// but to [polygons]($func/polygon) or [paths]($func/path).
+ /// - `miter-limit`: Number at which protruding sharp angles are rendered
+ /// with a bevel instead. The higher the number, the sharper an angle
+ /// can be before it is bevelled. Only applicable if `join` is
+ /// `{"miter"}`. Defaults to `{4.0}`.
+ /// - `dash`: The dash pattern to use. Can be any of the following:
+ /// - One of the predefined patterns `{"solid"}`, `{"dotted"}`,
+ /// `{"densely-dotted"}`, `{"loosely-dotted"}`, `{"dashed"}`,
+ /// `{"densely-dashed"}`, `{"loosely-dashed"}`, `{"dash-dotted"}`,
+ /// `{"densely-dash-dotted"}` or `{"loosely-dash-dotted"}`
+ /// - An [array]($type/array) with alternating lengths for dashes and
+ /// gaps. You can also use the string `{"dot"}` for a length equal to
+ /// the line thickness.
+ /// - A [dictionary]($type/dictionary) with the keys `array` (same as
+ /// the array above), and `phase` (of type [length]($type/length)),
+ /// which defines where in the pattern to start drawing.
///
/// ```example
+ /// #set line(length: 100%)
/// #stack(
- /// line(length: 100%, stroke: 2pt + red),
- /// v(1em),
- /// line(length: 100%, stroke: (color: blue, thickness: 4pt, cap: "round")),
- /// v(1em),
- /// line(length: 100%, stroke: (color: blue, thickness: 1pt, dash: "dashed")),
- /// v(1em),
- /// line(length: 100%, stroke: (color: blue, thickness: 1pt, dash: ("dot", 2pt, 4pt, 2pt))),
+ /// spacing: 1em,
+ /// line(stroke: 2pt + red),
+ /// line(stroke: (paint: blue, thickness: 4pt, cap: "round")),
+ /// line(stroke: (paint: blue, thickness: 1pt, dash: "dashed")),
+ /// line(stroke: (paint: blue, thickness: 1pt, dash: ("dot", 2pt, 4pt, 2pt))),
/// )
/// ```
#[resolve]
diff --git a/library/src/visualize/shape.rs b/library/src/visualize/shape.rs
index 27ef0e3f..75f03f67 100644
--- a/library/src/visualize/shape.rs
+++ b/library/src/visualize/shape.rs
@@ -55,8 +55,8 @@ pub struct RectElem {
/// - `miter-limit`: the miter limit to use if `join` is `"miter"`, defaults to 4.0
/// - `dash`: the dash pattern to use. Can be any of the following:
/// - One of the strings `"solid"`, `"dotted"`, `"densely-dotted"`, `"loosely-dotted"`,
- /// `"dashed"`, `"densely-dashed"`, `"loosely-dashed"`, `"dashdotted"`,
- /// `"densely-dashdotted"` or `"loosely-dashdotted"`
+ /// `"dashed"`, `"densely-dashed"`, `"loosely-dashed"`, `"dash-dotted"`,
+ /// `"densely-dash-dotted"` or `"loosely-dash-dotted"`
/// - An array with elements that specify the lengths of dashes and gaps, alternating.
/// Elements can also be the string `"dot"` for a length equal to the line thickness.
/// - A dict with the keys `array`, same as the array above, and `phase`, the offset to