Use third person in documentation (#1560)

This commit is contained in:
MALO 2023-06-24 14:33:17 +02:00 committed by GitHub
parent 48c25f4da0
commit b96b7b7ee1
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
36 changed files with 182 additions and 185 deletions

View File

@ -51,7 +51,7 @@ pub fn module() -> Module {
Module::new("calc").with_scope(scope) Module::new("calc").with_scope(scope)
} }
/// Calculate the absolute value of a numeric value. /// Calculates the absolute value of a numeric value.
/// ///
/// ## Example { #example } /// ## Example { #example }
/// ```example /// ```example
@ -84,7 +84,7 @@ cast! {
v: Fr => Self(Value::Fraction(v.abs())), v: Fr => Self(Value::Fraction(v.abs())),
} }
/// Raise a value to some exponent. /// Raises a value to some exponent.
/// ///
/// ## Example { #example } /// ## Example { #example }
/// ```example /// ```example
@ -139,7 +139,7 @@ pub fn pow(
Ok(result) Ok(result)
} }
/// Raise a value to some exponent of e. /// Raises a value to some exponent of e.
/// ///
/// ## Example { #example } /// ## Example { #example }
/// ```example /// ```example
@ -173,7 +173,7 @@ pub fn exp(
Ok(result) Ok(result)
} }
/// Calculate the square root of a number. /// Extracts the square root of a number.
/// ///
/// ## Example { #example } /// ## Example { #example }
/// ```example /// ```example
@ -194,7 +194,7 @@ pub fn sqrt(
Ok(value.v.float().sqrt()) Ok(value.v.float().sqrt())
} }
/// Calculate the sine of an angle. /// Calculates the sine of an angle.
/// ///
/// When called with an integer or a float, they will be interpreted as /// When called with an integer or a float, they will be interpreted as
/// radians. /// radians.
@ -220,7 +220,7 @@ pub fn sin(
} }
} }
/// Calculate the cosine of an angle. /// Calculates the cosine of an angle.
/// ///
/// When called with an integer or a float, they will be interpreted as /// When called with an integer or a float, they will be interpreted as
/// radians. /// radians.
@ -246,7 +246,7 @@ pub fn cos(
} }
} }
/// Calculate the tangent of an angle. /// Calculates the tangent of an angle.
/// ///
/// When called with an integer or a float, they will be interpreted as /// When called with an integer or a float, they will be interpreted as
/// radians. /// radians.
@ -271,7 +271,7 @@ pub fn tan(
} }
} }
/// Calculate the arcsine of a number. /// Calculates the arcsine of a number.
/// ///
/// ## Example { #example } /// ## Example { #example }
/// ```example /// ```example
@ -293,7 +293,7 @@ pub fn asin(
Ok(Angle::rad(val.asin())) Ok(Angle::rad(val.asin()))
} }
/// Calculate the arccosine of a number. /// Calculates the arccosine of a number.
/// ///
/// ## Example { #example } /// ## Example { #example }
/// ```example /// ```example
@ -315,7 +315,7 @@ pub fn acos(
Ok(Angle::rad(val.acos())) Ok(Angle::rad(val.acos()))
} }
/// Calculate the arctangent of a number. /// Calculates the arctangent of a number.
/// ///
/// ## Example { #example } /// ## Example { #example }
/// ```example /// ```example
@ -333,7 +333,7 @@ pub fn atan(
Angle::rad(value.float().atan()) Angle::rad(value.float().atan())
} }
/// Calculate the four-quadrant arctangent of a coordinate. /// Calculates the four-quadrant arctangent of a coordinate.
/// ///
/// The arguments are `(x, y)`, not `(y, x)`. /// The arguments are `(x, y)`, not `(y, x)`.
/// ///
@ -355,7 +355,7 @@ pub fn atan2(
Angle::rad(f64::atan2(y.float(), x.float())) Angle::rad(f64::atan2(y.float(), x.float()))
} }
/// Calculate the hyperbolic sine of an angle. /// Calculates the hyperbolic sine of an angle.
/// ///
/// When called with an integer or a float, they will be interpreted as radians. /// When called with an integer or a float, they will be interpreted as radians.
/// ///
@ -379,7 +379,7 @@ pub fn sinh(
} }
} }
/// Calculate the hyperbolic cosine of an angle. /// Calculates the hyperbolic cosine of an angle.
/// ///
/// When called with an integer or a float, they will be interpreted as radians. /// When called with an integer or a float, they will be interpreted as radians.
/// ///
@ -403,7 +403,7 @@ pub fn cosh(
} }
} }
/// Calculate the hyperbolic tangent of an angle. /// Calculates the hyperbolic tangent of an angle.
/// ///
/// When called with an integer or a float, they will be interpreted as radians. /// When called with an integer or a float, they will be interpreted as radians.
/// ///
@ -427,7 +427,7 @@ pub fn tanh(
} }
} }
/// Calculate the logarithm of a number. /// Calculates the logarithm of a number.
/// ///
/// If the base is not specified, the logarithm is calculated in base 10. /// If the base is not specified, the logarithm is calculated in base 10.
/// ///
@ -475,7 +475,7 @@ pub fn log(
Ok(result) Ok(result)
} }
/// Calculate the natural logarithm of a number. /// Calculates the natural logarithm of a number.
/// ///
/// ## Example { #example } /// ## Example { #example }
/// ```example /// ```example
@ -504,7 +504,7 @@ pub fn ln(
Ok(result) Ok(result)
} }
/// Calculate the factorial of a number. /// Calculates the factorial of a number.
/// ///
/// ## Example { #example } /// ## Example { #example }
/// ```example /// ```example
@ -521,7 +521,7 @@ pub fn fact(
Ok(fact_impl(1, number).ok_or("the result is too large")?) Ok(fact_impl(1, number).ok_or("the result is too large")?)
} }
/// Calculate a permutation. /// Calculates a permutation.
/// ///
/// ## Example { #example } /// ## Example { #example }
/// ```example /// ```example
@ -562,7 +562,7 @@ fn fact_impl(start: u64, end: u64) -> Option<i64> {
count.try_into().ok() count.try_into().ok()
} }
/// Calculate a binomial coefficient. /// Calculates a binomial coefficient.
/// ///
/// ## Example { #example } /// ## Example { #example }
/// ```example /// ```example
@ -603,7 +603,7 @@ fn binom_impl(n: u64, k: u64) -> Option<i64> {
result.try_into().ok() result.try_into().ok()
} }
/// Calculate the greatest common divisor of two integers. /// Calculates the greatest common divisor of two integers.
/// ///
/// ## Example { #example } /// ## Example { #example }
/// ```example /// ```example
@ -629,7 +629,7 @@ pub fn gcd(
a.abs() a.abs()
} }
/// Calculate the least common multiple of two integers. /// Calculates the least common multiple of two integers.
/// ///
/// ## Example { #example } /// ## Example { #example }
/// ```example /// ```example
@ -655,7 +655,7 @@ pub fn lcm(
.ok_or("the return value is too large")?) .ok_or("the return value is too large")?)
} }
/// Round a number down to the nearest integer. /// Rounds a number down to the nearest integer.
/// ///
/// If the number is already an integer, it is returned unchanged. /// If the number is already an integer, it is returned unchanged.
/// ///
@ -679,7 +679,7 @@ pub fn floor(
} }
} }
/// Round a number up to the nearest integer. /// Rounds a number up to the nearest integer.
/// ///
/// If the number is already an integer, it is returned unchanged. /// If the number is already an integer, it is returned unchanged.
/// ///
@ -729,7 +729,7 @@ pub fn trunc(
/// Returns the fractional part of a number. /// Returns the fractional part of a number.
/// ///
/// If the number is an integer, it returns `0`. /// If the number is an integer, returns `0`.
/// ///
/// ## Example { #example } /// ## Example { #example }
/// ```example /// ```example
@ -750,7 +750,7 @@ pub fn fract(
} }
} }
/// Round a number to the nearest integer. /// Rounds a number to the nearest integer.
/// ///
/// Optionally, a number of decimal places can be specified. /// Optionally, a number of decimal places can be specified.
/// ///
@ -782,7 +782,7 @@ pub fn round(
} }
} }
/// Clamp a number between a minimum and maximum value. /// Clamps a number between a minimum and maximum value.
/// ///
/// ## Example { #example } /// ## Example { #example }
/// ```example /// ```example
@ -808,7 +808,7 @@ pub fn clamp(
Ok(value.apply3(min, max.v, i64::clamp, f64::clamp)) Ok(value.apply3(min, max.v, i64::clamp, f64::clamp))
} }
/// Determine the minimum of a sequence of values. /// Determines the minimum of a sequence of values.
/// ///
/// ## Example { #example } /// ## Example { #example }
/// ```example /// ```example
@ -830,7 +830,7 @@ pub fn min(
minmax(span, values, Ordering::Less) minmax(span, values, Ordering::Less)
} }
/// Determine the maximum of a sequence of values. /// Determines the maximum of a sequence of values.
/// ///
/// ## Example { #example } /// ## Example { #example }
/// ```example /// ```example
@ -873,7 +873,7 @@ fn minmax(
Ok(extremum) Ok(extremum)
} }
/// Determine whether an integer is even. /// Determines whether an integer is even.
/// ///
/// ## Example { #example } /// ## Example { #example }
/// ```example /// ```example
@ -892,7 +892,7 @@ pub fn even(
value % 2 == 0 value % 2 == 0
} }
/// Determine whether an integer is odd. /// Determines whether an integer is odd.
/// ///
/// ## Example { #example } /// ## Example { #example }
/// ```example /// ```example
@ -911,7 +911,7 @@ pub fn odd(
value % 2 != 0 value % 2 != 0
} }
/// Calculate the remainder of two numbers. /// Calculates the remainder of two numbers.
/// ///
/// ## Example { #example } /// ## Example { #example }
/// ```example /// ```example
@ -934,7 +934,7 @@ pub fn rem(
Ok(dividend.apply2(divisor.v, Rem::rem, Rem::rem)) Ok(dividend.apply2(divisor.v, Rem::rem, Rem::rem))
} }
/// Calculate the quotient of two numbers. /// Calculates the quotient of two numbers.
/// ///
/// ## Example { #example } /// ## Example { #example }
/// ```example /// ```example

View File

@ -7,7 +7,7 @@ use typst::eval::{Datetime, Regex};
use crate::prelude::*; use crate::prelude::*;
/// Convert a value to an integer. /// Converts a value to an integer.
/// ///
/// - Booleans are converted to `0` or `1`. /// - Booleans are converted to `0` or `1`.
/// - Floats are floored to the next 64-bit integer. /// - Floats are floored to the next 64-bit integer.
@ -42,7 +42,7 @@ cast! {
v: EcoString => Self(v.parse().map_err(|_| eco_format!("invalid integer: {}", v))?), v: EcoString => Self(v.parse().map_err(|_| eco_format!("invalid integer: {}", v))?),
} }
/// Convert a value to a float. /// Converts a value to a float.
/// ///
/// - Booleans are converted to `0.0` or `1.0`. /// - Booleans are converted to `0.0` or `1.0`.
/// - Integers are converted to the closest 64-bit float. /// - Integers are converted to the closest 64-bit float.
@ -82,7 +82,7 @@ cast! {
v: EcoString => Self(v.parse().map_err(|_| eco_format!("invalid float: {}", v))?), v: EcoString => Self(v.parse().map_err(|_| eco_format!("invalid float: {}", v))?),
} }
/// Create a grayscale color. /// Creates a grayscale color.
/// ///
/// ## Example { #example } /// ## Example { #example }
/// ```example /// ```example
@ -101,7 +101,7 @@ pub fn luma(
LumaColor::new(gray.0).into() LumaColor::new(gray.0).into()
} }
/// Create an RGB(A) color. /// Creates an RGB(A) color.
/// ///
/// The color is specified in the sRGB color space. /// The color is specified in the sRGB color space.
/// ///
@ -180,7 +180,7 @@ cast! {
}, },
} }
/// Create a new datetime. /// Creates a new datetime.
/// ///
/// You can specify the [datetime]($type/datetime) using a year, month, day, /// You can specify the [datetime]($type/datetime) using a year, month, day,
/// hour, minute, and second. You can also get the current date with /// hour, minute, and second. You can also get the current date with
@ -338,7 +338,7 @@ pub fn datetime_today(
.ok_or("unable to get the current date")?) .ok_or("unable to get the current date")?)
} }
/// Create a CMYK color. /// Creates a CMYK color.
/// ///
/// This is useful if you want to target a specific printer. The conversion /// This is useful if you want to target a specific printer. The conversion
/// to RGB for display preview might differ from how your printer reproduces /// to RGB for display preview might differ from how your printer reproduces
@ -379,7 +379,7 @@ cast! {
}, },
} }
/// Create a custom symbol with modifiers. /// Creates a custom symbol with modifiers.
/// ///
/// ## Example { #example } /// ## Example { #example }
/// ```example /// ```example
@ -442,7 +442,7 @@ cast! {
}, },
} }
/// Convert a value to a string. /// Converts a value to a string.
/// ///
/// - Integers are formatted in base 10. This can be overridden with the /// - Integers are formatted in base 10. This can be overridden with the
/// optional `base` parameter. /// optional `base` parameter.
@ -567,7 +567,7 @@ pub fn str_to_unicode(
value.into() value.into()
} }
/// Converts a unicode code point into its corresponding string. /// Converts a Unicode code point into its corresponding string.
/// ///
/// ```example /// ```example
/// #str.from-unicode(97) /// #str.from-unicode(97)
@ -595,7 +595,7 @@ cast! {
}, },
} }
/// Create a label from a string. /// Creates a label from a string.
/// ///
/// Inserting a label into content attaches it to the closest previous element /// Inserting a label into content attaches it to the closest previous element
/// that is not a space. Then, the element can be [referenced]($func/ref) and /// that is not a space. Then, the element can be [referenced]($func/ref) and
@ -624,14 +624,13 @@ pub fn label(
Label(name) Label(name)
} }
/// Create a regular expression from a string. /// Creates a regular expression from a string.
/// ///
/// The result can be used as a /// The result can be used as a
/// [show rule selector]($styling/#show-rules) and with /// [show rule selector]($styling/#show-rules) and with
/// [string methods]($type/string) like `find`, `split`, and `replace`. /// [string methods]($type/string) like `find`, `split`, and `replace`.
/// ///
/// [See here](https://docs.rs/regex/latest/regex/#syntax) for a specification /// See [the specification of the supported syntax](https://docs.rs/regex/latest/regex/#syntax).
/// of the supported syntax.
/// ///
/// ## Example { #example } /// ## Example { #example }
/// ```example /// ```example
@ -664,7 +663,7 @@ pub fn regex(
Regex::new(&regex.v).at(regex.span) Regex::new(&regex.v).at(regex.span)
} }
/// Create an array consisting of a sequence of numbers. /// Creates an array consisting of consecutive integers.
/// ///
/// If you pass just one positional parameter, it is interpreted as the `end` of /// If you pass just one positional parameter, it is interpreted as the `end` of
/// the range. If you pass two, they describe the `start` and `end` of the /// the range. If you pass two, they describe the `start` and `end` of the

View File

@ -3,7 +3,7 @@ use typst::eval::Datetime;
use crate::prelude::*; use crate::prelude::*;
/// Read plain text from a file. /// Reads plain text from a file.
/// ///
/// The file will be read and returned as a string. /// The file will be read and returned as a string.
/// ///
@ -33,7 +33,7 @@ pub fn read(
Ok(text.into()) Ok(text.into())
} }
/// Read structured data from a CSV file. /// Reads structured data from a CSV file.
/// ///
/// The CSV file will be read and parsed into a 2-dimensional array of strings: /// The CSV file will be read and parsed into a 2-dimensional array of strings:
/// Each row in the CSV file will be represented as an array of strings, and all /// Each row in the CSV file will be represented as an array of strings, and all
@ -129,7 +129,7 @@ fn format_csv_error(error: csv::Error, line: usize) -> EcoString {
} }
} }
/// Read structured data from a JSON file. /// Reads structured data from a JSON file.
/// ///
/// The file must contain a valid JSON object or array. JSON objects will be /// The file must contain a valid JSON object or array. JSON objects will be
/// converted into Typst dictionaries, and JSON arrays will be converted into /// converted into Typst dictionaries, and JSON arrays will be converted into
@ -211,7 +211,7 @@ fn format_json_error(error: serde_json::Error) -> EcoString {
eco_format!("failed to parse json file: syntax error in line {}", error.line()) eco_format!("failed to parse json file: syntax error in line {}", error.line())
} }
/// Read structured data from a TOML file. /// Reads structured data from a TOML file.
/// ///
/// The file must contain a valid TOML table. TOML tables will be /// The file must contain a valid TOML table. TOML tables will be
/// converted into Typst dictionaries, and TOML arrays will be converted into /// converted into Typst dictionaries, and TOML arrays will be converted into
@ -304,7 +304,7 @@ fn format_toml_error(error: toml::de::Error) -> EcoString {
} }
} }
/// Read structured data from a YAML file. /// Reads structured data from a YAML file.
/// ///
/// The file must contain a valid YAML object or array. YAML mappings will be /// The file must contain a valid YAML object or array. YAML mappings will be
/// converted into Typst dictionaries, and YAML sequences will be converted into /// converted into Typst dictionaries, and YAML sequences will be converted into
@ -396,7 +396,7 @@ fn format_yaml_error(error: serde_yaml::Error) -> EcoString {
eco_format!("failed to parse yaml file: {}", error.to_string().trim()) eco_format!("failed to parse yaml file: {}", error.to_string().trim())
} }
/// Read structured data from an XML file. /// Reads structured data from an XML file.
/// ///
/// The XML file is parsed into an array of dictionaries and strings. XML nodes /// The XML file is parsed into an array of dictionaries and strings. XML nodes
/// can be elements or strings. Elements are represented as dictionaries with /// can be elements or strings. Elements are represented as dictionaries with

View File

@ -1,6 +1,6 @@
use crate::prelude::*; use crate::prelude::*;
/// Determine a value's type. /// Determines the type of a value.
/// ///
/// Returns the name of the value's type. /// Returns the name of the value's type.
/// ///
@ -24,7 +24,7 @@ pub fn type_(
value.type_name().into() value.type_name().into()
} }
/// The string representation of a value. /// Returns the string representation of a value.
/// ///
/// When inserted into content, most values are displayed as this representation /// When inserted into content, most values are displayed as this representation
/// in monospace with syntax-highlighting. The exceptions are `{none}`, /// in monospace with syntax-highlighting. The exceptions are `{none}`,
@ -51,7 +51,7 @@ pub fn repr(
value.repr() value.repr()
} }
/// Fail with an error. /// Fails with an error.
/// ///
/// ## Example { #example } /// ## Example { #example }
/// The code below produces the error `panicked with: "this is wrong"`. /// The code below produces the error `panicked with: "this is wrong"`.
@ -80,7 +80,7 @@ pub fn panic(
Err(msg) Err(msg)
} }
/// Ensure that a condition is fulfilled. /// Ensures that a condition is fulfilled.
/// ///
/// Fails with an error if the condition is not fulfilled. Does not /// Fails with an error if the condition is not fulfilled. Does not
/// produce any output in the document. /// produce any output in the document.
@ -118,7 +118,7 @@ pub fn assert(
Ok(NoneValue) Ok(NoneValue)
} }
/// Ensure that two values are equal. /// Ensures that two values are equal.
/// ///
/// Fails with an error if the first value is not equal to the second. Does not /// Fails with an error if the first value is not equal to the second. Does not
/// produce any output in the document. /// produce any output in the document.
@ -153,7 +153,7 @@ pub fn assert_eq(
Ok(NoneValue) Ok(NoneValue)
} }
/// Ensure that two values are not equal. /// Ensures that two values are not equal.
/// ///
/// Fails with an error if the first value is equal to the second. Does not /// Fails with an error if the first value is equal to the second. Does not
/// produce any output in the document. /// produce any output in the document.
@ -188,7 +188,7 @@ pub fn assert_ne(
Ok(NoneValue) Ok(NoneValue)
} }
/// Evaluate a string as Typst code. /// Evaluates a string as Typst code.
/// ///
/// This function should only be used as a last resort. /// This function should only be used as a last resort.
/// ///

View File

@ -1,6 +1,6 @@
use crate::prelude::*; use crate::prelude::*;
/// Align content horizontally and vertically. /// Aligns content horizontally and vertically.
/// ///
/// ## Example { #example } /// ## Example { #example }
/// ```example /// ```example

View File

@ -1,7 +1,7 @@
use crate::prelude::*; use crate::prelude::*;
use crate::text::TextElem; use crate::text::TextElem;
/// Separate a region into multiple equally sized columns. /// Separates a region into multiple equally sized columns.
/// ///
/// The `column` function allows to separate the interior of any container into /// The `column` function allows to separate the interior of any container into
/// multiple columns. It will not equalize the height of the columns, instead, /// multiple columns. It will not equalize the height of the columns, instead,
@ -127,7 +127,7 @@ impl Layout for ColumnsElem {
} }
} }
/// A forced column break. /// Forces a column break.
/// ///
/// The function will behave like a [page break]($func/pagebreak) when used in a /// The function will behave like a [page break]($func/pagebreak) when used in a
/// single column layout or the last column on a page. Otherwise, content after /// single column layout or the last column on a page. Otherwise, content after

View File

@ -169,7 +169,7 @@ impl Layout for BoxElem {
/// A block-level container. /// A block-level container.
/// ///
/// Such a container can be used to separate content, size it and give it a /// Such a container can be used to separate content, size it, and give it a
/// background or border. /// background or border.
/// ///
/// ## Examples { #examples } /// ## Examples { #examples }
@ -214,9 +214,9 @@ pub struct BlockElem {
/// ``` /// ```
pub width: Smart<Rel<Length>>, pub width: Smart<Rel<Length>>,
/// The block's height. When the height is larger than the remaining space on /// The block's height. When the height is larger than the remaining space
/// a page and [`breakable`]($func/block.breakable) is `{true}`, the block /// on a page and [`breakable`]($func/block.breakable) is `{true}`, the
/// will continue on the next page with the remaining height. /// block will continue on the next page with the remaining height.
/// ///
/// ```example /// ```example
/// #set page(height: 80pt) /// #set page(height: 80pt)

View File

@ -10,10 +10,10 @@ use crate::visualize::{
SquareElem, SquareElem,
}; };
/// Arrange spacing, paragraphs and block-level elements into a flow. /// Arranges spacing, paragraphs and block-level elements into a flow.
/// ///
/// This element is responsible for layouting both the top-level content flow and /// This element is responsible for layouting both the top-level content flow
/// the contents of boxes. /// and the contents of boxes.
/// ///
/// Display: Flow /// Display: Flow
/// Category: layout /// Category: layout

View File

@ -3,7 +3,7 @@ use crate::text::TextElem;
use super::Sizing; use super::Sizing;
/// Arrange content in a grid. /// Arranges content in a grid.
/// ///
/// The grid element allows you to arrange content in a grid. You can define the /// The grid element allows you to arrange content in a grid. You can define the
/// number of rows and columns, as well as the size of the gutters between them. /// number of rows and columns, as well as the size of the gutters between them.
@ -63,7 +63,7 @@ use super::Sizing;
/// Category: layout /// Category: layout
#[element(Layout)] #[element(Layout)]
pub struct GridElem { pub struct GridElem {
/// Defines the column sizes. /// The column sizes.
/// ///
/// Either specify a track size array or provide an integer to create a grid /// Either specify a track size array or provide an integer to create a grid
/// with that many `{auto}`-sized columns. Note that opposed to rows and /// with that many `{auto}`-sized columns. Note that opposed to rows and
@ -71,26 +71,26 @@ pub struct GridElem {
/// column. /// column.
pub columns: TrackSizings, pub columns: TrackSizings,
/// Defines the row sizes. /// The row sizes.
/// ///
/// If there are more cells than fit the defined rows, the last row is /// If there are more cells than fit the defined rows, the last row is
/// repeated until there are no more cells. /// repeated until there are no more cells.
pub rows: TrackSizings, pub rows: TrackSizings,
/// Defines the gaps between rows & columns. /// The gaps between rows & columns.
/// ///
/// If there are more gutters than defined sizes, the last gutter is repeated. /// If there are more gutters than defined sizes, the last gutter is repeated.
#[external] #[external]
pub gutter: TrackSizings, pub gutter: TrackSizings,
/// Defines the gaps between columns. Takes precedence over `gutter`. /// The gaps between columns. Takes precedence over `gutter`.
#[parse( #[parse(
let gutter = args.named("gutter")?; let gutter = args.named("gutter")?;
args.named("column-gutter")?.or_else(|| gutter.clone()) args.named("column-gutter")?.or_else(|| gutter.clone())
)] )]
pub column_gutter: TrackSizings, pub column_gutter: TrackSizings,
/// Defines the gaps between rows. Takes precedence over `gutter`. /// The gaps between rows. Takes precedence over `gutter`.
#[parse(args.named("row-gutter")?.or_else(|| gutter.clone()))] #[parse(args.named("row-gutter")?.or_else(|| gutter.clone()))]
pub row_gutter: TrackSizings, pub row_gutter: TrackSizings,

View File

@ -1,6 +1,6 @@
use crate::prelude::*; use crate::prelude::*;
/// Hide content without affecting layout. /// Hides content without affecting layout.
/// ///
/// The `hide` function allows you to hide content while the layout still 'sees' /// The `hide` function allows you to hide content while the layout still 'sees'
/// it. This is useful to create whitespace that is exactly as large as some /// it. This is useful to create whitespace that is exactly as large as some

View File

@ -1,6 +1,6 @@
use crate::prelude::*; use crate::prelude::*;
/// Measure the layouted size of content. /// Measures the layouted size of content.
/// ///
/// The `measure` function lets you determine the layouted size of content. /// The `measure` function lets you determine the layouted size of content.
/// Note that an infinite space is assumed, therefore the measured height/width /// Note that an infinite space is assumed, therefore the measured height/width

View File

@ -1,10 +1,9 @@
use crate::prelude::*; use crate::prelude::*;
/// Add spacing around content. /// Adds spacing around content.
/// ///
/// The `pad` function adds spacing around content. The spacing can be specified /// The spacing can be specified for each side individually, or for all sides at
/// for each side individually, or for all sides at once by specifying a /// once by specifying a positional argument.
/// positional argument.
/// ///
/// ## Example { #example } /// ## Example { #example }
/// ```example /// ```example

View File

@ -18,7 +18,7 @@ use crate::text::{
SpaceElem, TextElem, SpaceElem, TextElem,
}; };
/// Arrange text, spacing and inline-level elements into a paragraph. /// Arranges text, spacing and inline-level elements into a paragraph.
/// ///
/// Although this function is primarily used in set rules to affect paragraph /// Although this function is primarily used in set rules to affect paragraph
/// properties, it can also be used to explicitly render its argument onto a /// properties, it can also be used to explicitly render its argument onto a

View File

@ -1,6 +1,6 @@
use crate::prelude::*; use crate::prelude::*;
/// Place content at an absolute position. /// Places content at an absolute position.
/// ///
/// Placed content will not affect the position of other content. Place is /// Placed content will not affect the position of other content. Place is
/// always relative to its parent container and will be in the foreground of all /// always relative to its parent container and will be in the foreground of all

View File

@ -2,7 +2,7 @@ use std::cmp::Ordering;
use crate::prelude::*; use crate::prelude::*;
/// Insert horizontal spacing into a paragraph. /// Inserts horizontal spacing into a paragraph.
/// ///
/// The spacing can be absolute, relative, or fractional. In the last case, the /// The spacing can be absolute, relative, or fractional. In the last case, the
/// remaining space on the line is distributed among all fractional spacings /// remaining space on the line is distributed among all fractional spacings
@ -27,7 +27,7 @@ pub struct HElem {
#[required] #[required]
pub amount: Spacing, pub amount: Spacing,
/// If true, the spacing collapses at the start or end of a paragraph. /// If `{true}`, the spacing collapses at the start or end of a paragraph.
/// Moreover, from multiple adjacent weak spacings all but the largest one /// Moreover, from multiple adjacent weak spacings all but the largest one
/// collapse. /// collapse.
/// ///
@ -62,7 +62,7 @@ impl Behave for HElem {
} }
} }
/// Insert vertical spacing into a flow of blocks. /// Inserts vertical spacing into a flow of blocks.
/// ///
/// The spacing can be absolute, relative, or fractional. In the last case, /// The spacing can be absolute, relative, or fractional. In the last case,
/// the remaining space on the page is distributed among all fractional spacings /// the remaining space on the page is distributed among all fractional spacings
@ -91,10 +91,10 @@ pub struct VElem {
#[required] #[required]
pub amount: Spacing, pub amount: Spacing,
/// If true, the spacing collapses at the start or end of a flow. Moreover, /// If `{true}`, the spacing collapses at the start or end of a flow.
/// from multiple adjacent weak spacings all but the largest one collapse. /// Moreover, from multiple adjacent weak spacings all but the largest one
/// Weak spacings will always collapse adjacent paragraph spacing, even if the /// collapse. Weak spacings will always collapse adjacent paragraph spacing,
/// paragraph spacing is larger. /// even if the paragraph spacing is larger.
/// ///
/// ```example /// ```example
/// The following theorem is /// The following theorem is
@ -107,7 +107,7 @@ pub struct VElem {
#[external] #[external]
pub weak: bool, pub weak: bool,
/// The elements's weakness level, see also [`Behaviour`]. /// The element's weakness level, see also [`Behaviour`].
#[internal] #[internal]
#[parse(args.named("weak")?.map(|v: bool| v as usize))] #[parse(args.named("weak")?.map(|v: bool| v as usize))]
pub weakness: usize, pub weakness: usize,

View File

@ -1,7 +1,7 @@
use super::{AlignElem, Spacing}; use super::{AlignElem, Spacing};
use crate::prelude::*; use crate::prelude::*;
/// Arrange content and spacing horizontally or vertically. /// Arranges content and spacing horizontally or vertically.
/// ///
/// The stack places a list of items along an axis, with optional spacing /// The stack places a list of items along an axis, with optional spacing
/// between each item. /// between each item.

View File

@ -39,36 +39,36 @@ use crate::prelude::*;
/// Category: layout /// Category: layout
#[element(Layout, LocalName, Figurable)] #[element(Layout, LocalName, Figurable)]
pub struct TableElem { pub struct TableElem {
/// Defines the column sizes. See the [grid documentation]($func/grid) for /// The column sizes. See the [grid documentation]($func/grid) for more
/// more information on track sizing. /// information on track sizing.
pub columns: TrackSizings, pub columns: TrackSizings,
/// Defines the row sizes. See the [grid documentation]($func/grid) for more /// The row sizes. See the [grid documentation]($func/grid) for more
/// information on track sizing. /// information on track sizing.
pub rows: TrackSizings, pub rows: TrackSizings,
/// Defines the gaps between rows & columns. See the [grid /// The gaps between rows & columns. See the [grid
/// documentation]($func/grid) for more information on gutters. /// documentation]($func/grid) for more information on gutters.
#[external] #[external]
pub gutter: TrackSizings, pub gutter: TrackSizings,
/// Defines the gaps between columns. Takes precedence over `gutter`. See /// The gaps between columns. Takes precedence over `gutter`. See the [grid
/// the [grid documentation]($func/grid) for more information on gutters. /// documentation]($func/grid) for more information on gutters.
#[parse( #[parse(
let gutter = args.named("gutter")?; let gutter = args.named("gutter")?;
args.named("column-gutter")?.or_else(|| gutter.clone()) args.named("column-gutter")?.or_else(|| gutter.clone())
)] )]
pub column_gutter: TrackSizings, pub column_gutter: TrackSizings,
/// Defines the gaps between rows. Takes precedence over `gutter`. See the /// The gaps between rows. Takes precedence over `gutter`. See the [grid
/// [grid documentation]($func/grid) for more information on gutters. /// documentation]($func/grid) for more information on gutters.
#[parse(args.named("row-gutter")?.or_else(|| gutter.clone()))] #[parse(args.named("row-gutter")?.or_else(|| gutter.clone()))]
pub row_gutter: TrackSizings, pub row_gutter: TrackSizings,
/// How to fill the cells. /// How to fill the cells.
/// ///
/// This can be a color or a function that returns a color. The function is /// This can be a color or a function that returns a color. The function is
/// passed the cell's column and row index, starting at zero. This can be /// passed the cells' column and row index, starting at zero. This can be
/// used to implement striped tables. /// used to implement striped tables.
/// ///
/// ```example /// ```example
@ -87,11 +87,11 @@ pub struct TableElem {
/// ``` /// ```
pub fill: Celled<Option<Paint>>, pub fill: Celled<Option<Paint>>,
/// How to align the cell's content. /// How to align the cells' content.
/// ///
/// This can either be a single alignment, an array of alignments /// This can either be a single alignment, an array of alignments
/// (corresponding to each column) or a function that returns an alignment. /// (corresponding to each column) or a function that returns an alignment.
/// The function is passed the cell's column and row index, starting at zero. /// The function is passed the cells' column and row index, starting at zero.
/// If set to `{auto}`, the outer alignment is used. /// If set to `{auto}`, the outer alignment is used.
/// ///
/// ```example /// ```example
@ -117,7 +117,7 @@ pub struct TableElem {
#[default(Some(PartialStroke::default()))] #[default(Some(PartialStroke::default()))]
pub stroke: Option<PartialStroke>, pub stroke: Option<PartialStroke>,
/// How much to pad the cells's content. /// How much to pad the cells' content.
#[default(Abs::pt(5.0).into())] #[default(Abs::pt(5.0).into())]
pub inset: Rel<Length>, pub inset: Rel<Length>,

View File

@ -2,11 +2,11 @@ use typst::geom::Transform;
use crate::prelude::*; use crate::prelude::*;
/// Move content without affecting layout. /// Moves content without affecting layout.
/// ///
/// The `move` function allows you to move content while the layout still 'sees' /// The `move` function allows you to move content while the layout still 'sees'
/// it at the original positions. Containers will still be sized as if the content /// it at the original positions. Containers will still be sized as if the
/// was not moved. /// content was not moved.
/// ///
/// ## Example { #example } /// ## Example { #example }
/// ```example /// ```example
@ -53,9 +53,9 @@ impl Layout for MoveElem {
} }
} }
/// Rotate content without affecting layout. /// Rotates content without affecting layout.
/// ///
/// Rotate an element by a given angle. The layout will act as if the element /// Rotates an element by a given angle. The layout will act as if the element
/// was not rotated. /// was not rotated.
/// ///
/// ## Example { #example } /// ## Example { #example }
@ -126,11 +126,9 @@ impl Layout for RotateElem {
} }
} }
/// Scale content without affecting layout. /// Scales content without affecting layout.
///
/// The `scale` function allows you to scale and mirror content without
/// affecting the layout.
/// ///
/// Lets you mirror content by specifying a negative scale on a single axis.
/// ///
/// ## Example { #example } /// ## Example { #example }
/// ```example /// ```example

View File

@ -3,7 +3,7 @@ use super::*;
/// How much the accent can be shorter than the base. /// How much the accent can be shorter than the base.
const ACCENT_SHORT_FALL: Em = Em::new(0.5); const ACCENT_SHORT_FALL: Em = Em::new(0.5);
/// Attach an accent to a base. /// Attaches an accent to a base.
/// ///
/// ## Example { #example } /// ## Example { #example }
/// ```example /// ```example

View File

@ -84,7 +84,7 @@ impl LayoutMath for AttachElem {
} }
} }
/// Force a base to display attachments as scripts. /// Forces a base to display attachments as scripts.
/// ///
/// ## Example { #example } /// ## Example { #example }
/// ```example /// ```example
@ -110,7 +110,7 @@ impl LayoutMath for ScriptsElem {
} }
} }
/// Force a base to display attachments as limits. /// Forces a base to display attachments as limits.
/// ///
/// ## Example { #example } /// ## Example { #example }
/// ```example /// ```example

View File

@ -2,7 +2,7 @@ use super::*;
/// Displays a diagonal line over a part of an equation. /// Displays a diagonal line over a part of an equation.
/// ///
/// This is commonly used to show the eliminiation of a term. /// This is commonly used to show the elimination of a term.
/// ///
/// ## Example { #example } /// ## Example { #example }
/// ```example /// ```example
@ -53,8 +53,8 @@ pub struct CancelElem {
#[default(false)] #[default(false)]
pub cross: bool, pub cross: bool,
/// Rotate the cancel line by a certain angle. See the /// How to rotate the cancel line. See the [line's
/// [line's documentation]($func/line.angle) for more details. /// documentation]($func/line.angle) for more details.
/// ///
/// ```example /// ```example
/// >>> #set page(width: 140pt) /// >>> #set page(width: 140pt)

View File

@ -104,7 +104,7 @@ fn scale(
} }
} }
/// Floor an expression. /// Floors an expression.
/// ///
/// ## Example { #example } /// ## Example { #example }
/// ```example /// ```example
@ -121,7 +121,7 @@ pub fn floor(
delimited(body, '⌊', '⌋') delimited(body, '⌊', '⌋')
} }
/// Ceil an expression. /// Ceils an expression.
/// ///
/// ## Example { #example } /// ## Example { #example }
/// ```example /// ```example
@ -138,7 +138,7 @@ pub fn ceil(
delimited(body, '⌈', '⌉') delimited(body, '⌈', '⌉')
} }
/// Round an expression. /// Rounds an expression.
/// ///
/// ## Example { #example } /// ## Example { #example }
/// ```example /// ```example
@ -155,7 +155,7 @@ pub fn round(
delimited(body, '⌊', '⌉') delimited(body, '⌊', '⌉')
} }
/// Take the absolute value of an expression. /// Takes the absolute value of an expression.
/// ///
/// ## Example { #example } /// ## Example { #example }
/// ```example /// ```example
@ -173,7 +173,7 @@ pub fn abs(
delimited(body, '|', '|') delimited(body, '|', '|')
} }
/// Take the norm of an expression. /// Takes the norm of an expression.
/// ///
/// ## Example { #example } /// ## Example { #example }
/// ```example /// ```example

View File

@ -153,11 +153,11 @@ pub fn bb(
/// Forced display style in math. /// Forced display style in math.
/// ///
/// This is the normal size for display equations. /// This is the normal size for block equations.
/// ///
/// ## Example { #example } /// ## Example { #example }
/// ```example /// ```example
/// $sum_i x_i/2 = display(sum_i x/2)$ /// $sum_i x_i/2 = display(sum_i x_i/2)$
/// ``` /// ```
/// ///
/// Display: Display Size /// Display: Display Size

View File

@ -15,7 +15,7 @@ use crate::prelude::*;
/// ///
/// ## Methods /// ## Methods
/// ### page() /// ### page()
/// Return the page number for this location. /// Returns the page number for this location.
/// ///
/// Note that this does not return the value of the [page counter]($func/counter) /// Note that this does not return the value of the [page counter]($func/counter)
/// at this location, but the true page number (starting from one). /// at this location, but the true page number (starting from one).
@ -26,7 +26,7 @@ use crate::prelude::*;
/// - returns: integer /// - returns: integer
/// ///
/// ### position() /// ### position()
/// Return a dictionary with the page number and the x, y position for this /// Returns a dictionary with the page number and the x, y position for this
/// location. The page number starts at one and the coordinates are measured /// location. The page number starts at one and the coordinates are measured
/// from the top-left of the page. /// from the top-left of the page.
/// ///

View File

@ -11,7 +11,7 @@ use crate::layout::PageElem;
use crate::math::EquationElem; use crate::math::EquationElem;
use crate::prelude::*; use crate::prelude::*;
/// Count through pages, elements, and more. /// Counts through pages, elements, and more.
/// ///
/// With the counter function, you can access and modify counters for pages, /// With the counter function, you can access and modify counters for pages,
/// headings, figures, and more. Moreover, you can define custom counters for /// headings, figures, and more. Moreover, you can define custom counters for
@ -23,9 +23,9 @@ use crate::prelude::*;
/// on the counter. To see any output, you also have to enable heading /// on the counter. To see any output, you also have to enable heading
/// [numbering]($func/heading.numbering). /// [numbering]($func/heading.numbering).
/// ///
/// The display function optionally takes an argument telling it how to /// The `display` method optionally takes an argument telling it how to format
/// format the counter. This can be a /// the counter. This can be a [numbering pattern or a
/// [numbering pattern or a function]($func/numbering). /// function]($func/numbering).
/// ///
/// ```example /// ```example
/// #set heading(numbering: "1.") /// #set heading(numbering: "1.")
@ -203,7 +203,7 @@ use crate::prelude::*;
/// ///
/// ## Methods /// ## Methods
/// ### display() /// ### display()
/// Display the value of the counter. /// Displays the value of the counter.
/// ///
/// - numbering: string or function (positional) /// - numbering: string or function (positional)
/// A [numbering pattern or a function]($func/numbering), which specifies how /// A [numbering pattern or a function]($func/numbering), which specifies how
@ -224,7 +224,7 @@ use crate::prelude::*;
/// - returns: content /// - returns: content
/// ///
/// ### step() /// ### step()
/// Increase the value of the counter by one. /// Increases the value of the counter by one.
/// ///
/// The update will be in effect at the position where the returned content is /// The update will be in effect at the position where the returned content is
/// inserted into the document. If you don't put the output into the document, /// inserted into the document. If you don't put the output into the document,
@ -238,7 +238,7 @@ use crate::prelude::*;
/// - returns: content /// - returns: content
/// ///
/// ### update() /// ### update()
/// Update the value of the counter. /// Updates the value of the counter.
/// ///
/// Just like with `step`, the update only occurs if you put the resulting /// Just like with `step`, the update only occurs if you put the resulting
/// content into the document. /// content into the document.
@ -252,7 +252,7 @@ use crate::prelude::*;
/// - returns: content /// - returns: content
/// ///
/// ### at() /// ### at()
/// Get the value of the counter at the given location. Always returns an /// Gets the value of the counter at the given location. Always returns an
/// array of integers, even if the counter has just one number. /// array of integers, even if the counter has just one number.
/// ///
/// - location: location (positional, required) /// - location: location (positional, required)
@ -263,7 +263,7 @@ use crate::prelude::*;
/// - returns: array /// - returns: array
/// ///
/// ### final() /// ### final()
/// Get the value of the counter at the end of the document. Always returns an /// Gets the value of the counter at the end of the document. Always returns an
/// array of integers, even if the counter has just one number. /// array of integers, even if the counter has just one number.
/// ///
/// - location: location (positional, required) /// - location: location (positional, required)

View File

@ -1,12 +1,10 @@
use crate::prelude::*; use crate::prelude::*;
use crate::text::{Hyphenate, TextElem}; use crate::text::{Hyphenate, TextElem};
/// Link to a URL or a location in the document. /// Links to a URL or a location in the document.
/// ///
/// The link function makes its positional `body` argument clickable and links /// By default, links are not styled any different from normal text. However,
/// it to the destination specified by the `dest` argument. By default, links /// you can easily apply a style of your choice with a show rule.
/// are not styled any different from normal text. However, you can easily apply
/// a style of your choice with a show rule.
/// ///
/// ## Example { #example } /// ## Example { #example }
/// ```example /// ```example

View File

@ -6,7 +6,7 @@ use ecow::EcoVec;
use crate::prelude::*; use crate::prelude::*;
use crate::text::Case; use crate::text::Case;
/// Apply a numbering to a sequence of numbers. /// Applies a numbering to a sequence of numbers.
/// ///
/// A numbering defines how a sequence of numbers should be displayed as /// A numbering defines how a sequence of numbers should be displayed as
/// content. It is defined either through a pattern string or an arbitrary /// content. It is defined either through a pattern string or an arbitrary

View File

@ -1,6 +1,6 @@
use crate::prelude::*; use crate::prelude::*;
/// Find elements in the document. /// Finds elements in the document.
/// ///
/// The `query` functions lets you search your document for elements of a /// The `query` functions lets you search your document for elements of a
/// particular type or with a particular label. /// particular type or with a particular label.

View File

@ -6,11 +6,11 @@ use crate::text::TextElem;
/// A reference to a label or bibliography. /// A reference to a label or bibliography.
/// ///
/// The reference function produces a textual reference to a label. For example, /// Produces a textual reference to a label. For example, a reference to a
/// a reference to a heading will yield an appropriate string such as "Section /// heading will yield an appropriate string such as "Section 1" for a reference
/// 1" for a reference to the first heading. The references are also links to /// to the first heading. The references are also links to the respective
/// the respective element. Reference syntax can also be used to /// element. Reference syntax can also be used to [cite]($func/cite) from a
/// [cite]($func/cite) from a bibliography. /// bibliography.
/// ///
/// Referenceable elements include [headings]($func/heading), /// Referenceable elements include [headings]($func/heading),
/// [figures]($func/figure), and [equations]($func/math.equation). To create a /// [figures]($func/figure), and [equations]($func/math.equation). To create a

View File

@ -6,14 +6,14 @@ use typst::model::DelayedErrors;
use crate::prelude::*; use crate::prelude::*;
/// Manage stateful parts of your document. /// Manages stateful parts of your document.
/// ///
/// Let's say you have some computations in your document and want to remember /// Let's say you have some computations in your document and want to remember
/// the result of your last computation to use it in the next one. You might try /// the result of your last computation to use it in the next one. You might try
/// something similar the code below and would expect it to output 10, 13, 26, /// something similar to the code below and expect it to output 10, 13, 26, and
/// and 21. However this **does not work** in Typst. If you test this code, you /// 21. However this **does not work** in Typst. If you test this code, you will
/// will see that Typst complains with the following error message: _Variables /// see that Typst complains with the following error message: _Variables from
/// from outside the function are read-only and cannot be modified._ /// outside the function are read-only and cannot be modified._
/// ///
/// ```typ /// ```typ
/// #let x = 0 /// #let x = 0
@ -177,13 +177,13 @@ use crate::prelude::*;
/// ``` /// ```
/// ///
/// In general, you should _typically_ not generate state updates from within /// In general, you should _typically_ not generate state updates from within
/// `locate` calls or `display` calls of state or counters. Instead pass a /// `locate` calls or `display` calls of state or counters. Instead, pass a
/// function to `update` that determines the value of the state based on its /// function to `update` that determines the value of the state based on its
/// previous value. /// previous value.
/// ///
/// ## Methods /// ## Methods
/// ### display() /// ### display()
/// Display the value of the state. /// Displays the value of the state.
/// ///
/// - format: function (positional) /// - format: function (positional)
/// A function which receives the value of the state and can return arbitrary /// A function which receives the value of the state and can return arbitrary
@ -193,7 +193,7 @@ use crate::prelude::*;
/// - returns: content /// - returns: content
/// ///
/// ### update() /// ### update()
/// Update the value of the state. /// Updates the value of the state.
/// ///
/// The update will be in effect at the position where the returned content is /// The update will be in effect at the position where the returned content is
/// inserted into the document. If you don't put the output into the document, /// inserted into the document. If you don't put the output into the document,
@ -209,7 +209,7 @@ use crate::prelude::*;
/// - returns: content /// - returns: content
/// ///
/// ### at() /// ### at()
/// Get the value of the state at the given location. /// Gets the value of the state at the given location.
/// ///
/// - location: location (positional, required) /// - location: location (positional, required)
/// The location at which the state's value should be retrieved. A suitable /// The location at which the state's value should be retrieved. A suitable
@ -219,7 +219,7 @@ use crate::prelude::*;
/// - returns: any /// - returns: any
/// ///
/// ### final() /// ### final()
/// Get the value of the state at the end of the document. /// Gets the value of the state at the end of the document.
/// ///
/// - location: location (positional, required) /// - location: location (positional, required)
/// Can be any location. Why is it required then? As noted before, Typst has /// Can be any location. Why is it required then? As noted before, Typst has

View File

@ -4,7 +4,7 @@ use ttf_parser::{GlyphId, OutlineBuilder};
use super::TextElem; use super::TextElem;
use crate::prelude::*; use crate::prelude::*;
/// Underline text. /// Underlines text.
/// ///
/// ## Example { #example } /// ## Example { #example }
/// ```example /// ```example
@ -32,8 +32,8 @@ pub struct UnderlineElem {
#[fold] #[fold]
pub stroke: Smart<PartialStroke>, pub stroke: Smart<PartialStroke>,
/// Position of the line relative to the baseline, read from the font tables /// The position of the line relative to the baseline, read from the font
/// if `{auto}`. /// tables if `{auto}`.
/// ///
/// ```example /// ```example
/// #underline(offset: 5pt)[ /// #underline(offset: 5pt)[
@ -43,7 +43,8 @@ pub struct UnderlineElem {
#[resolve] #[resolve]
pub offset: Smart<Length>, pub offset: Smart<Length>,
/// Amount that the line will be longer or shorter than its associated text. /// The amount by which to extend the line beyond (or within if negative)
/// the content.
/// ///
/// ```example /// ```example
/// #align(center, /// #align(center,
@ -81,7 +82,7 @@ impl Show for UnderlineElem {
} }
} }
/// Add a line over text. /// Adds a line over text.
/// ///
/// ## Example { #example } /// ## Example { #example }
/// ```example /// ```example
@ -110,8 +111,8 @@ pub struct OverlineElem {
#[fold] #[fold]
pub stroke: Smart<PartialStroke>, pub stroke: Smart<PartialStroke>,
/// Position of the line relative to the baseline, read from the font tables /// The position of the line relative to the baseline. Read from the font
/// if `{auto}`. /// tables if `{auto}`.
/// ///
/// ```example /// ```example
/// #overline(offset: -1.2em)[ /// #overline(offset: -1.2em)[
@ -121,7 +122,8 @@ pub struct OverlineElem {
#[resolve] #[resolve]
pub offset: Smart<Length>, pub offset: Smart<Length>,
/// Amount that the line will be longer or shorter than its associated text. /// The amount by which to extend the line beyond (or within if negative)
/// the content.
/// ///
/// ```example /// ```example
/// #set overline(extent: 4pt) /// #set overline(extent: 4pt)
@ -164,7 +166,7 @@ impl Show for OverlineElem {
} }
} }
/// Strike through text. /// Strikes through text.
/// ///
/// ## Example { #example } /// ## Example { #example }
/// ```example /// ```example
@ -192,8 +194,8 @@ pub struct StrikeElem {
#[fold] #[fold]
pub stroke: Smart<PartialStroke>, pub stroke: Smart<PartialStroke>,
/// Position of the line relative to the baseline, read from the font tables /// The position of the line relative to the baseline. Read from the font
/// if `{auto}`. /// tables if `{auto}`.
/// ///
/// This is useful if you are unhappy with the offset your font provides. /// This is useful if you are unhappy with the offset your font provides.
/// ///
@ -205,7 +207,8 @@ pub struct StrikeElem {
#[resolve] #[resolve]
pub offset: Smart<Length>, pub offset: Smart<Length>,
/// Amount that the line will be longer or shorter than its associated text. /// The amount by which to extend the line beyond (or within if negative)
/// the content.
/// ///
/// ```example /// ```example
/// This #strike(extent: -2pt)[skips] parts of the word. /// This #strike(extent: -2pt)[skips] parts of the word.

View File

@ -187,7 +187,7 @@ impl Fold for Toggle {
} }
} }
/// Convert text or content to lowercase. /// Converts text or content to lowercase.
/// ///
/// ## Example { #example } /// ## Example { #example }
/// ```example /// ```example
@ -206,7 +206,7 @@ pub fn lower(
case(text, Case::Lower) case(text, Case::Lower)
} }
/// Convert text or content to uppercase. /// Converts text or content to uppercase.
/// ///
/// ## Example { #example } /// ## Example { #example }
/// ```example /// ```example
@ -270,7 +270,7 @@ impl Case {
} }
} }
/// Display text in small capitals. /// Displays text in small capitals.
/// ///
/// _Note:_ This enables the OpenType `smcp` feature for the font. Not all fonts /// _Note:_ This enables the OpenType `smcp` feature for the font. Not all fonts
/// support this feature. Sometimes smallcaps are part of a dedicated font and /// support this feature. Sometimes smallcaps are part of a dedicated font and
@ -303,7 +303,7 @@ pub fn smallcaps(
body.styled(TextElem::set_smallcaps(true)) body.styled(TextElem::set_smallcaps(true))
} }
/// Create blind text. /// Creates blind text.
/// ///
/// This function yields a Latin-like _Lorem Ipsum_ blind text with the given /// This function yields a Latin-like _Lorem Ipsum_ blind text with the given
/// number of words. The sequence of words generated by the function is always /// number of words. The sequence of words generated by the function is always

View File

@ -39,11 +39,11 @@ pub(super) fn define(global: &mut Scope) {
global.define("lorem", lorem_func()); global.define("lorem", lorem_func());
} }
/// Customize the look and layout of text in a variety of ways. /// Customizes the look and layout of text in a variety of ways.
/// ///
/// This function is used often, both with set rules and directly. While the set /// This function is used frequently, both with set rules and directly. While
/// rule is often the simpler choice, calling the text function directly can be /// the set rule is often the simpler choice, calling the `text` function
/// useful when passing text as an argument to another function. /// directly can be useful when passing text as an argument to another function.
/// ///
/// ## Example { #example } /// ## Example { #example }
/// ```example /// ```example

View File

@ -1,7 +1,7 @@
use super::{variant, SpaceElem, TextElem, TextSize}; use super::{variant, SpaceElem, TextElem, TextSize};
use crate::prelude::*; use crate::prelude::*;
/// Set text in subscript. /// Renders text in subscript.
/// ///
/// The text is rendered smaller and its baseline is lowered. /// The text is rendered smaller and its baseline is lowered.
/// ///
@ -64,7 +64,7 @@ impl Show for SubElem {
} }
} }
/// Set text in superscript. /// Renders text in superscript.
/// ///
/// The text is rendered smaller and its baseline is raised. /// The text is rendered smaller and its baseline is raised.
/// ///

View File

@ -203,7 +203,7 @@ impl Lexer<'_> {
if self.s.eat_if("u{") { if self.s.eat_if("u{") {
let hex = self.s.eat_while(char::is_ascii_alphanumeric); let hex = self.s.eat_while(char::is_ascii_alphanumeric);
if !self.s.eat_if('}') { if !self.s.eat_if('}') {
return self.error("unclosed unicode escape sequence"); return self.error("unclosed Unicode escape sequence");
} }
if u32::from_str_radix(hex, 16) if u32::from_str_radix(hex, 16)
@ -211,7 +211,7 @@ impl Lexer<'_> {
.and_then(std::char::from_u32) .and_then(std::char::from_u32)
.is_none() .is_none()
{ {
return self.error(eco_format!("invalid unicode codepoint: {}", hex)); return self.error(eco_format!("invalid Unicode codepoint: {}", hex));
} }
return SyntaxKind::Escape; return SyntaxKind::Escape;

View File

@ -27,10 +27,10 @@ let f() , ; : | + - /= == 12 "string"
--- ---
// Unicode codepoint does not exist. // Unicode codepoint does not exist.
// Error: 1-11 invalid unicode codepoint: FFFFFF // Error: 1-11 invalid Unicode codepoint: FFFFFF
\u{FFFFFF} \u{FFFFFF}
--- ---
// Unterminated. // Unterminated.
// Error: 1-6 unclosed unicode escape sequence // Error: 1-6 unclosed Unicode escape sequence
\u{41[*Bold*] \u{41[*Bold*]