summaryrefslogtreecommitdiff
path: root/crates
diff options
context:
space:
mode:
authorLaurenz <laurmaedje@gmail.com>2023-09-30 11:49:02 +0200
committerLaurenz <laurmaedje@gmail.com>2023-09-30 11:49:02 +0200
commitc97fc5eb55931cfaa93577b1aadc71026269c43d (patch)
treed4edd4b2a8b32421464700fce433847f3841a713 /crates
parent0ed84797e857a14a4402b17277ecb6e05d722320 (diff)
Fix dead links
Diffstat (limited to 'crates')
-rw-r--r--crates/typst-library/src/lib.rs1
-rw-r--r--crates/typst/src/eval/scope.rs5
-rw-r--r--crates/typst/src/geom/color.rs10
3 files changed, 11 insertions, 5 deletions
diff --git a/crates/typst-library/src/lib.rs b/crates/typst-library/src/lib.rs
index 03e96441..da31409a 100644
--- a/crates/typst-library/src/lib.rs
+++ b/crates/typst-library/src/lib.rs
@@ -44,6 +44,7 @@ fn global(math: Module) -> Module {
/// Defines scoped values that are globally available, too.
fn prelude(global: &mut Scope) {
+ global.reset_category();
global.define("black", Color::BLACK);
global.define("gray", Color::GRAY);
global.define("silver", Color::SILVER);
diff --git a/crates/typst/src/eval/scope.rs b/crates/typst/src/eval/scope.rs
index 35ff202a..85bef53a 100644
--- a/crates/typst/src/eval/scope.rs
+++ b/crates/typst/src/eval/scope.rs
@@ -109,6 +109,11 @@ impl Scope {
self.category = Some(name);
}
+ /// Reset the category.
+ pub fn reset_category(&mut self) {
+ self.category = None;
+ }
+
/// Bind a value to a name.
#[track_caller]
pub fn define(&mut self, name: impl Into<EcoString>, value: impl IntoValue) {
diff --git a/crates/typst/src/geom/color.rs b/crates/typst/src/geom/color.rs
index b99ba83d..93d0a31f 100644
--- a/crates/typst/src/geom/color.rs
+++ b/crates/typst/src/geom/color.rs
@@ -20,10 +20,10 @@ type Luma = palette::luma::Luma<encoding::Srgb, f32>;
/// A color in a specific color space.
///
/// Typst supports:
-/// - sRGB through the [`rgb` function]($rgb)
-/// - Device CMYK through [`cmyk` function]($cmyk)
-/// - D65 Gray through the [`luma` function]($luma)
-/// - Oklab through the [`oklab` function]($oklab)
+/// - sRGB through the [`rgb` function]($color.rgb)
+/// - Device CMYK through [`cmyk` function]($color.cmyk)
+/// - D65 Gray through the [`luma` function]($color.luma)
+/// - Oklab through the [`oklab` function]($color.oklab)
/// - Linear RGB through the [`color.linear-rgb` function]($color.linear-rgb)
/// - HSL through the [`color.hsl` function]($color.hsl)
/// - HSV through the [`color.hsv` function]($color.hsv)
@@ -181,7 +181,7 @@ impl Color {
/// This color space is similar to Srgb<f32>, but with the distinction that
/// the color component are not gamma corrected. This makes it easier to
/// perform color operations such as blending and interpolation. Although,
- /// you should prefer to use the [`oklab` function]($oklab) for these.
+ /// you should prefer to use the [`oklab` function]($color.oklab) for these.
///
/// A linear RGB(A) color is represented internally by an array of four components:
/// - red ([`ratio`]($ratio))