repo stringlengths 6 65 | file_url stringlengths 81 311 | file_path stringlengths 6 227 | content stringlengths 0 32.8k | language stringclasses 1
value | license stringclasses 7
values | commit_sha stringlengths 40 40 | retrieved_at stringdate 2026-01-04 15:31:58 2026-01-04 20:25:31 | truncated bool 2
classes |
|---|---|---|---|---|---|---|---|---|
typst/typst | https://github.com/typst/typst/blob/a87f4b15ca86a0b2f98948d8f393608070ed731e/crates/typst-library/src/math/cancel.rs | crates/typst-library/src/math/cancel.rs | use crate::foundations::{Content, Func, Smart, cast, elem};
use crate::layout::{Angle, Em, Length, Ratio, Rel};
use crate::math::Mathy;
use crate::visualize::Stroke;
/// Displays a diagonal line over a part of an equation.
///
/// This is commonly used to show the elimination of a term.
///
/// # Example
/// ```exampl... | rust | Apache-2.0 | a87f4b15ca86a0b2f98948d8f393608070ed731e | 2026-01-04T15:31:59.400510Z | false |
typst/typst | https://github.com/typst/typst/blob/a87f4b15ca86a0b2f98948d8f393608070ed731e/crates/typst-library/src/math/lr.rs | crates/typst-library/src/math/lr.rs | use std::collections::HashMap;
use std::sync::LazyLock;
use bumpalo::Bump;
use comemo::Tracked;
use crate::engine::Engine;
use crate::foundations::{
Args, CastInfo, Content, Context, Func, IntoValue, NativeElement, NativeFunc,
NativeFuncData, NativeFuncPtr, ParamInfo, Reflect, Scope, SymbolElem, Type, elem,
... | rust | Apache-2.0 | a87f4b15ca86a0b2f98948d8f393608070ed731e | 2026-01-04T15:31:59.400510Z | false |
typst/typst | https://github.com/typst/typst/blob/a87f4b15ca86a0b2f98948d8f393608070ed731e/crates/typst-library/src/math/equation.rs | crates/typst-library/src/math/equation.rs | use std::num::NonZeroUsize;
use codex::styling::MathVariant;
use ecow::EcoString;
use typst_utils::NonZeroExt;
use unicode_math_class::MathClass;
use crate::diag::SourceResult;
use crate::engine::Engine;
use crate::foundations::{
Content, NativeElement, Packed, ShowSet, Smart, StyleChain, Styles, Synthesize, elem... | rust | Apache-2.0 | a87f4b15ca86a0b2f98948d8f393608070ed731e | 2026-01-04T15:31:59.400510Z | false |
typst/typst | https://github.com/typst/typst/blob/a87f4b15ca86a0b2f98948d8f393608070ed731e/crates/typst-library/src/math/mod.rs | crates/typst-library/src/math/mod.rs | //! Mathematical formulas.
pub mod accent;
mod attach;
mod cancel;
mod equation;
mod frac;
mod lr;
mod matrix;
mod op;
mod root;
mod style;
mod underover;
pub use self::accent::{Accent, AccentElem};
pub use self::attach::*;
pub use self::cancel::*;
pub use self::equation::*;
pub use self::frac::*;
pub use self::lr::*... | rust | Apache-2.0 | a87f4b15ca86a0b2f98948d8f393608070ed731e | 2026-01-04T15:31:59.400510Z | false |
typst/typst | https://github.com/typst/typst/blob/a87f4b15ca86a0b2f98948d8f393608070ed731e/crates/typst-library/src/math/style.rs | crates/typst-library/src/math/style.rs | use codex::styling::MathVariant;
use crate::foundations::{Cast, Content, func};
use crate::math::EquationElem;
/// Bold font style in math.
///
/// ```example
/// $ bold(A) := B^+ $
/// ```
#[func(keywords = ["mathbf"])]
pub fn bold(
/// The content to style.
body: Content,
) -> Content {
body.set(Equatio... | rust | Apache-2.0 | a87f4b15ca86a0b2f98948d8f393608070ed731e | 2026-01-04T15:31:59.400510Z | false |
typst/typst | https://github.com/typst/typst/blob/a87f4b15ca86a0b2f98948d8f393608070ed731e/crates/typst-library/src/math/attach.rs | crates/typst-library/src/math/attach.rs | use crate::foundations::{Content, Packed, elem};
use crate::layout::{Length, Rel};
use crate::math::{EquationElem, Mathy};
/// A base with optional attachments.
///
/// ```example
/// $ attach(
/// Pi, t: alpha, b: beta,
/// tl: 1, tr: 2+3, bl: 4+5, br: 6,
/// ) $
/// ```
#[elem(Mathy)]
pub struct AttachElem {
... | rust | Apache-2.0 | a87f4b15ca86a0b2f98948d8f393608070ed731e | 2026-01-04T15:31:59.400510Z | false |
typst/typst | https://github.com/typst/typst/blob/a87f4b15ca86a0b2f98948d8f393608070ed731e/crates/typst-library/src/math/accent.rs | crates/typst-library/src/math/accent.rs | use std::collections::HashMap;
use std::sync::LazyLock;
use bumpalo::Bump;
use comemo::Tracked;
use icu_properties::CanonicalCombiningClass;
use icu_properties::maps::CodePointMapData;
use icu_provider::AsDeserializingBufferProvider;
use icu_provider_blob::BlobDataProvider;
use crate::engine::Engine;
use crate::found... | rust | Apache-2.0 | a87f4b15ca86a0b2f98948d8f393608070ed731e | 2026-01-04T15:31:59.400510Z | false |
typst/typst | https://github.com/typst/typst/blob/a87f4b15ca86a0b2f98948d8f393608070ed731e/crates/typst-library/src/math/matrix.rs | crates/typst-library/src/math/matrix.rs | use smallvec::{SmallVec, smallvec};
use typst_syntax::Spanned;
use typst_utils::{Numeric, default_math_class};
use unicode_math_class::MathClass;
use crate::diag::{At, HintedStrResult, StrResult, bail};
use crate::foundations::{
Array, Content, Dict, Fold, NoneValue, Resolve, Smart, StyleChain, Symbol, Value,
... | rust | Apache-2.0 | a87f4b15ca86a0b2f98948d8f393608070ed731e | 2026-01-04T15:31:59.400510Z | false |
typst/typst | https://github.com/typst/typst/blob/a87f4b15ca86a0b2f98948d8f393608070ed731e/crates/typst-library/src/layout/axes.rs | crates/typst-library/src/layout/axes.rs | use std::any::Any;
use std::fmt::{self, Debug, Formatter};
use std::ops::{BitAnd, BitAndAssign, BitOr, BitOrAssign, Deref, Not};
use typst_utils::Get;
use crate::diag::{HintedStrResult, bail};
use crate::foundations::{
Array, CastInfo, FromValue, IntoValue, Reflect, Resolve, Smart, StyleChain, Value,
array, c... | rust | Apache-2.0 | a87f4b15ca86a0b2f98948d8f393608070ed731e | 2026-01-04T15:31:59.400510Z | false |
typst/typst | https://github.com/typst/typst/blob/a87f4b15ca86a0b2f98948d8f393608070ed731e/crates/typst-library/src/layout/fr.rs | crates/typst-library/src/layout/fr.rs | use std::fmt::{self, Debug, Formatter};
use std::iter::Sum;
use std::ops::{Add, Div, Mul, Neg};
use ecow::EcoString;
use typst_utils::{Numeric, Scalar};
use crate::foundations::{Repr, repr, ty};
use crate::layout::Abs;
/// Defines how the remaining space in a layout is distributed.
///
/// Each fractionally sized el... | rust | Apache-2.0 | a87f4b15ca86a0b2f98948d8f393608070ed731e | 2026-01-04T15:31:59.400510Z | false |
typst/typst | https://github.com/typst/typst/blob/a87f4b15ca86a0b2f98948d8f393608070ed731e/crates/typst-library/src/layout/page.rs | crates/typst-library/src/layout/page.rs | use std::num::NonZeroUsize;
use std::ops::RangeInclusive;
use std::str::FromStr;
use typst_utils::{NonZeroExt, Scalar, singleton};
use crate::diag::{SourceResult, bail};
use crate::engine::Engine;
use crate::foundations::{
Args, AutoValue, Cast, Construct, Content, Dict, Fold, NativeElement, Set, Smart,
Value... | rust | Apache-2.0 | a87f4b15ca86a0b2f98948d8f393608070ed731e | 2026-01-04T15:31:59.400510Z | false |
typst/typst | https://github.com/typst/typst/blob/a87f4b15ca86a0b2f98948d8f393608070ed731e/crates/typst-library/src/layout/repeat.rs | crates/typst-library/src/layout/repeat.rs | use crate::foundations::{Content, elem};
use crate::introspection::Tagged;
use crate::layout::Length;
/// Repeats content to the available space.
///
/// This can be useful when implementing a custom index, reference, or outline.
///
/// Space may be inserted between the instances of the body parameter, so be
/// sure... | rust | Apache-2.0 | a87f4b15ca86a0b2f98948d8f393608070ed731e | 2026-01-04T15:31:59.400510Z | false |
typst/typst | https://github.com/typst/typst/blob/a87f4b15ca86a0b2f98948d8f393608070ed731e/crates/typst-library/src/layout/place.rs | crates/typst-library/src/layout/place.rs | use crate::foundations::{Cast, Content, Smart, elem, scope};
use crate::introspection::{Locatable, Tagged, Unqueriable};
use crate::layout::{Alignment, Em, Length, Rel};
/// Places content relatively to its parent container.
///
/// Placed content can be either overlaid (the default) or floating. Overlaid
/// content ... | rust | Apache-2.0 | a87f4b15ca86a0b2f98948d8f393608070ed731e | 2026-01-04T15:31:59.400510Z | false |
typst/typst | https://github.com/typst/typst/blob/a87f4b15ca86a0b2f98948d8f393608070ed731e/crates/typst-library/src/layout/abs.rs | crates/typst-library/src/layout/abs.rs | use std::fmt::{self, Debug, Formatter};
use std::iter::Sum;
use std::ops::{Add, Div, Mul, Neg, Rem};
use ecow::EcoString;
use typst_utils::{Numeric, Scalar};
use crate::foundations::{Fold, Repr, Value, cast, repr};
/// An absolute length.
#[derive(Default, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
pub stru... | rust | Apache-2.0 | a87f4b15ca86a0b2f98948d8f393608070ed731e | 2026-01-04T15:31:59.400510Z | false |
typst/typst | https://github.com/typst/typst/blob/a87f4b15ca86a0b2f98948d8f393608070ed731e/crates/typst-library/src/layout/columns.rs | crates/typst-library/src/layout/columns.rs | use std::num::NonZeroUsize;
use crate::foundations::{Content, elem};
use crate::layout::{Length, Ratio, Rel};
/// Separates a region into multiple equally sized columns.
///
/// The `column` function lets you separate the interior of any container into
/// multiple columns. It will currently not balance the height of... | rust | Apache-2.0 | a87f4b15ca86a0b2f98948d8f393608070ed731e | 2026-01-04T15:31:59.400510Z | false |
typst/typst | https://github.com/typst/typst/blob/a87f4b15ca86a0b2f98948d8f393608070ed731e/crates/typst-library/src/layout/pad.rs | crates/typst-library/src/layout/pad.rs | use crate::foundations::{Content, elem};
use crate::layout::{Length, Rel};
/// Adds spacing around content.
///
/// The spacing can be specified for each side individually, or for all sides at
/// once by specifying a positional argument.
///
/// # Example
/// ```example
/// #set align(center)
///
/// #pad(x: 16pt, im... | rust | Apache-2.0 | a87f4b15ca86a0b2f98948d8f393608070ed731e | 2026-01-04T15:31:59.400510Z | false |
typst/typst | https://github.com/typst/typst/blob/a87f4b15ca86a0b2f98948d8f393608070ed731e/crates/typst-library/src/layout/hide.rs | crates/typst-library/src/layout/hide.rs | use crate::foundations::{Content, elem};
use crate::introspection::Tagged;
/// Hides content without affecting layout.
///
/// The `hide` function allows you to hide content while the layout still "sees"
/// it. This is useful for creating blank space that is exactly as large as some
/// content.
///
/// # Example
///... | rust | Apache-2.0 | a87f4b15ca86a0b2f98948d8f393608070ed731e | 2026-01-04T15:31:59.400510Z | false |
typst/typst | https://github.com/typst/typst/blob/a87f4b15ca86a0b2f98948d8f393608070ed731e/crates/typst-library/src/layout/fragment.rs | crates/typst-library/src/layout/fragment.rs | use std::fmt::{self, Debug, Formatter};
use crate::layout::Frame;
/// A partial layout result.
#[derive(Clone)]
pub struct Fragment(Vec<Frame>);
impl Fragment {
/// Create a fragment from a single frame.
pub fn frame(frame: Frame) -> Self {
Self(vec![frame])
}
/// Create a fragment from mult... | rust | Apache-2.0 | a87f4b15ca86a0b2f98948d8f393608070ed731e | 2026-01-04T15:31:59.400510Z | false |
typst/typst | https://github.com/typst/typst/blob/a87f4b15ca86a0b2f98948d8f393608070ed731e/crates/typst-library/src/layout/container.rs | crates/typst-library/src/layout/container.rs | use crate::diag::{SourceResult, bail};
use crate::engine::Engine;
use crate::foundations::{
Args, AutoValue, Construct, Content, NativeElement, Packed, Smart, StyleChain, Value,
cast, elem,
};
use crate::introspection::Locator;
use crate::layout::{
Abs, Corners, Em, Fr, Fragment, Frame, Length, Region, Regi... | rust | Apache-2.0 | a87f4b15ca86a0b2f98948d8f393608070ed731e | 2026-01-04T15:31:59.400510Z | false |
typst/typst | https://github.com/typst/typst/blob/a87f4b15ca86a0b2f98948d8f393608070ed731e/crates/typst-library/src/layout/transform.rs | crates/typst-library/src/layout/transform.rs | use crate::foundations::{Content, Smart, cast, elem};
use crate::layout::{Abs, Alignment, Angle, HAlignment, Length, Ratio, Rel, VAlignment};
/// Moves content without affecting layout.
///
/// The `move` function allows you to move content while the layout still 'sees'
/// it at the original positions. Containers wil... | rust | Apache-2.0 | a87f4b15ca86a0b2f98948d8f393608070ed731e | 2026-01-04T15:31:59.400510Z | false |
typst/typst | https://github.com/typst/typst/blob/a87f4b15ca86a0b2f98948d8f393608070ed731e/crates/typst-library/src/layout/regions.rs | crates/typst-library/src/layout/regions.rs | use std::fmt::{self, Debug, Formatter};
use crate::layout::{Abs, Axes, Size};
/// A single region to layout into.
#[derive(Debug, Copy, Clone, Hash)]
pub struct Region {
/// The size of the region.
pub size: Size,
/// Whether elements should expand to fill the regions instead of shrinking
/// to fit t... | rust | Apache-2.0 | a87f4b15ca86a0b2f98948d8f393608070ed731e | 2026-01-04T15:31:59.400510Z | false |
typst/typst | https://github.com/typst/typst/blob/a87f4b15ca86a0b2f98948d8f393608070ed731e/crates/typst-library/src/layout/rect.rs | crates/typst-library/src/layout/rect.rs | use crate::layout::{Point, Size};
/// A rectangle in 2D.
#[derive(Debug, Copy, Clone, Eq, PartialEq, Hash)]
pub struct Rect {
/// The top left corner (minimum coordinate).
pub min: Point,
/// The bottom right corner (maximum coordinate).
pub max: Point,
}
impl Rect {
/// Create a new rectangle fro... | rust | Apache-2.0 | a87f4b15ca86a0b2f98948d8f393608070ed731e | 2026-01-04T15:31:59.400510Z | false |
typst/typst | https://github.com/typst/typst/blob/a87f4b15ca86a0b2f98948d8f393608070ed731e/crates/typst-library/src/layout/angle.rs | crates/typst-library/src/layout/angle.rs | use std::f64::consts::PI;
use std::fmt::{self, Debug, Formatter};
use std::iter::Sum;
use std::ops::{Add, Div, Mul, Neg};
use ecow::EcoString;
use typst_utils::{Numeric, Scalar};
use crate::foundations::{Repr, func, repr, scope, ty};
/// An angle describing a rotation.
///
/// Typst supports the following angular un... | rust | Apache-2.0 | a87f4b15ca86a0b2f98948d8f393608070ed731e | 2026-01-04T15:31:59.400510Z | false |
typst/typst | https://github.com/typst/typst/blob/a87f4b15ca86a0b2f98948d8f393608070ed731e/crates/typst-library/src/layout/em.rs | crates/typst-library/src/layout/em.rs | use std::fmt::{self, Debug, Formatter};
use std::iter::Sum;
use std::ops::{Add, Div, Mul, Neg};
use ecow::EcoString;
use typst_utils::{Numeric, Scalar};
use crate::foundations::{Repr, Resolve, StyleChain, Value, cast, repr};
use crate::layout::{Abs, Length};
use crate::text::TextElem;
/// A length that is relative t... | rust | Apache-2.0 | a87f4b15ca86a0b2f98948d8f393608070ed731e | 2026-01-04T15:31:59.400510Z | false |
typst/typst | https://github.com/typst/typst/blob/a87f4b15ca86a0b2f98948d8f393608070ed731e/crates/typst-library/src/layout/align.rs | crates/typst-library/src/layout/align.rs | use std::ops::Add;
use ecow::{EcoString, eco_format};
use crate::diag::{HintedStrResult, StrResult, bail};
use crate::foundations::{
CastInfo, Content, Fold, FromValue, IntoValue, Reflect, Repr, Resolve, StyleChain,
Value, cast, elem, func, scope, ty,
};
use crate::layout::{Abs, Axes, Axis, Dir, Side};
use cr... | rust | Apache-2.0 | a87f4b15ca86a0b2f98948d8f393608070ed731e | 2026-01-04T15:31:59.400510Z | false |
typst/typst | https://github.com/typst/typst/blob/a87f4b15ca86a0b2f98948d8f393608070ed731e/crates/typst-library/src/layout/mod.rs | crates/typst-library/src/layout/mod.rs | //! Composable layouts.
mod abs;
mod align;
mod angle;
mod axes;
mod columns;
mod container;
mod corners;
mod dir;
mod em;
mod fr;
mod fragment;
mod frame;
pub mod grid;
mod hide;
#[path = "layout.rs"]
mod layout_;
mod length;
#[path = "measure.rs"]
mod measure_;
mod pad;
mod page;
mod place;
mod point;
mod ratio;
mod... | rust | Apache-2.0 | a87f4b15ca86a0b2f98948d8f393608070ed731e | 2026-01-04T15:31:59.400510Z | false |
typst/typst | https://github.com/typst/typst/blob/a87f4b15ca86a0b2f98948d8f393608070ed731e/crates/typst-library/src/layout/layout.rs | crates/typst-library/src/layout/layout.rs | use typst_syntax::Span;
use crate::foundations::{Content, Func, NativeElement, elem, func};
use crate::introspection::Locatable;
/// Provides access to the current outer container's (or page's, if none)
/// dimensions (width and height).
///
/// Accepts a function that receives a single parameter, which is a dictiona... | rust | Apache-2.0 | a87f4b15ca86a0b2f98948d8f393608070ed731e | 2026-01-04T15:31:59.400510Z | false |
typst/typst | https://github.com/typst/typst/blob/a87f4b15ca86a0b2f98948d8f393608070ed731e/crates/typst-library/src/layout/stack.rs | crates/typst-library/src/layout/stack.rs | use std::fmt::{self, Debug, Formatter};
use crate::foundations::{Content, cast, elem};
use crate::layout::{Dir, Spacing};
/// Arranges content and spacing horizontally or vertically.
///
/// The stack places a list of items along an axis, with optional spacing
/// between each item.
///
/// # Example
/// ```example
/... | rust | Apache-2.0 | a87f4b15ca86a0b2f98948d8f393608070ed731e | 2026-01-04T15:31:59.400510Z | false |
typst/typst | https://github.com/typst/typst/blob/a87f4b15ca86a0b2f98948d8f393608070ed731e/crates/typst-library/src/layout/ratio.rs | crates/typst-library/src/layout/ratio.rs | use std::fmt::{self, Debug, Formatter};
use std::ops::{Add, Div, Mul, Neg};
use ecow::EcoString;
use typst_utils::{Numeric, Scalar};
use crate::foundations::{Repr, repr, ty};
/// A ratio of a whole.
///
/// A ratio is written as a number, followed by a percent sign. Ratios most
/// often appear as part of a [relativ... | rust | Apache-2.0 | a87f4b15ca86a0b2f98948d8f393608070ed731e | 2026-01-04T15:31:59.400510Z | false |
typst/typst | https://github.com/typst/typst/blob/a87f4b15ca86a0b2f98948d8f393608070ed731e/crates/typst-library/src/layout/spacing.rs | crates/typst-library/src/layout/spacing.rs | use typst_utils::{Numeric, singleton};
use crate::foundations::{Content, NativeElement, cast, elem};
use crate::layout::{Abs, Em, Fr, Length, Ratio, Rel};
/// Inserts horizontal spacing into a paragraph.
///
/// The spacing can be absolute, relative, or fractional. In the last case, the
/// remaining space on the lin... | rust | Apache-2.0 | a87f4b15ca86a0b2f98948d8f393608070ed731e | 2026-01-04T15:31:59.400510Z | false |
typst/typst | https://github.com/typst/typst/blob/a87f4b15ca86a0b2f98948d8f393608070ed731e/crates/typst-library/src/layout/dir.rs | crates/typst-library/src/layout/dir.rs | use ecow::EcoString;
use crate::foundations::{Repr, func, scope, ty};
use crate::layout::{Axis, Side};
/// The four directions into which content can be laid out.
///
/// Possible values are:
/// - `{ltr}`: Left to right.
/// - `{rtl}`: Right to left.
/// - `{ttb}`: Top to bottom.
/// - `{btt}`: Bottom to top.
///
/... | rust | Apache-2.0 | a87f4b15ca86a0b2f98948d8f393608070ed731e | 2026-01-04T15:31:59.400510Z | false |
typst/typst | https://github.com/typst/typst/blob/a87f4b15ca86a0b2f98948d8f393608070ed731e/crates/typst-library/src/layout/frame.rs | crates/typst-library/src/layout/frame.rs | //! Finished documents.
use std::fmt::{self, Debug, Formatter};
use std::num::NonZeroUsize;
use std::sync::Arc;
use typst_syntax::Span;
use typst_utils::{LazyHash, Numeric};
use crate::foundations::{Dict, Label, Value, cast, dict};
use crate::introspection::{Location, Tag};
use crate::layout::{Abs, Axes, FixedAlignm... | rust | Apache-2.0 | a87f4b15ca86a0b2f98948d8f393608070ed731e | 2026-01-04T15:31:59.400510Z | false |
typst/typst | https://github.com/typst/typst/blob/a87f4b15ca86a0b2f98948d8f393608070ed731e/crates/typst-library/src/layout/length.rs | crates/typst-library/src/layout/length.rs | use std::cmp::Ordering;
use std::fmt::{self, Debug, Formatter};
use std::ops::{Add, Div, Mul, Neg};
use comemo::Tracked;
use ecow::{EcoString, eco_format};
use typst_syntax::Span;
use typst_utils::Numeric;
use crate::diag::{HintedStrResult, SourceResult, bail};
use crate::foundations::{Context, Fold, Repr, Resolve, S... | rust | Apache-2.0 | a87f4b15ca86a0b2f98948d8f393608070ed731e | 2026-01-04T15:31:59.400510Z | false |
typst/typst | https://github.com/typst/typst/blob/a87f4b15ca86a0b2f98948d8f393608070ed731e/crates/typst-library/src/layout/measure.rs | crates/typst-library/src/layout/measure.rs | use comemo::Tracked;
use typst_syntax::Span;
use crate::diag::{At, SourceResult};
use crate::engine::Engine;
use crate::foundations::{
Content, Context, Dict, Resolve, Smart, Target, TargetElem, dict, func,
};
use crate::introspection::{Locator, LocatorLink};
use crate::layout::{Abs, Axes, Length, Region, Size};
... | rust | Apache-2.0 | a87f4b15ca86a0b2f98948d8f393608070ed731e | 2026-01-04T15:31:59.400510Z | false |
typst/typst | https://github.com/typst/typst/blob/a87f4b15ca86a0b2f98948d8f393608070ed731e/crates/typst-library/src/layout/point.rs | crates/typst-library/src/layout/point.rs | use std::fmt::{self, Debug, Formatter};
use std::ops::{Add, Div, Mul, Neg};
use typst_utils::{Get, Numeric};
use crate::layout::{Abs, Axis, Size, Transform};
/// A point in 2D.
#[derive(Default, Copy, Clone, Eq, PartialEq, Hash)]
pub struct Point {
/// The x coordinate.
pub x: Abs,
/// The y coordinate.
... | rust | Apache-2.0 | a87f4b15ca86a0b2f98948d8f393608070ed731e | 2026-01-04T15:31:59.400510Z | false |
typst/typst | https://github.com/typst/typst/blob/a87f4b15ca86a0b2f98948d8f393608070ed731e/crates/typst-library/src/layout/rel.rs | crates/typst-library/src/layout/rel.rs | use std::cmp::Ordering;
use std::fmt::{self, Debug, Formatter};
use std::ops::{Add, AddAssign, Div, DivAssign, Mul, MulAssign, Neg, Sub, SubAssign};
use ecow::{EcoString, eco_format};
use typst_utils::Numeric;
use crate::foundations::{Fold, Repr, Resolve, StyleChain, cast, ty};
use crate::layout::{Abs, Em, Length, Ra... | rust | Apache-2.0 | a87f4b15ca86a0b2f98948d8f393608070ed731e | 2026-01-04T15:31:59.400510Z | false |
typst/typst | https://github.com/typst/typst/blob/a87f4b15ca86a0b2f98948d8f393608070ed731e/crates/typst-library/src/layout/sides.rs | crates/typst-library/src/layout/sides.rs | use std::fmt::{self, Debug, Formatter};
use std::ops::Add;
use typst_utils::Get;
use crate::diag::{HintedStrResult, bail};
use crate::foundations::{
AlternativeFold, CastInfo, Dict, Fold, FromValue, IntoValue, Reflect, Resolve,
StyleChain, Value, cast,
};
use crate::layout::{Abs, Alignment, Axes, Axis, Corner... | rust | Apache-2.0 | a87f4b15ca86a0b2f98948d8f393608070ed731e | 2026-01-04T15:31:59.400510Z | false |
typst/typst | https://github.com/typst/typst/blob/a87f4b15ca86a0b2f98948d8f393608070ed731e/crates/typst-library/src/layout/corners.rs | crates/typst-library/src/layout/corners.rs | use std::fmt::{self, Debug, Formatter};
use typst_utils::Get;
use crate::diag::HintedStrResult;
use crate::foundations::{
AlternativeFold, CastInfo, Dict, Fold, FromValue, IntoValue, Reflect, Resolve,
StyleChain, Value,
};
use crate::layout::Side;
/// A container with components for the four corners of a rec... | rust | Apache-2.0 | a87f4b15ca86a0b2f98948d8f393608070ed731e | 2026-01-04T15:31:59.400510Z | false |
typst/typst | https://github.com/typst/typst/blob/a87f4b15ca86a0b2f98948d8f393608070ed731e/crates/typst-library/src/layout/size.rs | crates/typst-library/src/layout/size.rs | use std::ops::{Add, Div, Mul, Neg};
use typst_utils::Numeric;
use crate::layout::{Abs, Axes, Point, Ratio};
/// A size in 2D.
pub type Size = Axes<Abs>;
impl Size {
/// The zero value.
pub const fn zero() -> Self {
Self { x: Abs::zero(), y: Abs::zero() }
}
/// Whether the other size fits in... | rust | Apache-2.0 | a87f4b15ca86a0b2f98948d8f393608070ed731e | 2026-01-04T15:31:59.400510Z | false |
typst/typst | https://github.com/typst/typst/blob/a87f4b15ca86a0b2f98948d8f393608070ed731e/crates/typst-library/src/layout/grid/mod.rs | crates/typst-library/src/layout/grid/mod.rs | pub mod resolve;
use std::num::{NonZeroU32, NonZeroUsize};
use std::sync::Arc;
use comemo::Track;
use smallvec::{SmallVec, smallvec};
use typst_utils::NonZeroExt;
use crate::diag::{At, HintedStrResult, HintedString, SourceResult, bail};
use crate::engine::Engine;
use crate::foundations::{
Array, CastInfo, Conten... | rust | Apache-2.0 | a87f4b15ca86a0b2f98948d8f393608070ed731e | 2026-01-04T15:31:59.400510Z | true |
typst/typst | https://github.com/typst/typst/blob/a87f4b15ca86a0b2f98948d8f393608070ed731e/crates/typst-library/src/layout/grid/resolve.rs | crates/typst-library/src/layout/grid/resolve.rs | use std::num::{NonZeroU32, NonZeroUsize};
use std::ops::{Deref, DerefMut, Range};
use std::sync::Arc;
use ecow::eco_format;
use typst_library::Dir;
use typst_library::diag::{
At, Hint, HintedStrResult, HintedString, SourceResult, Trace, Tracepoint, bail,
};
use typst_library::engine::Engine;
use typst_library::fou... | rust | Apache-2.0 | a87f4b15ca86a0b2f98948d8f393608070ed731e | 2026-01-04T15:31:59.400510Z | true |
typst/typst | https://github.com/typst/typst/blob/a87f4b15ca86a0b2f98948d8f393608070ed731e/crates/typst-library/src/visualize/stroke.rs | crates/typst-library/src/visualize/stroke.rs | use ecow::EcoString;
use typst_utils::{Numeric, Scalar};
use crate::diag::{HintedStrResult, SourceResult};
use crate::foundations::{
Args, Cast, Dict, Fold, FromValue, NoneValue, Repr, Resolve, Smart, StyleChain,
Value, cast, dict, func, scope, ty,
};
use crate::layout::{Abs, Length};
use crate::visualize::{Co... | rust | Apache-2.0 | a87f4b15ca86a0b2f98948d8f393608070ed731e | 2026-01-04T15:31:59.400510Z | false |
typst/typst | https://github.com/typst/typst/blob/a87f4b15ca86a0b2f98948d8f393608070ed731e/crates/typst-library/src/visualize/paint.rs | crates/typst-library/src/visualize/paint.rs | use std::fmt::{self, Debug, Formatter};
use ecow::EcoString;
use crate::foundations::{Repr, Smart, cast};
use crate::visualize::{Color, Gradient, RelativeTo, Tiling};
/// How a fill or stroke should be painted.
#[derive(Clone, Eq, PartialEq, Hash)]
pub enum Paint {
/// A solid color.
Solid(Color),
/// A ... | rust | Apache-2.0 | a87f4b15ca86a0b2f98948d8f393608070ed731e | 2026-01-04T15:31:59.400510Z | false |
typst/typst | https://github.com/typst/typst/blob/a87f4b15ca86a0b2f98948d8f393608070ed731e/crates/typst-library/src/visualize/path.rs | crates/typst-library/src/visualize/path.rs | use self::PathVertex::{AllControlPoints, MirroredControlPoint, Vertex};
use crate::diag::bail;
use crate::foundations::{Array, Reflect, Smart, array, cast, elem};
use crate::layout::{Axes, Length, Rel};
use crate::visualize::{FillRule, Paint, Stroke};
/// A path through a list of points, connected by Bézier curves.
//... | rust | Apache-2.0 | a87f4b15ca86a0b2f98948d8f393608070ed731e | 2026-01-04T15:31:59.400510Z | false |
typst/typst | https://github.com/typst/typst/blob/a87f4b15ca86a0b2f98948d8f393608070ed731e/crates/typst-library/src/visualize/shape.rs | crates/typst-library/src/visualize/shape.rs | use crate::foundations::{Cast, Content, Smart, elem};
use crate::layout::{Abs, Corners, Length, Point, Rect, Rel, Sides, Size, Sizing};
use crate::visualize::{Curve, FixedStroke, Paint, Stroke};
/// A rectangle with optional content.
///
/// # Example
/// ```example
/// // Without content.
/// #rect(width: 35%, height... | rust | Apache-2.0 | a87f4b15ca86a0b2f98948d8f393608070ed731e | 2026-01-04T15:31:59.400510Z | false |
typst/typst | https://github.com/typst/typst/blob/a87f4b15ca86a0b2f98948d8f393608070ed731e/crates/typst-library/src/visualize/curve.rs | crates/typst-library/src/visualize/curve.rs | use kurbo::ParamCurveExtrema;
use typst_macros::{Cast, scope};
use typst_utils::Numeric;
use crate::diag::{HintedStrResult, HintedString, bail};
use crate::foundations::{Content, Packed, Smart, cast, elem};
use crate::layout::{Abs, Axes, Length, Point, Rect, Rel, Size};
use crate::visualize::{FillRule, Paint, Stroke};... | rust | Apache-2.0 | a87f4b15ca86a0b2f98948d8f393608070ed731e | 2026-01-04T15:31:59.400510Z | false |
typst/typst | https://github.com/typst/typst/blob/a87f4b15ca86a0b2f98948d8f393608070ed731e/crates/typst-library/src/visualize/polygon.rs | crates/typst-library/src/visualize/polygon.rs | use std::f64::consts::PI;
use typst_syntax::Span;
use crate::foundations::{Content, NativeElement, Smart, elem, func, scope};
use crate::layout::{Axes, Em, Length, Rel};
use crate::visualize::{FillRule, Paint, Stroke};
/// A closed polygon.
///
/// The polygon is defined by its corner points and is closed automatica... | rust | Apache-2.0 | a87f4b15ca86a0b2f98948d8f393608070ed731e | 2026-01-04T15:31:59.400510Z | false |
typst/typst | https://github.com/typst/typst/blob/a87f4b15ca86a0b2f98948d8f393608070ed731e/crates/typst-library/src/visualize/mod.rs | crates/typst-library/src/visualize/mod.rs | //! Drawing and visualization.
mod color;
mod curve;
mod gradient;
mod image;
mod line;
mod paint;
mod path;
mod polygon;
mod shape;
mod stroke;
mod tiling;
pub use self::color::*;
pub use self::curve::*;
pub use self::gradient::*;
pub use self::image::*;
pub use self::line::*;
pub use self::paint::*;
pub use self::p... | rust | Apache-2.0 | a87f4b15ca86a0b2f98948d8f393608070ed731e | 2026-01-04T15:31:59.400510Z | false |
typst/typst | https://github.com/typst/typst/blob/a87f4b15ca86a0b2f98948d8f393608070ed731e/crates/typst-library/src/visualize/line.rs | crates/typst-library/src/visualize/line.rs | use crate::foundations::elem;
use crate::layout::{Abs, Angle, Axes, Length, Rel};
use crate::visualize::Stroke;
/// A line from one point to another.
///
/// # Example
/// ```example
/// #set page(height: 100pt)
///
/// #line(length: 100%)
/// #line(end: (50%, 50%))
/// #line(
/// length: 4cm,
/// stroke: 2pt + ma... | rust | Apache-2.0 | a87f4b15ca86a0b2f98948d8f393608070ed731e | 2026-01-04T15:31:59.400510Z | false |
typst/typst | https://github.com/typst/typst/blob/a87f4b15ca86a0b2f98948d8f393608070ed731e/crates/typst-library/src/visualize/color.rs | crates/typst-library/src/visualize/color.rs | use std::fmt::{self, Debug, Formatter};
use std::hash::{Hash, Hasher};
use std::str::FromStr;
use std::sync::LazyLock;
use ecow::{EcoString, EcoVec, eco_format};
use palette::encoding::{self, Linear};
use palette::{
Alpha, Darken, Desaturate, FromColor, Lighten, OklabHue, RgbHue, Saturate, ShiftHue,
};
use qcms::P... | rust | Apache-2.0 | a87f4b15ca86a0b2f98948d8f393608070ed731e | 2026-01-04T15:31:59.400510Z | true |
typst/typst | https://github.com/typst/typst/blob/a87f4b15ca86a0b2f98948d8f393608070ed731e/crates/typst-library/src/visualize/tiling.rs | crates/typst-library/src/visualize/tiling.rs | use std::hash::Hash;
use std::sync::Arc;
use ecow::{EcoString, eco_format};
use typst_syntax::{Span, Spanned};
use typst_utils::{LazyHash, Numeric};
use crate::World;
use crate::diag::{SourceResult, bail};
use crate::engine::Engine;
use crate::foundations::{Content, Repr, Smart, StyleChain, func, scope, ty};
use crat... | rust | Apache-2.0 | a87f4b15ca86a0b2f98948d8f393608070ed731e | 2026-01-04T15:31:59.400510Z | false |
typst/typst | https://github.com/typst/typst/blob/a87f4b15ca86a0b2f98948d8f393608070ed731e/crates/typst-library/src/visualize/gradient.rs | crates/typst-library/src/visualize/gradient.rs | use std::f64::consts::{FRAC_PI_2, PI, TAU};
use std::fmt::{self, Debug, Formatter};
use std::hash::Hash;
use std::sync::Arc;
use ecow::EcoString;
use kurbo::Vec2;
use typst_syntax::{Span, Spanned};
use crate::diag::{SourceResult, bail};
use crate::foundations::{
Args, Array, Cast, Func, IntoValue, Repr, Smart, ar... | rust | Apache-2.0 | a87f4b15ca86a0b2f98948d8f393608070ed731e | 2026-01-04T15:31:59.400510Z | true |
typst/typst | https://github.com/typst/typst/blob/a87f4b15ca86a0b2f98948d8f393608070ed731e/crates/typst-library/src/visualize/image/svg.rs | crates/typst-library/src/visualize/image/svg.rs | use std::hash::{Hash, Hasher};
use std::sync::{Arc, Mutex};
use comemo::Tracked;
use ecow::{EcoString, eco_format};
use rustc_hash::FxHashMap;
use siphasher::sip128::{Hasher128, SipHasher13};
use typst_syntax::FileId;
use crate::World;
use crate::diag::{FileError, LoadError, LoadResult, ReportPos, format_xml_like_err... | rust | Apache-2.0 | a87f4b15ca86a0b2f98948d8f393608070ed731e | 2026-01-04T15:31:59.400510Z | false |
typst/typst | https://github.com/typst/typst/blob/a87f4b15ca86a0b2f98948d8f393608070ed731e/crates/typst-library/src/visualize/image/mod.rs | crates/typst-library/src/visualize/image/mod.rs | //! Image handling.
mod pdf;
mod raster;
mod svg;
pub use self::pdf::PdfImage;
pub use self::raster::{
ExchangeFormat, PixelEncoding, PixelFormat, RasterFormat, RasterImage,
};
pub use self::svg::SvgImage;
use std::ffi::OsStr;
use std::fmt::{self, Debug, Formatter};
use std::num::NonZeroUsize;
use std::sync::Arc... | rust | Apache-2.0 | a87f4b15ca86a0b2f98948d8f393608070ed731e | 2026-01-04T15:31:59.400510Z | false |
typst/typst | https://github.com/typst/typst/blob/a87f4b15ca86a0b2f98948d8f393608070ed731e/crates/typst-library/src/visualize/image/pdf.rs | crates/typst-library/src/visualize/image/pdf.rs | use std::hash::{Hash, Hasher};
use std::sync::Arc;
use hayro_syntax::page::Page;
use hayro_syntax::{LoadPdfError, Pdf};
use crate::foundations::Bytes;
/// A PDF document.
#[derive(Clone, Hash)]
pub struct PdfDocument(Arc<PdfDocumentInner>);
/// The internal representation of a [`PdfDocument`].
struct PdfDocumentInn... | rust | Apache-2.0 | a87f4b15ca86a0b2f98948d8f393608070ed731e | 2026-01-04T15:31:59.400510Z | false |
typst/typst | https://github.com/typst/typst/blob/a87f4b15ca86a0b2f98948d8f393608070ed731e/crates/typst-library/src/visualize/image/raster.rs | crates/typst-library/src/visualize/image/raster.rs | use std::cmp::Ordering;
use std::hash::{Hash, Hasher};
use std::io;
use std::sync::Arc;
use crate::diag::{StrResult, bail};
use crate::foundations::{Bytes, Cast, Dict, Smart, Value, cast, dict};
use ecow::{EcoString, eco_format};
use image::codecs::gif::GifDecoder;
use image::codecs::jpeg::JpegDecoder;
use image::code... | rust | Apache-2.0 | a87f4b15ca86a0b2f98948d8f393608070ed731e | 2026-01-04T15:31:59.400510Z | false |
typst/typst | https://github.com/typst/typst/blob/a87f4b15ca86a0b2f98948d8f393608070ed731e/crates/typst-library/src/text/case.rs | crates/typst-library/src/text/case.rs | use crate::foundations::{Cast, Content, Str, cast, func};
use crate::text::TextElem;
/// Converts a string or content to lowercase.
///
/// # Example
/// ```example
/// #lower("ABC") \
/// #lower[*My Text*] \
/// #lower[already low]
/// ```
#[func(title = "Lowercase")]
pub fn lower(
/// The text to convert to lowe... | rust | Apache-2.0 | a87f4b15ca86a0b2f98948d8f393608070ed731e | 2026-01-04T15:31:59.400510Z | false |
typst/typst | https://github.com/typst/typst/blob/a87f4b15ca86a0b2f98948d8f393608070ed731e/crates/typst-library/src/text/linebreak.rs | crates/typst-library/src/text/linebreak.rs | use typst_utils::singleton;
use crate::foundations::{Content, NativeElement, elem};
/// Inserts a line break.
///
/// Advances the paragraph to the next line. A single trailing line break at the
/// end of a paragraph is ignored, but more than one creates additional empty
/// lines.
///
/// # Example
/// ```example
/... | rust | Apache-2.0 | a87f4b15ca86a0b2f98948d8f393608070ed731e | 2026-01-04T15:31:59.400510Z | false |
typst/typst | https://github.com/typst/typst/blob/a87f4b15ca86a0b2f98948d8f393608070ed731e/crates/typst-library/src/text/lorem.rs | crates/typst-library/src/text/lorem.rs | use crate::foundations::{Str, func};
/// Creates blind text.
///
/// 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
/// the same but randomly chosen. As usual for blind texts, it does not make any
/// sense. Use i... | rust | Apache-2.0 | a87f4b15ca86a0b2f98948d8f393608070ed731e | 2026-01-04T15:31:59.400510Z | false |
typst/typst | https://github.com/typst/typst/blob/a87f4b15ca86a0b2f98948d8f393608070ed731e/crates/typst-library/src/text/smallcaps.rs | crates/typst-library/src/text/smallcaps.rs | use crate::foundations::{Content, elem};
/// Displays text in small capitals.
///
/// # Example
/// ```example
/// Hello \
/// #smallcaps[Hello]
/// ```
///
/// # Smallcaps fonts
/// By default, this uses the `smcp` and `c2sc` OpenType features on the font.
/// Not all fonts support these features. Sometimes, smallcap... | rust | Apache-2.0 | a87f4b15ca86a0b2f98948d8f393608070ed731e | 2026-01-04T15:31:59.400510Z | false |
typst/typst | https://github.com/typst/typst/blob/a87f4b15ca86a0b2f98948d8f393608070ed731e/crates/typst-library/src/text/smartquote.rs | crates/typst-library/src/text/smartquote.rs | use ecow::EcoString;
use typst_syntax::is_newline;
use unicode_segmentation::UnicodeSegmentation;
use crate::diag::{HintedStrResult, StrResult, bail};
use crate::foundations::{
Array, Dict, FromValue, Packed, PlainText, Smart, Str, StyleChain, array, cast, dict,
elem,
};
use crate::layout::Dir;
use crate::text... | rust | Apache-2.0 | a87f4b15ca86a0b2f98948d8f393608070ed731e | 2026-01-04T15:31:59.400510Z | false |
typst/typst | https://github.com/typst/typst/blob/a87f4b15ca86a0b2f98948d8f393608070ed731e/crates/typst-library/src/text/shift.rs | crates/typst-library/src/text/shift.rs | use crate::introspection::Tagged;
use ttf_parser::Tag;
use crate::foundations::{Content, Smart, elem};
use crate::layout::{Em, Length};
use crate::text::{FontMetrics, ScriptMetrics, TextSize};
/// Renders text in subscript.
///
/// The text is rendered smaller and its baseline is lowered.
///
/// # Example
/// ```exa... | rust | Apache-2.0 | a87f4b15ca86a0b2f98948d8f393608070ed731e | 2026-01-04T15:31:59.400510Z | false |
typst/typst | https://github.com/typst/typst/blob/a87f4b15ca86a0b2f98948d8f393608070ed731e/crates/typst-library/src/text/raw.rs | crates/typst-library/src/text/raw.rs | use std::cell::LazyCell;
use std::ops::Range;
use std::sync::{Arc, LazyLock};
use comemo::Tracked;
use ecow::{EcoString, EcoVec};
use syntect::highlighting::{self as synt};
use syntect::parsing::{ParseSyntaxError, SyntaxDefinition, SyntaxSet, SyntaxSetBuilder};
use typst_syntax::{LinkedNode, Span, Spanned, split_newli... | rust | Apache-2.0 | a87f4b15ca86a0b2f98948d8f393608070ed731e | 2026-01-04T15:31:59.400510Z | false |
typst/typst | https://github.com/typst/typst/blob/a87f4b15ca86a0b2f98948d8f393608070ed731e/crates/typst-library/src/text/mod.rs | crates/typst-library/src/text/mod.rs | //! Text handling.
mod case;
mod deco;
mod font;
mod item;
mod lang;
mod linebreak;
#[path = "lorem.rs"]
mod lorem_;
mod raw;
mod shift;
#[path = "smallcaps.rs"]
mod smallcaps_;
mod smartquote;
mod space;
pub use self::case::*;
pub use self::deco::*;
pub use self::font::*;
pub use self::item::*;
pub use self::lang::*... | rust | Apache-2.0 | a87f4b15ca86a0b2f98948d8f393608070ed731e | 2026-01-04T15:31:59.400510Z | true |
typst/typst | https://github.com/typst/typst/blob/a87f4b15ca86a0b2f98948d8f393608070ed731e/crates/typst-library/src/text/item.rs | crates/typst-library/src/text/item.rs | use std::fmt::{self, Debug, Formatter};
use std::ops::Range;
use ecow::EcoString;
use typst_syntax::Span;
use crate::layout::{Abs, Em, Point, Rect};
use crate::text::{Font, Lang, Region, is_default_ignorable};
use crate::visualize::{FixedStroke, Paint};
/// A run of shaped text.
#[derive(Clone, Eq, PartialEq, Hash)]... | rust | Apache-2.0 | a87f4b15ca86a0b2f98948d8f393608070ed731e | 2026-01-04T15:31:59.400510Z | false |
typst/typst | https://github.com/typst/typst/blob/a87f4b15ca86a0b2f98948d8f393608070ed731e/crates/typst-library/src/text/space.rs | crates/typst-library/src/text/space.rs | use ecow::EcoString;
use typst_utils::singleton;
use crate::foundations::{
Content, NativeElement, Packed, PlainText, Repr, Unlabellable, elem,
};
/// A text space.
#[elem(Unlabellable, PlainText, Repr)]
pub struct SpaceElem {}
impl SpaceElem {
/// Get the globally shared space element.
pub fn shared() -... | rust | Apache-2.0 | a87f4b15ca86a0b2f98948d8f393608070ed731e | 2026-01-04T15:31:59.400510Z | false |
typst/typst | https://github.com/typst/typst/blob/a87f4b15ca86a0b2f98948d8f393608070ed731e/crates/typst-library/src/text/deco.rs | crates/typst-library/src/text/deco.rs | use crate::foundations::{Content, Smart, elem};
use crate::introspection::{Locatable, Tagged};
use crate::layout::{Abs, Corners, Length, Rel, Sides};
use crate::text::{BottomEdge, BottomEdgeMetric, TopEdge, TopEdgeMetric};
use crate::visualize::{Color, FixedStroke, Paint, Stroke};
/// Underlines text.
///
/// # Exampl... | rust | Apache-2.0 | a87f4b15ca86a0b2f98948d8f393608070ed731e | 2026-01-04T15:31:59.400510Z | false |
typst/typst | https://github.com/typst/typst/blob/a87f4b15ca86a0b2f98948d8f393608070ed731e/crates/typst-library/src/text/lang.rs | crates/typst-library/src/text/lang.rs | use std::str::FromStr;
use ecow::{EcoString, eco_format};
use rustc_hash::FxHashMap;
use crate::diag::Hint;
use crate::foundations::{StyleChain, cast};
use crate::layout::Dir;
use crate::text::TextElem;
macro_rules! translation {
($lang:literal) => {
($lang, include_str!(concat!("../../translations/", $l... | rust | Apache-2.0 | a87f4b15ca86a0b2f98948d8f393608070ed731e | 2026-01-04T15:31:59.400510Z | false |
typst/typst | https://github.com/typst/typst/blob/a87f4b15ca86a0b2f98948d8f393608070ed731e/crates/typst-library/src/text/font/mod.rs | crates/typst-library/src/text/font/mod.rs | //! Font handling.
pub mod color;
mod book;
mod exceptions;
mod variant;
pub use self::book::{Coverage, FontBook, FontFlags, FontInfo};
pub use self::variant::{FontStretch, FontStyle, FontVariant, FontWeight};
use std::cell::OnceCell;
use std::fmt::{self, Debug, Formatter};
use std::hash::{Hash, Hasher};
use std::s... | rust | Apache-2.0 | a87f4b15ca86a0b2f98948d8f393608070ed731e | 2026-01-04T15:31:59.400510Z | false |
typst/typst | https://github.com/typst/typst/blob/a87f4b15ca86a0b2f98948d8f393608070ed731e/crates/typst-library/src/text/font/color.rs | crates/typst-library/src/text/font/color.rs | //! Utilities for color font handling
use std::io::Read;
use ttf_parser::{GlyphId, RgbaColor};
use typst_syntax::Span;
use usvg::tiny_skia_path;
use xmlwriter::XmlWriter;
use crate::foundations::Bytes;
use crate::layout::{Abs, Frame, FrameItem, Point, Size};
use crate::text::{Font, Glyph};
use crate::visualize::{
... | rust | Apache-2.0 | a87f4b15ca86a0b2f98948d8f393608070ed731e | 2026-01-04T15:31:59.400510Z | false |
typst/typst | https://github.com/typst/typst/blob/a87f4b15ca86a0b2f98948d8f393608070ed731e/crates/typst-library/src/text/font/book.rs | crates/typst-library/src/text/font/book.rs | use std::cmp::Reverse;
use std::collections::BTreeMap;
use std::fmt::{self, Debug, Formatter};
use serde::{Deserialize, Serialize};
use ttf_parser::{PlatformId, Tag, name_id};
use unicode_segmentation::UnicodeSegmentation;
use super::exceptions::find_exception;
use crate::text::{
Font, FontStretch, FontStyle, Fon... | rust | Apache-2.0 | a87f4b15ca86a0b2f98948d8f393608070ed731e | 2026-01-04T15:31:59.400510Z | false |
typst/typst | https://github.com/typst/typst/blob/a87f4b15ca86a0b2f98948d8f393608070ed731e/crates/typst-library/src/text/font/exceptions.rs | crates/typst-library/src/text/font/exceptions.rs | use serde::Deserialize;
use super::{FontStretch, FontStyle, FontWeight};
pub fn find_exception(postscript_name: &str) -> Option<&'static Exception> {
EXCEPTION_MAP.get(postscript_name)
}
#[derive(Debug, Default, Deserialize)]
pub struct Exception {
pub family: Option<&'static str>,
pub style: Option<Font... | rust | Apache-2.0 | a87f4b15ca86a0b2f98948d8f393608070ed731e | 2026-01-04T15:31:59.400510Z | false |
typst/typst | https://github.com/typst/typst/blob/a87f4b15ca86a0b2f98948d8f393608070ed731e/crates/typst-library/src/text/font/variant.rs | crates/typst-library/src/text/font/variant.rs | use std::fmt::{self, Debug, Formatter};
use ecow::EcoString;
use serde::{Deserialize, Serialize};
use crate::foundations::{Cast, IntoValue, Repr, cast};
use crate::layout::Ratio;
/// Properties that distinguish a font from other fonts in the same family.
#[derive(Default, Copy, Clone, Eq, PartialEq, Ord, PartialOrd,... | rust | Apache-2.0 | a87f4b15ca86a0b2f98948d8f393608070ed731e | 2026-01-04T15:31:59.400510Z | false |
typst/typst | https://github.com/typst/typst/blob/a87f4b15ca86a0b2f98948d8f393608070ed731e/crates/typst-library/src/loading/json.rs | crates/typst-library/src/loading/json.rs | use ecow::eco_format;
use typst_syntax::Spanned;
use crate::diag::{At, LineCol, LoadError, LoadedWithin, SourceResult, bail};
use crate::engine::Engine;
use crate::foundations::{Str, Value, func, scope};
use crate::loading::{DataSource, Load, Readable};
/// Reads structured data from a JSON file.
///
/// The file mus... | rust | Apache-2.0 | a87f4b15ca86a0b2f98948d8f393608070ed731e | 2026-01-04T15:31:59.400510Z | false |
typst/typst | https://github.com/typst/typst/blob/a87f4b15ca86a0b2f98948d8f393608070ed731e/crates/typst-library/src/loading/xml.rs | crates/typst-library/src/loading/xml.rs | use roxmltree::ParsingOptions;
use typst_syntax::Spanned;
use crate::diag::{LoadError, LoadedWithin, SourceResult, format_xml_like_error};
use crate::engine::Engine;
use crate::foundations::{Array, Dict, IntoValue, Str, Value, dict, func, scope};
use crate::loading::{DataSource, Load, Readable};
/// Reads structured ... | rust | Apache-2.0 | a87f4b15ca86a0b2f98948d8f393608070ed731e | 2026-01-04T15:31:59.400510Z | false |
typst/typst | https://github.com/typst/typst/blob/a87f4b15ca86a0b2f98948d8f393608070ed731e/crates/typst-library/src/loading/cbor.rs | crates/typst-library/src/loading/cbor.rs | use ecow::eco_format;
use typst_syntax::Spanned;
use crate::diag::{At, SourceResult};
use crate::engine::Engine;
use crate::foundations::{Bytes, Value, func, scope};
use crate::loading::{DataSource, Load};
/// Reads structured data from a CBOR file.
///
/// The file must contain a valid CBOR serialization. The CBOR v... | rust | Apache-2.0 | a87f4b15ca86a0b2f98948d8f393608070ed731e | 2026-01-04T15:31:59.400510Z | false |
typst/typst | https://github.com/typst/typst/blob/a87f4b15ca86a0b2f98948d8f393608070ed731e/crates/typst-library/src/loading/mod.rs | crates/typst-library/src/loading/mod.rs | //! Data loading.
#[path = "cbor.rs"]
mod cbor_;
#[path = "csv.rs"]
mod csv_;
#[path = "json.rs"]
mod json_;
#[path = "read.rs"]
mod read_;
#[path = "toml.rs"]
mod toml_;
#[path = "xml.rs"]
mod xml_;
#[path = "yaml.rs"]
mod yaml_;
use comemo::Tracked;
use ecow::EcoString;
use typst_syntax::{FileId, Spanned};
pub use... | rust | Apache-2.0 | a87f4b15ca86a0b2f98948d8f393608070ed731e | 2026-01-04T15:31:59.400510Z | false |
typst/typst | https://github.com/typst/typst/blob/a87f4b15ca86a0b2f98948d8f393608070ed731e/crates/typst-library/src/loading/yaml.rs | crates/typst-library/src/loading/yaml.rs | use ecow::eco_format;
use typst_syntax::Spanned;
use crate::diag::{At, LineCol, LoadError, LoadedWithin, ReportPos, SourceResult};
use crate::engine::Engine;
use crate::foundations::{Str, Value, func, scope};
use crate::loading::{DataSource, Load, Readable};
/// Reads structured data from a YAML file.
///
/// The fil... | rust | Apache-2.0 | a87f4b15ca86a0b2f98948d8f393608070ed731e | 2026-01-04T15:31:59.400510Z | false |
typst/typst | https://github.com/typst/typst/blob/a87f4b15ca86a0b2f98948d8f393608070ed731e/crates/typst-library/src/loading/csv.rs | crates/typst-library/src/loading/csv.rs | use az::SaturatingAs;
use typst_syntax::Spanned;
use crate::diag::{LineCol, LoadError, LoadedWithin, ReportPos, SourceResult, bail};
use crate::engine::Engine;
use crate::foundations::{Array, Dict, IntoValue, Type, Value, cast, func, scope};
use crate::loading::{DataSource, Load, Readable};
/// Reads structured data ... | rust | Apache-2.0 | a87f4b15ca86a0b2f98948d8f393608070ed731e | 2026-01-04T15:31:59.400510Z | false |
typst/typst | https://github.com/typst/typst/blob/a87f4b15ca86a0b2f98948d8f393608070ed731e/crates/typst-library/src/loading/read.rs | crates/typst-library/src/loading/read.rs | use ecow::EcoString;
use typst_syntax::Spanned;
use crate::diag::{LoadedWithin, SourceResult};
use crate::engine::Engine;
use crate::foundations::{Cast, func};
use crate::loading::{DataSource, Load, Readable};
/// Reads plain text or data from a file.
///
/// By default, the file will be read as UTF-8 and returned as... | rust | Apache-2.0 | a87f4b15ca86a0b2f98948d8f393608070ed731e | 2026-01-04T15:31:59.400510Z | false |
typst/typst | https://github.com/typst/typst/blob/a87f4b15ca86a0b2f98948d8f393608070ed731e/crates/typst-library/src/loading/toml.rs | crates/typst-library/src/loading/toml.rs | use ecow::eco_format;
use typst_syntax::Spanned;
use crate::diag::{At, LoadError, LoadedWithin, ReportPos, SourceResult};
use crate::engine::Engine;
use crate::foundations::{Dict, Str, func, scope};
use crate::loading::{DataSource, Load, Readable};
/// Reads structured data from a TOML file.
///
/// The file must con... | rust | Apache-2.0 | a87f4b15ca86a0b2f98948d8f393608070ed731e | 2026-01-04T15:31:59.400510Z | false |
typst/typst | https://github.com/typst/typst/blob/a87f4b15ca86a0b2f98948d8f393608070ed731e/crates/typst/src/lib.rs | crates/typst/src/lib.rs | //! The compiler for the _Typst_ markup language.
//!
//! # Steps
//! - **Parsing:**
//! The compiler first transforms a plain string into an iterator of [tokens].
//! This token stream is [parsed] into a [syntax tree]. The tree itself is
//! untyped, but the [AST] module provides a typed layer over it.
//! - **E... | rust | Apache-2.0 | a87f4b15ca86a0b2f98948d8f393608070ed731e | 2026-01-04T15:31:59.400510Z | false |
typst/typst | https://github.com/typst/typst/blob/a87f4b15ca86a0b2f98948d8f393608070ed731e/crates/typst-cli/build.rs | crates/typst-cli/build.rs | use std::env;
use std::fs::{File, create_dir_all};
use std::path::Path;
use clap::{CommandFactory, ValueEnum};
use clap_complete::{Shell, generate_to};
use clap_mangen::Man;
#[path = "src/args.rs"]
#[allow(dead_code)]
mod args;
fn main() {
// https://stackoverflow.com/a/51311222/11494565
println!("cargo:rust... | rust | Apache-2.0 | a87f4b15ca86a0b2f98948d8f393608070ed731e | 2026-01-04T15:31:59.400510Z | false |
typst/typst | https://github.com/typst/typst/blob/a87f4b15ca86a0b2f98948d8f393608070ed731e/crates/typst-cli/src/timings.rs | crates/typst-cli/src/timings.rs | use std::fs::File;
use std::io::BufWriter;
use std::path::{Path, PathBuf};
use typst::World;
use typst::diag::{HintedStrResult, bail};
use typst::syntax::Span;
use crate::args::{CliArguments, Command};
use crate::world::SystemWorld;
/// Allows to record timings of function executions.
pub struct Timer {
/// Wher... | rust | Apache-2.0 | a87f4b15ca86a0b2f98948d8f393608070ed731e | 2026-01-04T15:31:59.400510Z | false |
typst/typst | https://github.com/typst/typst/blob/a87f4b15ca86a0b2f98948d8f393608070ed731e/crates/typst-cli/src/download.rs | crates/typst-cli/src/download.rs | use std::fmt::Display;
use std::io;
use std::io::Write;
use std::time::{Duration, Instant};
use codespan_reporting::term;
use codespan_reporting::term::termcolor::WriteColor;
use typst::utils::format_duration;
use typst_kit::download::{DownloadState, Downloader, Progress};
use crate::ARGS;
use crate::terminal::{self,... | rust | Apache-2.0 | a87f4b15ca86a0b2f98948d8f393608070ed731e | 2026-01-04T15:31:59.400510Z | false |
typst/typst | https://github.com/typst/typst/blob/a87f4b15ca86a0b2f98948d8f393608070ed731e/crates/typst-cli/src/world.rs | crates/typst-cli/src/world.rs | use std::io::Read;
use std::path::{Path, PathBuf};
use std::sync::{LazyLock, OnceLock};
use std::{fmt, fs, io, mem};
use chrono::{DateTime, Datelike, FixedOffset, Local, Utc};
use ecow::{EcoString, eco_format};
use parking_lot::Mutex;
use rustc_hash::FxHashMap;
use typst::diag::{FileError, FileResult};
use typst::foun... | rust | Apache-2.0 | a87f4b15ca86a0b2f98948d8f393608070ed731e | 2026-01-04T15:31:59.400510Z | false |
typst/typst | https://github.com/typst/typst/blob/a87f4b15ca86a0b2f98948d8f393608070ed731e/crates/typst-cli/src/update.rs | crates/typst-cli/src/update.rs | use std::io::{Cursor, Read, Write};
use std::path::PathBuf;
use std::{env, fs};
use ecow::eco_format;
use semver::Version;
use serde::Deserialize;
use tempfile::NamedTempFile;
use typst::diag::{StrResult, bail};
use typst_kit::download::Downloader;
use xz2::bufread::XzDecoder;
use zip::ZipArchive;
use crate::args::Up... | rust | Apache-2.0 | a87f4b15ca86a0b2f98948d8f393608070ed731e | 2026-01-04T15:31:59.400510Z | false |
typst/typst | https://github.com/typst/typst/blob/a87f4b15ca86a0b2f98948d8f393608070ed731e/crates/typst-cli/src/compile.rs | crates/typst-cli/src/compile.rs | use std::ffi::OsStr;
use std::path::Path;
use chrono::{DateTime, Datelike, Timelike, Utc};
use codespan_reporting::diagnostic::{Diagnostic, Label};
use codespan_reporting::term;
use ecow::eco_format;
use parking_lot::RwLock;
use rayon::iter::{IntoParallelRefIterator, ParallelIterator};
use typst::WorldExt;
use typst::... | rust | Apache-2.0 | a87f4b15ca86a0b2f98948d8f393608070ed731e | 2026-01-04T15:31:59.400510Z | false |
typst/typst | https://github.com/typst/typst/blob/a87f4b15ca86a0b2f98948d8f393608070ed731e/crates/typst-cli/src/fonts.rs | crates/typst-cli/src/fonts.rs | use typst::text::FontVariant;
use typst_kit::fonts::Fonts;
use crate::args::FontsCommand;
/// Execute a font listing command.
pub fn fonts(command: &FontsCommand) {
let mut fonts = Fonts::searcher();
fonts.include_system_fonts(!command.font.ignore_system_fonts);
#[cfg(feature = "embed-fonts")]
fonts.i... | rust | Apache-2.0 | a87f4b15ca86a0b2f98948d8f393608070ed731e | 2026-01-04T15:31:59.400510Z | false |
typst/typst | https://github.com/typst/typst/blob/a87f4b15ca86a0b2f98948d8f393608070ed731e/crates/typst-cli/src/args.rs | crates/typst-cli/src/args.rs | // This module is imported both from the `typst-cli` crate itself
// and from its build script. In this module, you can only import from crates
// that are both runtime and build dependencies of this crate, or else
// Rust will give a confusing error message about a missing crate.
use std::fmt::{self, Display, Formatt... | rust | Apache-2.0 | a87f4b15ca86a0b2f98948d8f393608070ed731e | 2026-01-04T15:31:59.400510Z | false |
typst/typst | https://github.com/typst/typst/blob/a87f4b15ca86a0b2f98948d8f393608070ed731e/crates/typst-cli/src/greet.rs | crates/typst-cli/src/greet.rs | use std::io::{self, Read};
/// This is shown to users who just type `typst` the first time.
#[rustfmt::skip]
const GREETING: &str = color_print::cstr!("\
<s>Welcome to Typst, we are glad to have you here!</> ❤️
If you are new to Typst, <s>start with the tutorial</> at \
<u>https://typst.app/docs/tutorial/</>. To get ... | rust | Apache-2.0 | a87f4b15ca86a0b2f98948d8f393608070ed731e | 2026-01-04T15:31:59.400510Z | false |
typst/typst | https://github.com/typst/typst/blob/a87f4b15ca86a0b2f98948d8f393608070ed731e/crates/typst-cli/src/info.rs | crates/typst-cli/src/info.rs | use std::env::VarError;
use std::fmt::Display;
use std::io::{self, Write};
use std::path::{Path, PathBuf};
use clap::builder::{FalseyValueParser, TypedValueParser};
use clap::{CommandFactory, ValueEnum};
use codespan_reporting::term::termcolor::{Color, ColorSpec, WriteColor};
use ecow::eco_format;
use serde::Serialize... | rust | Apache-2.0 | a87f4b15ca86a0b2f98948d8f393608070ed731e | 2026-01-04T15:31:59.400510Z | false |
typst/typst | https://github.com/typst/typst/blob/a87f4b15ca86a0b2f98948d8f393608070ed731e/crates/typst-cli/src/deps.rs | crates/typst-cli/src/deps.rs | use std::io::{self, Write};
use std::path::PathBuf;
use serde::Serialize;
use crate::args::{DepsFormat, Output};
use crate::world::SystemWorld;
/// Writes dependencies in the given format.
pub fn write_deps(
world: &mut SystemWorld,
dest: &Output,
format: DepsFormat,
outputs: Option<&[Output]>,
) -> ... | rust | Apache-2.0 | a87f4b15ca86a0b2f98948d8f393608070ed731e | 2026-01-04T15:31:59.400510Z | false |
typst/typst | https://github.com/typst/typst/blob/a87f4b15ca86a0b2f98948d8f393608070ed731e/crates/typst-cli/src/watch.rs | crates/typst-cli/src/watch.rs | use std::io::{self, Write};
use std::iter;
use std::path::PathBuf;
use std::sync::mpsc::Receiver;
use std::time::{Duration, Instant};
use codespan_reporting::term::termcolor::WriteColor;
use codespan_reporting::term::{self, termcolor};
use ecow::eco_format;
use notify::{Event, RecommendedWatcher, RecursiveMode, Watche... | rust | Apache-2.0 | a87f4b15ca86a0b2f98948d8f393608070ed731e | 2026-01-04T15:31:59.400510Z | false |
typst/typst | https://github.com/typst/typst/blob/a87f4b15ca86a0b2f98948d8f393608070ed731e/crates/typst-cli/src/terminal.rs | crates/typst-cli/src/terminal.rs | use std::io::{self, IsTerminal, Write};
use codespan_reporting::term::termcolor;
use termcolor::{ColorChoice, WriteColor};
use typst::utils::singleton;
use crate::ARGS;
/// Returns a handle to the optionally colored terminal output.
pub fn out() -> TermOut {
TermOut {
inner: singleton!(TermOutInner, Term... | rust | Apache-2.0 | a87f4b15ca86a0b2f98948d8f393608070ed731e | 2026-01-04T15:31:59.400510Z | false |
typst/typst | https://github.com/typst/typst/blob/a87f4b15ca86a0b2f98948d8f393608070ed731e/crates/typst-cli/src/init.rs | crates/typst-cli/src/init.rs | use std::io::Write;
use std::path::Path;
use codespan_reporting::term::termcolor::{Color, ColorSpec, WriteColor};
use ecow::eco_format;
use fs_extra::dir::CopyOptions;
use typst::diag::{FileError, StrResult, bail};
use typst::syntax::package::{
PackageManifest, PackageSpec, TemplateInfo, VersionlessPackageSpec,
};... | rust | Apache-2.0 | a87f4b15ca86a0b2f98948d8f393608070ed731e | 2026-01-04T15:31:59.400510Z | false |
typst/typst | https://github.com/typst/typst/blob/a87f4b15ca86a0b2f98948d8f393608070ed731e/crates/typst-cli/src/completions.rs | crates/typst-cli/src/completions.rs | use std::io::stdout;
use clap::CommandFactory;
use clap_complete::generate;
use crate::args::{CliArguments, CompletionsCommand};
/// Execute the completions command.
pub fn completions(command: &CompletionsCommand) {
let mut cmd = CliArguments::command();
let bin_name = cmd.get_name().to_string();
genera... | rust | Apache-2.0 | a87f4b15ca86a0b2f98948d8f393608070ed731e | 2026-01-04T15:31:59.400510Z | false |
typst/typst | https://github.com/typst/typst/blob/a87f4b15ca86a0b2f98948d8f393608070ed731e/crates/typst-cli/src/eval.rs | crates/typst-cli/src/eval.rs | use comemo::Track;
use ecow::eco_format;
use typst::diag::{HintedStrResult, SourceResult, Warned};
use typst::foundations::{Context, Scope, StyleChain, Value};
use typst::syntax::{Span, SyntaxMode};
use typst::{World, engine::Sink, introspection::Introspector, layout::PagedDocument};
use typst_eval::eval_string;
use ty... | rust | Apache-2.0 | a87f4b15ca86a0b2f98948d8f393608070ed731e | 2026-01-04T15:31:59.400510Z | false |
typst/typst | https://github.com/typst/typst/blob/a87f4b15ca86a0b2f98948d8f393608070ed731e/crates/typst-cli/src/server.rs | crates/typst-cli/src/server.rs | use std::io::{self, Write};
use std::net::{IpAddr, Ipv4Addr, SocketAddr, TcpListener};
use std::sync::Arc;
use ecow::eco_format;
use parking_lot::{Condvar, Mutex, MutexGuard};
use tiny_http::{Header, Request, Response, StatusCode};
use typst::diag::{StrResult, bail};
use crate::args::{Input, ServerArgs};
/// Serves ... | rust | Apache-2.0 | a87f4b15ca86a0b2f98948d8f393608070ed731e | 2026-01-04T15:31:59.400510Z | false |
typst/typst | https://github.com/typst/typst/blob/a87f4b15ca86a0b2f98948d8f393608070ed731e/crates/typst-cli/src/query.rs | crates/typst-cli/src/query.rs | use std::fmt::Write;
use comemo::Track;
use ecow::{EcoString, eco_format};
use typst::World;
use typst::diag::{HintedStrResult, SourceDiagnostic, StrResult, Warned, bail};
use typst::engine::Sink;
use typst::foundations::{Content, Context, IntoValue, LocatableSelector, Repr, Scope};
use typst::introspection::Introspec... | rust | Apache-2.0 | a87f4b15ca86a0b2f98948d8f393608070ed731e | 2026-01-04T15:31:59.400510Z | false |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.