diff --git a/crates/typst-ide/src/lib.rs b/crates/typst-ide/src/lib.rs index 173a4264b..bbfd56d95 100644 --- a/crates/typst-ide/src/lib.rs +++ b/crates/typst-ide/src/lib.rs @@ -1,4 +1,4 @@ -//! Capabilities for IDE support. +//! Capabilities for Typst IDE support. mod analyze; mod complete; diff --git a/crates/typst-pdf/src/lib.rs b/crates/typst-pdf/src/lib.rs index 1e425f015..49ec0d860 100644 --- a/crates/typst-pdf/src/lib.rs +++ b/crates/typst-pdf/src/lib.rs @@ -1,4 +1,4 @@ -//! Exporting into PDF documents. +//! Exporting of Typst documents into PDFs. mod color; mod extg; diff --git a/crates/typst-render/src/lib.rs b/crates/typst-render/src/lib.rs index 6fce5c942..5d116e495 100644 --- a/crates/typst-render/src/lib.rs +++ b/crates/typst-render/src/lib.rs @@ -1,4 +1,4 @@ -//! Rendering into raster images. +//! Rendering of Typst documents into raster images. use std::io::Read; use std::sync::Arc; diff --git a/crates/typst-svg/src/lib.rs b/crates/typst-svg/src/lib.rs index ad8faf290..677f2ba72 100644 --- a/crates/typst-svg/src/lib.rs +++ b/crates/typst-svg/src/lib.rs @@ -1,3 +1,5 @@ +//! Rendering of Typst documents into SVG images. + use std::collections::HashMap; use std::f32::consts::TAU; use std::fmt::{self, Display, Formatter, Write}; diff --git a/crates/typst-syntax/src/ast.rs b/crates/typst-syntax/src/ast.rs index 840024f79..a434e39af 100644 --- a/crates/typst-syntax/src/ast.rs +++ b/crates/typst-syntax/src/ast.rs @@ -179,7 +179,7 @@ pub enum Expr<'a> { Closure(Closure<'a>), /// A let binding: `let x = 1`. Let(LetBinding<'a>), - //// A destructuring assignment: `(x, y) = (1, 2)`. + /// A destructuring assignment: `(x, y) = (1, 2)`. DestructAssign(DestructAssignment<'a>), /// A set rule: `set text(...)`. Set(SetRule<'a>), @@ -844,6 +844,7 @@ node! { } impl MathPrimes<'_> { + /// The number of grouped primes. pub fn count(self) -> usize { self.0 .children() diff --git a/crates/typst/src/eval/tracer.rs b/crates/typst/src/eval/tracer.rs index 833960417..dff519354 100644 --- a/crates/typst/src/eval/tracer.rs +++ b/crates/typst/src/eval/tracer.rs @@ -18,7 +18,7 @@ pub struct Tracer { } impl Tracer { - /// The maximum number of inspeted values. + /// The maximum number of inspected values. pub const MAX_VALUES: usize = 10; /// Create a new tracer. @@ -74,9 +74,9 @@ impl Tracer { } /// Trace a value for the span. - pub fn value(&mut self, v: Value, s: Option) { + pub fn value(&mut self, value: Value, styles: Option) { if self.values.len() < Self::MAX_VALUES { - self.values.push((v, s)); + self.values.push((value, styles)); } } } diff --git a/crates/typst/src/foundations/styles.rs b/crates/typst/src/foundations/styles.rs index 9bdeb4ea0..469cad1af 100644 --- a/crates/typst/src/foundations/styles.rs +++ b/crates/typst/src/foundations/styles.rs @@ -19,16 +19,13 @@ use crate::util::LazyHash; /// Provides access to active styles. /// -/// The styles are currently opaque and only useful in combination with the -/// [`measure`] function. See its documentation for more details. In the future, -/// the provided styles might also be directly accessed to look up styles -/// defined by [set rules]($styling/#set-rules). +/// **Deprecation planned.** Use [context] instead. /// /// ```example -/// #let thing(body) = context { -/// let size = measure(body) +/// #let thing(body) = style(styles => { +/// let size = measure(body, styles) /// [Width of "#body" is #size.width] -/// } +/// }) /// /// #thing[Hey] \ /// #thing[Welcome] diff --git a/crates/typst/src/introspection/counter.rs b/crates/typst/src/introspection/counter.rs index c3ed2bc7c..4a9bae036 100644 --- a/crates/typst/src/introspection/counter.rs +++ b/crates/typst/src/introspection/counter.rs @@ -748,9 +748,9 @@ impl Count for Packed { } } -/// **Deprection planned.** -/// /// Executes a display of a counter. +/// +/// **Deprecation planned.** #[elem(Construct, Locatable, Show)] pub struct CounterDisplayElem { /// The counter. diff --git a/crates/typst/src/introspection/state.rs b/crates/typst/src/introspection/state.rs index a92b03ff9..228fbab2b 100644 --- a/crates/typst/src/introspection/state.rs +++ b/crates/typst/src/introspection/state.rs @@ -364,9 +364,9 @@ impl State { StateUpdateElem::new(self.key, update).pack().spanned(span) } - /// **Deprection planned:** Use [`get`]($state.get) instead. - /// /// Displays the current value of the state. + /// + /// **Deprecation planned:** Use [`get`]($state.get) instead. #[func] pub fn display( self, @@ -428,9 +428,9 @@ impl Show for Packed { } } -/// **Deprection planned.** -/// /// Executes a display of a state. +/// +/// **Deprecation planned.** #[elem(Construct, Locatable, Show)] struct StateDisplayElem { /// The state. diff --git a/crates/typst/src/model/figure.rs b/crates/typst/src/model/figure.rs index cbe77c486..b5698fac1 100644 --- a/crates/typst/src/model/figure.rs +++ b/crates/typst/src/model/figure.rs @@ -425,9 +425,9 @@ impl Outlinable for Packed { /// specific kind. /// /// In addition to its `pos` and `body`, the `caption` also provides the -/// figure's `kind`, `supplement`, `counter`, `numbering`, and `location` as -/// fields. These parts can be used in [`where`]($function.where) selectors and -/// show rules to build a completely custom caption. +/// figure's `kind`, `supplement`, `counter`, and `numbering` as fields. These +/// parts can be used in [`where`]($function.where) selectors and show rules to +/// build a completely custom caption. /// /// ```example /// #show figure.caption: emph diff --git a/crates/typst/src/symbols/sym.rs b/crates/typst/src/symbols/sym.rs index 2a46a424f..f472b3918 100644 --- a/crates/typst/src/symbols/sym.rs +++ b/crates/typst/src/symbols/sym.rs @@ -400,7 +400,7 @@ pub(crate) const SYM: &[(&str, Symbol)] = symbols! { // Calculus. infinity: '∞', oo: '∞', - diff: '∂', // deprecated (don't forget to delete later) + diff: '∂', // Deprecation planned partial: '∂', gradient: '∇', nabla: '∇', diff --git a/crates/typst/src/visualize/image/mod.rs b/crates/typst/src/visualize/image/mod.rs index 2faabd5cd..2b80567db 100644 --- a/crates/typst/src/visualize/image/mod.rs +++ b/crates/typst/src/visualize/image/mod.rs @@ -83,7 +83,17 @@ pub struct ImageElem { /// A text describing the image. pub alt: Option, - /// How the image should adjust itself to a given area. + /// How the image should adjust itself to a given area (the area is defined + /// by the `width` and `height` fields). Note that `fit` doesn't visually + /// change anything if the area's aspect ratio is the same as the image's + /// one. + /// + /// ```example + /// #set page(width: 300pt, height: 50pt, margin: 10pt) + /// #image("tiger.jpg", width: 100%, fit: "cover") + /// #image("tiger.jpg", width: 100%, fit: "contain") + /// #image("tiger.jpg", width: 100%, fit: "stretch") + /// ``` #[default(ImageFit::Cover)] pub fit: ImageFit, } @@ -293,16 +303,7 @@ impl LocalName for Packed { impl Figurable for Packed {} -/// How an image should adjust itself to a given area (the area is defined by -/// the `width` and `height` fields). Note that `fit` doesn't visually change -/// anything if the image's aspect ratio is the same as the initial one. -/// -/// ```example -/// #set page(width: 300pt, height: 50pt, margin: 10pt) -/// #image("tiger.jpg", width: 100%, fit: "cover") -/// #image("tiger.jpg", width: 100%, fit: "contain") -/// #image("tiger.jpg", width: 100%, fit: "stretch") -/// ``` +/// How an image should adjust itself to a given area, #[derive(Debug, Copy, Clone, Eq, PartialEq, Hash, Cast)] pub enum ImageFit { /// The image should completely cover the area (preserves aspect ratio by diff --git a/docs/changelog.md b/docs/changelog.md index feb0100ed..62318664c 100644 --- a/docs/changelog.md +++ b/docs/changelog.md @@ -5,6 +5,266 @@ description: | --- # Changelog +## Unreleased +- Tables (thanks to [@PgBiel](https://github.com/PgBiel)) + - Tables are now _much_ more flexible + - Added [`table.cell`] element for per-cell configuration + - Cells can now span multiple [columns]($table.cell.colspan) or + [rows]($table.cell.rowspan) + - The [stroke]($table.cell.stroke) of individual cells can now be customized + - The [`align`]($table.align) and [`inset`]($table.inset) arguments of the + table function now also take `{(x, y) => ..}` functions + - Added [`table.hline`] and [`table.vline`] for convenient line customization + - Added [`table.header`] element for table headers that repeat on every page + - Added [`table.footer`] element for table footers that repeat on every page + - All the new table functionality is also available for [grids]($grid) + - Fixed gutter-related bugs + +- Templates + - You can now use template packages to get started with new projects. Click + _Start from template_ on the web app's dashboard and choose your preferred + template or run the `typst init