summaryrefslogtreecommitdiff
path: root/crates/typst-library/src
diff options
context:
space:
mode:
authorJoseph Wilson <jo.alex.w@gmail.com>2023-10-31 13:32:08 +1300
committerGitHub <noreply@github.com>2023-10-31 01:32:08 +0100
commit27ab2bb9a2e49bd6b8190eb39b18957b27aca222 (patch)
treeb1a916dc45333ca8ff52331efa2bc4817b818b4c /crates/typst-library/src
parentc3114fa380d80e7268e14d631b08511b2ebf58ec (diff)
Documentation improvements (#2492)
Diffstat (limited to 'crates/typst-library/src')
-rw-r--r--crates/typst-library/src/compute/calc.rs6
-rw-r--r--crates/typst-library/src/compute/foundations.rs5
2 files changed, 7 insertions, 4 deletions
diff --git a/crates/typst-library/src/compute/calc.rs b/crates/typst-library/src/compute/calc.rs
index 8a7c23ea..83bf924e 100644
--- a/crates/typst-library/src/compute/calc.rs
+++ b/crates/typst-library/src/compute/calc.rs
@@ -169,7 +169,7 @@ pub fn exp(
Ok(result)
}
-/// Extracts the square root of a number.
+/// Calculates the square root of a number.
///
/// ```example
/// #calc.sqrt(16) \
@@ -486,7 +486,7 @@ fn fact_impl(start: u64, end: u64) -> Option<i64> {
/// Calculates a binomial coefficient.
///
-/// Returns the `k`-combination `n`, or the number of ways to choose `k`
+/// Returns the `k`-combination of `n`, or the number of ways to choose `k`
/// items from a set of `n` without regard to order.
///
/// ```example
@@ -615,7 +615,7 @@ pub fn ceil(
/// ```example
/// #assert(calc.trunc(3) == 3)
/// #assert(calc.trunc(-3.7) == -3)
-/// #assert(calc.trunc(15.9) == 15)
+/// #calc.trunc(15.9)
/// ```
#[func(title = "Truncate")]
pub fn trunc(
diff --git a/crates/typst-library/src/compute/foundations.rs b/crates/typst-library/src/compute/foundations.rs
index b02f9793..fef00269 100644
--- a/crates/typst-library/src/compute/foundations.rs
+++ b/crates/typst-library/src/compute/foundations.rs
@@ -56,6 +56,9 @@ pub fn repr(
/// Fails with an error.
///
+/// Arguments are displayed to the user (not rendered in the document) as
+/// strings, converting with `repr` if necessary.
+///
/// # Example
/// The code below produces the error `panicked with: "this is wrong"`.
/// ```typ
@@ -63,7 +66,7 @@ pub fn repr(
/// ```
#[func(keywords = ["error"])]
pub fn panic(
- /// The values to panic with.
+ /// The values to panic with and display to the user.
#[variadic]
values: Vec<Value>,
) -> StrResult<Never> {