summaryrefslogtreecommitdiff
path: root/library
diff options
context:
space:
mode:
authorLaurenz <laurmaedje@gmail.com>2023-03-08 10:43:03 +0100
committerLaurenz <laurmaedje@gmail.com>2023-03-08 10:44:24 +0100
commit1b2b53ecb91a9bd7fb3493e471ae03cd142a7c03 (patch)
tree682124c2343db9491c84bddbdca026c676f220c6 /library
parent25b5bd117529cd04bb789e1988eb3a3db8025a0e (diff)
Require font to be a named argument
Diffstat (limited to 'library')
-rw-r--r--library/src/layout/align.rs1
-rw-r--r--library/src/layout/enum.rs59
-rw-r--r--library/src/layout/flow.rs3
-rw-r--r--library/src/layout/list.rs3
-rw-r--r--library/src/layout/page.rs10
-rw-r--r--library/src/layout/par.rs1
-rw-r--r--library/src/layout/spacing.rs5
-rw-r--r--library/src/layout/terms.rs3
-rw-r--r--library/src/layout/transform.rs13
-rw-r--r--library/src/math/delimited.rs13
-rw-r--r--library/src/math/mod.rs11
-rw-r--r--library/src/math/style.rs2
-rw-r--r--library/src/meta/link.rs48
-rw-r--r--library/src/shared/ext.rs6
-rw-r--r--library/src/text/deco.rs5
-rw-r--r--library/src/text/mod.rs85
-rw-r--r--library/src/text/raw.rs8
-rw-r--r--library/src/text/shaping.rs2
-rw-r--r--library/src/text/shift.rs2
-rw-r--r--library/src/visualize/line.rs9
-rw-r--r--library/src/visualize/shape.rs21
21 files changed, 125 insertions, 185 deletions
diff --git a/library/src/layout/align.rs b/library/src/layout/align.rs
index 96c0ae3b..bd9c60fa 100644
--- a/library/src/layout/align.rs
+++ b/library/src/layout/align.rs
@@ -57,6 +57,7 @@ pub struct AlignNode {
/// )
/// ```
#[settable]
+ #[positional]
#[fold]
#[skip]
#[default(Axes::new(GenAlign::Start, GenAlign::Specific(Align::Top)))]
diff --git a/library/src/layout/enum.rs b/library/src/layout/enum.rs
index 990c0fb9..edc954d0 100644
--- a/library/src/layout/enum.rs
+++ b/library/src/layout/enum.rs
@@ -49,20 +49,6 @@ use super::GridLayouter;
/// becomes part of that item.
///
/// ## Parameters
-/// - items: `Content` (positional, variadic)
-/// The enumeration's children.
-///
-/// When using the enum syntax, adjacent items are automatically collected
-/// into enumerations, even through constructs like for loops.
-///
-/// ```example
-/// #for phase in (
-/// "Launch",
-/// "Orbit",
-/// "Descent",
-/// ) [+ #phase]
-/// ```
-///
/// - start: `NonZeroUsize` (named)
/// Which number to start the enumeration with.
///
@@ -74,31 +60,39 @@ use super::GridLayouter;
/// )
/// ```
///
-/// - tight: `bool` (named)
-/// If this is `{false}`, the items are spaced apart with
-/// [enum spacing]($func/enum.spacing). If it is `{true}`, they use normal
-/// [leading]($func/par.leading) instead. This makes the enumeration more
-/// compact, which can look better if the items are short.
-///
-/// ```example
-/// + If an enum has a lot of text, and
-/// maybe other inline content, it
-/// should not be tight anymore.
-///
-/// + To make an enum wide, simply
-/// insert a blank line between the
-/// items.
-/// ```
-///
/// Display: Numbered List
/// Category: layout
#[node(Construct, Layout)]
pub struct EnumNode {
/// The numbered list's items.
+ ///
+ /// When using the enum syntax, adjacent items are automatically collected
+ /// into enumerations, even through constructs like for loops.
+ ///
+ /// ```example
+ /// #for phase in (
+ /// "Launch",
+ /// "Orbit",
+ /// "Descent",
+ /// ) [+ #phase]
+ /// ```
#[variadic]
pub items: Vec<EnumItem>,
- /// If true, the items are separated by leading instead of list spacing.
+ /// If this is `{false}`, the items are spaced apart with
+ /// [enum spacing]($func/enum.spacing). If it is `{true}`, they use normal
+ /// [leading]($func/par.leading) instead. This makes the enumeration more
+ /// compact, which can look better if the items are short.
+ ///
+ /// ```example
+ /// + If an enum has a lot of text, and
+ /// maybe other inline content, it
+ /// should not be tight anymore.
+ ///
+ /// + To make an enum wide, simply
+ /// insert a blank line between the
+ /// items.
+ /// ```
#[named]
#[default(true)]
pub tight: bool,
@@ -252,6 +246,9 @@ impl Layout for EnumNode {
}
/// An enumeration item.
+///
+/// Display: Numbered List Item
+/// Category: layout
#[node]
pub struct EnumItem {
/// The item's number.
diff --git a/library/src/layout/flow.rs b/library/src/layout/flow.rs
index ea31752b..02f34857 100644
--- a/library/src/layout/flow.rs
+++ b/library/src/layout/flow.rs
@@ -8,6 +8,9 @@ use crate::visualize::{CircleNode, EllipseNode, ImageNode, RectNode, SquareNode}
///
/// This node is responsible for layouting both the top-level content flow and
/// the contents of boxes.
+///
+/// Display: Flow
+/// Category: layout
#[node(Layout)]
pub struct FlowNode {
/// The children that will be arranges into a flow.
diff --git a/library/src/layout/list.rs b/library/src/layout/list.rs
index 0ca5ccf6..69d2e717 100644
--- a/library/src/layout/list.rs
+++ b/library/src/layout/list.rs
@@ -167,6 +167,9 @@ impl Layout for ListNode {
}
/// A bullet list item.
+///
+/// Display: Bullet List Item
+/// Category: layout
#[node]
pub struct ListItem {
/// The item's body.
diff --git a/library/src/layout/page.rs b/library/src/layout/page.rs
index 5d1d530d..3b557981 100644
--- a/library/src/layout/page.rs
+++ b/library/src/layout/page.rs
@@ -12,11 +12,6 @@ use crate::prelude::*;
/// Pages can be set to use `{auto}` as their width or height. In this case,
/// the pages will grow to fit their content on the respective axis.
///
-/// ## Parameters
-/// - paper: `Paper` (positional, settable)
-/// A standard paper size to set width and height. When this is not specified,
-/// Typst defaults to `{"a4"}` paper.
-///
/// ## Example
/// ```example
/// >>> #set page(margin: auto)
@@ -25,6 +20,11 @@ use crate::prelude::*;
/// There you go, US friends!
/// ```
///
+/// ## Parameters
+/// - paper: `Paper` (positional, settable)
+/// A standard paper size to set width and height. When this is not specified,
+/// Typst defaults to `{"a4"}` paper.
+///
/// Display: Page
/// Category: layout
#[node]
diff --git a/library/src/layout/par.rs b/library/src/layout/par.rs
index 1b554d62..a55b2dc3 100644
--- a/library/src/layout/par.rs
+++ b/library/src/layout/par.rs
@@ -45,6 +45,7 @@ use crate::text::{
pub struct ParNode {
/// The paragraph's children.
#[variadic]
+ #[skip]
pub children: Vec<Content>,
/// The indent the first line of a consecutive paragraph should have.
diff --git a/library/src/layout/spacing.rs b/library/src/layout/spacing.rs
index 94517ad5..9f552730 100644
--- a/library/src/layout/spacing.rs
+++ b/library/src/layout/spacing.rs
@@ -86,9 +86,6 @@ impl Behave for HNode {
/// ```
///
/// ## Parameters
-/// - amount: `Spacing` (positional, required)
-/// How much spacing to insert.
-///
/// - weak: `bool` (named)
/// If true, the spacing collapses at the start or end of a flow. Moreover,
/// from multiple adjacent weak spacings all but the largest one collapse.
@@ -108,7 +105,7 @@ impl Behave for HNode {
/// Category: layout
#[node(Construct, Behave)]
pub struct VNode {
- /// The amount of vertical spacing.
+ /// How much spacing to insert.
#[positional]
#[required]
pub amount: Spacing,
diff --git a/library/src/layout/terms.rs b/library/src/layout/terms.rs
index 33b59d4d..e8adfdda 100644
--- a/library/src/layout/terms.rs
+++ b/library/src/layout/terms.rs
@@ -127,6 +127,9 @@ impl Layout for TermsNode {
}
/// A term list item.
+///
+/// Display: Term List Item
+/// Category: layout
#[node]
pub struct TermItem {
/// The term described by the list item.
diff --git a/library/src/layout/transform.rs b/library/src/layout/transform.rs
index 2ab9e5e0..b71cfa9f 100644
--- a/library/src/layout/transform.rs
+++ b/library/src/layout/transform.rs
@@ -79,12 +79,11 @@ pub struct RotateNode {
/// The amount of rotation.
///
/// ```example
- /// #rotate(angle: -1.571rad)[Space!]
+ /// #rotate(-1.571rad)[Space!]
/// ```
///
- #[named]
- #[shorthand]
- #[default]
+ #[positional]
+ #[required]
pub angle: Angle,
/// The content to rotate.
@@ -104,9 +103,9 @@ pub struct RotateNode {
/// #let square = square.with(width: 8pt)
///
/// #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()))
+ /// #box(rotate(30deg, origin: center, square()))
+ /// #box(rotate(30deg, origin: top + left, square()))
+ /// #box(rotate(30deg, origin: bottom + right, square()))
/// ```
#[settable]
#[resolve]
diff --git a/library/src/math/delimited.rs b/library/src/math/delimited.rs
index b0126cad..63cb916c 100644
--- a/library/src/math/delimited.rs
+++ b/library/src/math/delimited.rs
@@ -14,15 +14,6 @@ pub(super) const DELIM_SHORT_FALL: Em = Em::new(0.1);
/// $ lr(]sum_(x=1)^n] x, size: #50%) $
/// ```
///
-/// ## Parameters
-/// - body: `Content` (positional, variadic)
-/// The delimited content, including the delimiters.
-///
-/// - size: `Rel<Length>` (named)
-/// The size of the brackets, relative to the height of the wrapped content.
-///
-/// Defaults to `{100%}`.
-///
/// Display: Left/Right
/// Category: math
#[node(Construct, LayoutMath)]
@@ -32,7 +23,9 @@ pub struct LrNode {
#[required]
pub body: Content,
- /// The size of the brackets.
+ /// The size of the brackets, relative to the height of the wrapped content.
+ ///
+ /// Defaults to `{100%}`.
#[named]
#[default]
pub size: Smart<Rel<Length>>,
diff --git a/library/src/math/mod.rs b/library/src/math/mod.rs
index 9da12e4f..d719cb1a 100644
--- a/library/src/math/mod.rs
+++ b/library/src/math/mod.rs
@@ -41,8 +41,7 @@ use self::spacing::*;
use crate::layout::{HNode, ParNode, Spacing};
use crate::prelude::*;
use crate::text::{
- families, variant, FallbackList, FontFamily, LinebreakNode, SpaceNode, TextNode,
- TextSize,
+ families, variant, FontFamily, FontList, LinebreakNode, SpaceNode, TextNode, TextSize,
};
/// Create a module with all math definitions.
@@ -113,7 +112,7 @@ pub fn module() -> Module {
///
/// ## Example
/// ```example
-/// #set text("New Computer Modern")
+/// #set text(font: "New Computer Modern")
///
/// Let $a$, $b$, and $c$ be the side
/// lengths of right-angled triangle.
@@ -161,8 +160,8 @@ impl Finalize for FormulaNode {
realized
.styled(TextNode::WEIGHT, FontWeight::from_number(450))
.styled(
- TextNode::FAMILY,
- FallbackList(vec![FontFamily::new("New Computer Modern Math")]),
+ TextNode::FONT,
+ FontList(vec![FontFamily::new("New Computer Modern Math")]),
)
}
}
@@ -233,7 +232,7 @@ impl LayoutMath for Content {
if let Some(styled) = self.to::<StyledNode>() {
let map = styled.map();
- if map.contains(TextNode::FAMILY) {
+ if map.contains(TextNode::FONT) {
let frame = ctx.layout_content(self)?;
ctx.push(FrameFragment::new(ctx, frame).with_spaced(true));
return Ok(());
diff --git a/library/src/math/style.rs b/library/src/math/style.rs
index 99365106..43c1f391 100644
--- a/library/src/math/style.rs
+++ b/library/src/math/style.rs
@@ -183,7 +183,7 @@ impl LayoutMath for FrakNode {
/// $ mono(x + y = z) $
/// ```
///
-/// Display: Monospace
+/// Display: Monospace
/// Category: math
#[node(LayoutMath)]
pub struct MonoNode {
diff --git a/library/src/meta/link.rs b/library/src/meta/link.rs
index 63a8ec98..4f07aaee 100644
--- a/library/src/meta/link.rs
+++ b/library/src/meta/link.rs
@@ -23,42 +23,38 @@ use crate::text::{Hyphenate, TextNode};
/// This function also has dedicated syntax: Text that starts with `http://` or
/// `https://` is automatically turned into a link.
///
-/// ## Parameters
-/// - dest: `Destination` (positional, required)
-/// The destination the link points to.
-///
-/// - To link to web pages, `dest` should be a valid URL string. If the URL is
-/// in the `mailto:` or `tel:` scheme and the `body` parameter is omitted,
-/// the email address or phone number will be the link's body, without the
-/// scheme.
-///
-/// - To link to another part of the document, `dest` must contain a
-/// dictionary with a `page` key of type `integer` and `x` and `y`
-/// coordinates of type `length`. Pages are counted from one, and the
-/// coordinates are relative to the page's top left corner.
-///
-/// ```example
-/// #link("mailto:hello@typst.app") \
-/// #link((page: 1, x: 0pt, y: 0pt))[
-/// Go to top
-/// ]
-/// ```
-///
-/// - body: `Content` (positional)
-///
-/// The content that should become a link. If `dest` is an URL string, the
-/// parameter can be omitted. In this case, the URL will be shown as the link.
-///
/// Display: Link
/// Category: meta
#[node(Construct, Show, Finalize)]
pub struct LinkNode {
/// The destination the link points to.
+ ///
+ /// - To link to web pages, `dest` should be a valid URL string. If the URL is
+ /// in the `mailto:` or `tel:` scheme and the `body` parameter is omitted,
+ /// the email address or phone number will be the link's body, without the
+ /// scheme.
+ ///
+ /// - To link to another part of the document, `dest` must contain a
+ /// dictionary with a `page` key of type `integer` and `x` and `y`
+ /// coordinates of type `length`. Pages are counted from one, and the
+ /// coordinates are relative to the page's top left corner.
+ ///
+ /// ```example
+ /// #link("mailto:hello@typst.app") \
+ /// #link((page: 1, x: 0pt, y: 0pt))[
+ /// Go to top
+ /// ]
+ /// ```
+ ///
#[positional]
#[required]
pub dest: Destination,
/// How the link is represented.
+ ///
+ /// The content that should become a link. If `dest` is an URL string, the
+ /// parameter can be omitted. In this case, the URL will be shown as the
+ /// link.
#[positional]
#[default]
pub body: Content,
diff --git a/library/src/shared/ext.rs b/library/src/shared/ext.rs
index 83e62ac4..f797e135 100644
--- a/library/src/shared/ext.rs
+++ b/library/src/shared/ext.rs
@@ -74,10 +74,10 @@ pub trait StyleMapExt {
impl StyleMapExt for StyleMap {
fn set_family(&mut self, preferred: crate::text::FontFamily, existing: StyleChain) {
self.set(
- crate::text::TextNode::FAMILY,
- crate::text::FallbackList(
+ crate::text::TextNode::FONT,
+ crate::text::FontList(
std::iter::once(preferred)
- .chain(existing.get(crate::text::TextNode::FAMILY).0.iter().cloned())
+ .chain(existing.get(crate::text::TextNode::FONT).0.iter().cloned())
.collect(),
),
);
diff --git a/library/src/text/deco.rs b/library/src/text/deco.rs
index 18145d28..d47b336b 100644
--- a/library/src/text/deco.rs
+++ b/library/src/text/deco.rs
@@ -31,7 +31,6 @@ pub struct UnderlineNode {
/// )
/// ```
#[settable]
- #[shorthand]
#[resolve]
#[fold]
#[default]
@@ -117,7 +116,6 @@ pub struct OverlineNode {
/// )
/// ```
#[settable]
- #[shorthand]
#[resolve]
#[fold]
#[default]
@@ -207,7 +205,6 @@ pub struct StrikeNode {
/// This is #strike(stroke: 10pt)[redacted].
/// ```
#[settable]
- #[shorthand]
#[resolve]
#[fold]
#[default]
@@ -219,7 +216,7 @@ pub struct StrikeNode {
/// This is useful if you are unhappy with the offset your font provides.
///
/// ```example
- /// #set text(family: "Inria Serif")
+ /// #set text(font: "Inria Serif")
/// This is #strike(offset: auto)[low-ish]. \
/// This is #strike(offset: -3.5pt)[on-top].
/// ```
diff --git a/library/src/text/mod.rs b/library/src/text/mod.rs
index cde0163e..329ff6a9 100644
--- a/library/src/text/mod.rs
+++ b/library/src/text/mod.rs
@@ -39,60 +39,12 @@ use crate::prelude::*;
/// ```
///
/// ## Parameters
-/// - family: `FallbackList` (positional, named, variadic, settable)
-/// A prioritized sequence of font families.
-///
-/// When processing text, Typst tries all specified font families in order
-/// until it finds a font that has the necessary glyphs. In the example below,
-/// the font `Inria Serif` is preferred, but since it does not contain Arabic
-/// glyphs, the arabic text uses `Noto Sans Arabic` instead.
-///
-/// ```example
-/// #set text(
-/// "Inria Serif",
-/// "Noto Sans Arabic",
-/// )
-///
-/// This is Latin. \
-/// هذا عربي.
-///
-/// ```
-///
/// - body: `Content` (positional, required)
/// Content in which all text is styled according to the other arguments.
///
/// Display: Text
/// Category: text
#[node(Construct)]
-#[set({
- if let Some(family) = args.named("family")? {
- styles.set(Self::FAMILY, family);
- } else {
- let mut count = 0;
- let mut content = false;
- for item in args.items.iter().filter(|item| item.name.is_none()) {
- if EcoString::is(&item.value) {
- count += 1;
- } else if <Content as Cast<Spanned<Value>>>::is(&item.value) {
- content = true;
- }
- }
-
- // Skip the final string if it's needed as the body.
- if constructor && !content && count > 0 {
- count -= 1;
- }
-
- if count > 0 {
- let mut list = Vec::with_capacity(count);
- for _ in 0..count {
- list.push(args.find()?.unwrap());
- }
-
- styles.set(Self::FAMILY, FallbackList(list));
- }
- }
-})]
pub struct TextNode {
/// The text.
#[positional]
@@ -101,10 +53,25 @@ pub struct TextNode {
pub text: EcoString,
/// A prioritized sequence of font families.
+ ///
+ /// When processing text, Typst tries all specified font families in order
+ /// until it finds a font that has the necessary glyphs. In the example
+ /// below, the font `Inria Serif` is preferred, but since it does not
+ /// contain Arabic glyphs, the arabic text uses `Noto Sans Arabic` instead.
+ ///
+ /// ```example
+ /// #set text(font: (
+ /// "Inria Serif",
+ /// "Noto Sans Arabic",
+ /// ))
+ ///
+ /// This is Latin. \
+ /// هذا عربي.
+ ///
+ /// ```
#[settable]
- #[skip]
- #[default(FallbackList(vec![FontFamily::new("Linux Libertine")]))]
- pub family: FallbackList,
+ #[default(FontList(vec![FontFamily::new("Linux Libertine")]))]
+ pub font: FontList,
/// Whether to allow last resort font fallback when the primary font list
/// contains no match. This lets Typst search through all available fonts
@@ -117,7 +84,7 @@ pub struct TextNode {
/// something is up.
///
/// ```example
- /// #set text(family: "Inria Serif")
+ /// #set text(font: "Inria Serif")
/// هذا عربي
///
/// #set text(fallback: false)
@@ -141,8 +108,8 @@ pub struct TextNode {
/// style later if you change your mind about how to signify the emphasis.
///
/// ```example
- /// #text("Linux Libertine", style: "italic")[Italic]
- /// #text("DejaVu Sans", style: "oblique")[Oblique]
+ /// #text(font: "Linux Libertine", style: "italic")[Italic]
+ /// #text(font: "DejaVu Sans", style: "oblique")[Oblique]
/// ```
#[settable]
#[default(FontStyle::Normal)]
@@ -460,7 +427,7 @@ pub struct TextNode {
/// default numbers for the font are used.
///
/// ```example
- /// #set text(20pt, "Noto Sans")
+ /// #set text(font: "Noto Sans", 20pt)
/// #set text(number-type: "lining")
/// Number 9.
///
@@ -475,7 +442,7 @@ pub struct TextNode {
/// numbers for the font are used.
///
/// ```example
- /// #set text(20pt, "Noto Sans")
+ /// #set text(font: "Noto Sans", 20pt)
/// #set text(number-width: "proportional")
/// A 12 B 34. \
/// A 56 B 78.
@@ -609,16 +576,16 @@ cast_to_value! {
/// Font family fallback list.
#[derive(Debug, Default, Clone, Eq, PartialEq, Hash)]
-pub struct FallbackList(pub Vec<FontFamily>);
+pub struct FontList(pub Vec<FontFamily>);
cast_from_value! {
- FallbackList,
+ FontList,
family: FontFamily => Self(vec![family]),
values: Array => Self(values.into_iter().map(|v| v.cast()).collect::<StrResult<_>>()?),
}
cast_to_value! {
- v: FallbackList => v.0.into()
+ v: FontList => v.0.into()
}
/// The size of text.
diff --git a/library/src/text/raw.rs b/library/src/text/raw.rs
index cdaefd06..8c40c6ea 100644
--- a/library/src/text/raw.rs
+++ b/library/src/text/raw.rs
@@ -3,8 +3,7 @@ use syntect::highlighting as synt;
use typst::syntax::{self, LinkedNode};
use super::{
- FallbackList, FontFamily, Hyphenate, LinebreakNode, SmartQuoteNode, TextNode,
- TextSize,
+ FontFamily, FontList, Hyphenate, LinebreakNode, SmartQuoteNode, TextNode, TextSize,
};
use crate::layout::BlockNode;
use crate::prelude::*;
@@ -185,10 +184,7 @@ impl Finalize for RawNode {
map.set(TextNode::OVERHANG, false);
map.set(TextNode::HYPHENATE, Hyphenate(Smart::Custom(false)));
map.set(TextNode::SIZE, TextSize(Em::new(0.8).into()));
- map.set(
- TextNode::FAMILY,
- FallbackList(vec![FontFamily::new("DejaVu Sans Mono")]),
- );
+ map.set(TextNode::FONT, FontList(vec![FontFamily::new("DejaVu Sans Mono")]));
map.set(SmartQuoteNode::ENABLED, false);
realized.styled_with_map(map)
}
diff --git a/library/src/text/shaping.rs b/library/src/text/shaping.rs
index 709cce25..e1b12120 100644
--- a/library/src/text/shaping.rs
+++ b/library/src/text/shaping.rs
@@ -560,7 +560,7 @@ pub fn families(styles: StyleChain) -> impl Iterator<Item = FontFamily> + Clone
let tail = if styles.get(TextNode::FALLBACK) { FALLBACKS } else { &[] };
styles
- .get(TextNode::FAMILY)
+ .get(TextNode::FONT)
.0
.into_iter()
.chain(tail.iter().copied().map(FontFamily::new))
diff --git a/library/src/text/shift.rs b/library/src/text/shift.rs
index 105953b6..c44cc3b0 100644
--- a/library/src/text/shift.rs
+++ b/library/src/text/shift.rs
@@ -174,7 +174,7 @@ fn search_text(content: &Content, sub: bool) -> Option<EcoString> {
/// given string.
fn is_shapable(vt: &Vt, text: &str, styles: StyleChain) -> bool {
let world = vt.world();
- for family in styles.get(TextNode::FAMILY).0.iter() {
+ for family in styles.get(TextNode::FONT).0.iter() {
if let Some(font) = world
.book()
.select(family.as_str(), variant(styles))
diff --git a/library/src/visualize/line.rs b/library/src/visualize/line.rs
index 0e0a272f..6fc7fc19 100644
--- a/library/src/visualize/line.rs
+++ b/library/src/visualize/line.rs
@@ -10,10 +10,6 @@ use crate::prelude::*;
/// ```
///
/// ## Parameters
-/// - start: `Axes<Rel<Length>>` (named)
-/// The start point of the line.
-/// Must be an array of exactly two relative lengths.
-///
/// - end: `Axes<Rel<Length>>` (named)
/// The end point of the line.
/// Must be an array of exactly two relative lengths.
@@ -29,7 +25,9 @@ use crate::prelude::*;
/// Category: visualize
#[node(Construct, Layout)]
pub struct LineNode {
- /// Where the line starts.
+ /// The start point of the line.
+ ///
+ /// Must be an array of exactly two relative lengths.
#[named]
#[default]
pub start: Axes<Rel<Length>>,
@@ -37,6 +35,7 @@ pub struct LineNode {
/// The offset from `start` where the line ends.
#[named]
#[default]
+ #[skip]
pub delta: Axes<Rel<Length>>,
/// How to stroke the line. This can be:
diff --git a/library/src/visualize/shape.rs b/library/src/visualize/shape.rs
index ef81a871..b3b9364f 100644
--- a/library/src/visualize/shape.rs
+++ b/library/src/visualize/shape.rs
@@ -190,6 +190,11 @@ impl Layout for RectNode {
/// ]
/// ```
///
+/// ## Parameters
+/// - size: `Smart<Length>` (named)
+/// The square's side length. This is mutually exclusive with `width` and
+/// `height`.
+///
/// Display: Square
/// Category: visualize
#[node(Construct, Layout)]
@@ -414,26 +419,10 @@ impl Layout for EllipseNode {
/// ```
///
/// ## Parameters
-/// - body: `Content` (positional)
-/// The content to place into the circle. The circle expands to fit this
-/// content, keeping the 1-1 aspect ratio.
-///
/// - radius: `Length` (named)
/// The circle's radius. This is mutually exclusive with `width` and
/// `height`.
///
-/// - width: `Rel<Length>` (named)
-/// The circle's width. This is mutually exclusive with `radius` and `height`.
-///
-/// In contrast to `size`, this can be relative to the parent container's
-/// width.
-///
-/// - height: `Rel<Length>` (named)
-/// The circle's height.This is mutually exclusive with `radius` and `width`.
-///
-/// In contrast to `size`, this can be relative to the parent container's
-/// height.
-///
/// Display: Circle
/// Category: visualize
#[node(Construct, Layout)]