Update changelog and roadmap (#3594)

This commit is contained in:
Laurenz 2024-03-09 17:56:56 +01:00 committed by GitHub
parent 15ac6c3166
commit a2d097686f
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
16 changed files with 323 additions and 61 deletions

View File

@ -1,4 +1,4 @@
//! Capabilities for IDE support.
//! Capabilities for Typst IDE support.
mod analyze;
mod complete;

View File

@ -1,4 +1,4 @@
//! Exporting into PDF documents.
//! Exporting of Typst documents into PDFs.
mod color;
mod extg;

View File

@ -1,4 +1,4 @@
//! Rendering into raster images.
//! Rendering of Typst documents into raster images.
use std::io::Read;
use std::sync::Arc;

View File

@ -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};

View File

@ -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()

View File

@ -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<Styles>) {
pub fn value(&mut self, value: Value, styles: Option<Styles>) {
if self.values.len() < Self::MAX_VALUES {
self.values.push((v, s));
self.values.push((value, styles));
}
}
}

View File

@ -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]

View File

@ -748,9 +748,9 @@ impl Count for Packed<CounterUpdateElem> {
}
}
/// **Deprection planned.**
///
/// Executes a display of a counter.
///
/// **Deprecation planned.**
#[elem(Construct, Locatable, Show)]
pub struct CounterDisplayElem {
/// The counter.

View File

@ -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<StateUpdateElem> {
}
}
/// **Deprection planned.**
///
/// Executes a display of a state.
///
/// **Deprecation planned.**
#[elem(Construct, Locatable, Show)]
struct StateDisplayElem {
/// The state.

View File

@ -425,9 +425,9 @@ impl Outlinable for Packed<FigureElem> {
/// 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

View File

@ -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: '',

View File

@ -83,7 +83,17 @@ pub struct ImageElem {
/// A text describing the image.
pub alt: Option<EcoString>,
/// 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<ImageElem> {
impl Figurable for Packed<ImageElem> {}
/// 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

View File

@ -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 <template>` command in the CLI. You can
[browse the available templates here]($packages/?templates).
- Switching templates after the fact has become easier. You can just import a
styling function from a different template package.
- Package authors can now submit their own templates to the
[package repository](https://github.com/typst/packages). Share a template
for a paper, your school, or an original work to help the community get a
head start on their projects.
- Templates and packages are now organized by category and discipline. Filter
packages by either taxonomy in the _Start from template_ wizard. If you are
a package author, take a look at the new documentation for
[categories](https://github.com/typst/packages/blob/main/CATEGORIES.md) and
[disciplines](https://github.com/typst/packages/blob/main/DISCIPLINES.md).
- Context
- Added _context expressions:_ Read the chapter on [context] to get started
- With context, you can access settable properties, e.g. `{context text.lang}`
to access the language set via `{set text(lang: "..")}`
- The following existing functions have been made contextual: [`query`],
[`locate`], [`measure`], [`counter.display`], [`counter.at`],
[`counter.final`], [`state.at`], and [`state.final`]
- Added contextual methods [`counter.get`] and [`state.get`] to retrieve the
value of a counter or state in the current context
- Added contextual function [`here`] to retrieve the [location] of the current
context
- The [`locate`] function now returns the location of a selector's unique
match. Its old behaviour has been replaced by context expressions and only
remains temporarily available for compatibility.
- The [`counter.at`] and [`state.at`] methods are now more flexible: They
directly accept any kind of [locatable]($location/#locatable) selector with
a unique match (e.g. a label) instead of just locations
- When context is available, [`counter.display`] now directly returns the
result of applying the numbering instead of yielding opaque content. It
should not be used anymore without context. (Deprecation planned)
- The [`state.display`] function should not be used anymore, use [`state.get`]
instead (Deprecation planned)
- The `location` arguments of [`query`], [`counter.final`], and
[`state.final`] should not be used anymore (Deprecation planned)
- The [`styles`]($measure.styles) argument of the `measure` function should
not be used anymore (Deprecation planned)
- The [`style`] function should not be used anymore, use context instead
(Deprecation planned)
- The correct context is now also provided in various other places where it is
available, e.g. in show rules, layout callbacks, and numbering functions
in the outline
- Styling
- Fixed priority of multiple [show-set rules]($styling/#show-rules): They now
apply in the same order as normal set rules would
- Show-set rules on the same element
(e.g. `{show heading.where(level: 1): set heading(numbering: "1.")}`) now
work properly
- Setting properties on an element within a transformational show rule (e.g..
`{show heading: it => { set heading(..): it }}`) is **not** supported
anymore (previously it also only worked sometimes); use show-set rules
instead (**Breaking change**)
- Text show rules that match their own output now work properly
(e.g. `` {show "cmd": `cmd`} ``)
- The elements passed to show rules and returned by queries now contain all
fields of their respective element functions rather than just specific ones
- All settable properties can now be used in [where]($function.where)
selectors
- [And]($selector.and) and [or]($selector.or) selectors can now be used with
show rules
- Errors within show rules and context expressions are now ignored in all but
the last introspection iteration, in line with the behaviour of the old
[`locate`]
- Layout
- Added `reflow` argument to [`rotate`]($rotate) and [`scale`]($scale) which
lets them affect the layout
- Fixed a bug where [floating placement]($place.float) or
[floating figures]($figure.placement) could end up out of order
- Fixed overlap of text and figure for full-page floating figures
- Fixed various cases where the [`hide`] function didn't hide its contents
properly
- Fixed usage of [`h`] and [`v`] in [stacks]($stack)
- Invisible content like a counter update will no longer force a visible
block for just itself
- Text
- Added [`stroke`]($text.stroke) property for text
- Added basic i18n for Serbian and Catalan
- Added support for contemporary Japanese [numbering] method
- Added patches for various wrong metadata in specific fonts
- The [text direction]($text.dir) can now be overridden within a paragraph
- Fixed Danish [smart quotes]($smartquote)
- Fixed font fallback next to a line break
- Fixed width adjustment of JIS-style Japanse punctuation
- Fixed Finnish translation of "Listing"
- Fixed Z-ordering of multiple text decorations (underlines, etc.)
- Fixed a bug due to with text [features]($text.features) could not be
overridden in consecutive set rules
- Model
- Added [`depth`]($heading.depth) and [`offset`]($heading.offset) arguments to
heading to increase or decrease the heading level for a bunch of content
- List [markers]($list.marker) now cycle by default
- The [`quote`] function now more robustly selects the correct quotes based on
language and nesting
- Fixed indents bugs related to default show rule of [terms]
- Math
- Inline equations now automatically linebreak at appropriate places
- Added [`number-align`]($math.equation.number-align) argument to equations
- Added support for adjusting the [`size`]($math.accent.size) of accents
relative to their base
- Improved positioning of accents
- [Primes]($math.primes) are now always attached as [scripts]($math.scripts)
by default
- Exposed [`math.primes`] element which backs the `[$f'$]` syntax in math
- Fixed [`attach`]($math.attach) under [fractions]($math.frac)
- Fixed that [`math.class`] did not affect smart limit placement
- Fixed weak spacing in [`lr`]($math.lr) groups
- Fixed layout of large operators for Cambria Math font
- Fixed math styling of Hebrew symbol codepoints
- Symbols
- Added `gradient` as an alias for `nabla`
- Added `partial` as an alias for `diff`, `diff` will be deprecated in the
future
- Added `colon.double`, `gt.approx`, `gt.napprox`, `lt.approx`, and
`lt.napprox`
- Added `arrow.r.tilde` and `arrow.l.tilde`
- Added `tilde.dot`
- Added `forces` and `forces.not`
- Added `space.nobreak.narrow`
- Added `lrm` (Left-to-Right Mark) and `rlm` (Right-to-Left Mark)
- Fixed `star.stroked` symbol (which previously had the wrong codepoint)
- Scripting
- Arrays can now be compared lexicographically
- Added contextual method [`to-absolute`]($length.to-absolute) to lengths
- Added [`calc.root`]($calc.root)
- Added [`int.signum`] and [`float.signum`] methods
- Added [`float.is-nan`] and [`float.is-infinite`] methods
- Added [`int.bit-not`], [`int.bit-and`], [`int.bit-or`], [`int.bit-xor`],
[`int.bit-lshift`], and [`int.bit-rshift`] methods
- Added [`array.chunks`] method
- A module can now be converted to a dictionary with the
[dictionary constructor]($dictionary/#constructor) to access its contents
dynamically
- Added [`row-type`]($csv.row-type) argument to `csv` function to configure
how rows will be represented
- [XML parsing]($xml) now allows DTDs (document type definitions)
- Improved formatting of negative numbers with [`str`]($str) and
[`repr`]($repr)
- For loops can now iterate over [bytes]
- Fixed a bug with pattern matching in for loops
- Fixed a bug with labels not being part of [`{.fields()}`]($content.fields)
dictionaries
- Fixed a bug where unnamed argument sinks wouldn't capture excess arguments
- Fixed typo in `repr` output of strokes
- Syntax
- Added support for nested [destructuring patterns]($scripting/#bindings)
- Special spaces (like thin or no-breaking spaces) are now parsed literally
instead of being collapsed into normal spaces (**Breaking change**)
- Korean text can now use emphasis syntax without adding spaces
(**Breaking change**)
- The token [`context`] is now a keyword and cannot be used as an identifier
anymore (**Breaking change**)
- Nested line comments aren't allowed anymore in block comments
(**Breaking change**)
- Fixed a bug where `x.)` would be treated as a field access
- Text elements can now span across curly braces in markup
- Fixed silently wrong parsing when function name is parenthesized
- Fixed various bugs with parsing of destructuring patterns, arrays, and
dictionaries
- Tooling & Diagnostics
- Click-to-jump now works properly within [`raw`] text
- Added suggestion for accessing a field if a method doesn't exist
- Improved hint for calling a function stored in a dictionary
- Improved errors for mutable accessor functions on arrays and dictionaries
- Fixed error message when calling constructor of type that doesn't have one
- Fixed confusing error message with nested dictionaries for strokes on
different sides
- Fixed autocompletion for multiple packages with the same name from different
namespaces
- Visualization
- The [`image`] function doesn't upscale images beyond their natural size
anymore
- The [`image`] function now respects rotation stored in EXIF metadata
- Added support for SVG filters
- Added alpha component to [`luma`]($color.luma) colors
- Added [`color.transparentize`] and [`color.opacify`] methods
- Improved [`color.negate`] function
- Added [`stroke`]($highlight.stroke) and [`radius`]($highlight.radius)
arguments to `highlight` function
- Changed default [`highlight`] color to be transparent
- CMYK to RGB conversion is now color-managed
- Fixed crash with gradients in Oklch color space
- Fixed color-mixing for hue-based spaces
- Fixed bugs with color conversion
- SVG sizes are not rounded anymore, preventing slightly wrong aspect ratios
- Fixed a few other SVG-related bugs
- [`color.components`] doesn't round anything anymore
- Export
- PDFs now contain named destinations for headings derived from their labels
- The internal PDF structure was changed to make it easier for external tools
to extract or modify individual pages, avoiding a bug with Typst PDFs in
Apple Preview
- PDFs produced by Typst should now be byte-by-byte reproducible when
`{set document(date: none)}` is set
- Added missing flag to PDF annotation
- Fixed multiple bugs with gradients in PDF export
- Fixed a bug with patterns in PDF export
- Fixed a bug with embedding of grayscale images in PDF export
- Fixed a bug with To-Unicode mapping of CFF fonts in PDF export
- Fixed a bug with the generation of the PDF outline
- Fixed a sorting bug in PDF export leading to non-reproducible output
- Fixed a bug with transparent text in PNG export
- Exported SVG files now include units in their top-level `width` and `height`
- Command line interface
- Added support for passing [inputs]($category/foundations/sys) via a CLI flag
- When passing the filename `-`, Typst will now read input from stdin
- The watch mode now uses the alternate screen so that the original state of
the terminal is restored when exiting
- Now uses the system-native TLS implementation for network fetching which
should be generally more robust
- Watch mode will now properly detect when a previously missing file is
created
- Added `--color` flag to configure whether to print colored output
- Fixed user agent with which packages are downloaded
- Updated bundled fonts to the newest versions
- Development
- Added `--vendor-openssl` to CLI to configure whether to link OpenSSL
statically instead of dynamically (not applicable to Windows and Apple
platforms)
- Added new `--timings` flag which supersedes the old flamegraph profiling in
the CLI
- Added minimal CLI to `typst-docs` crate for extracting the language and
standard library documentation as JSON
- The `typst_pdf::export` function's `ident` argument switched from `Option`
to `Smart`. It should only be set to `Smart::Custom` if you can provide
a stable identifier (like the web app can). The CLI sets `Smart::Auto`.
## Version 0.10.0 (December 4, 2023) { #v0.10.0 }
- Bibliography management
- Added support for citation collapsing (e.g. `[[1]-[3]]` instead of

View File

@ -419,10 +419,12 @@ show rule.
</div>
In the web app, you can choose from predefined templates or even
create your own using the template wizard. You can also check out the
create your own using the template wizard. Locally, you can use the
`typst init` CLI to create a new project from a template. Check out
[the list of templates]($packages/?templates) published in the official package
manager. You can also take a look at the
[`awesome-typst` repository](https://github.com/qjcg/awesome-typst) to find
templates made by the community. We plan to add support for templates to Typst's
package manager in the future.
community templates that aren't yet available as packages.
You can also [create your own, custom templates.]($tutorial/making-a-template)
They are shorter and more readable than the corresponding LaTeX `.sty` files by
@ -453,12 +455,12 @@ and their corresponding Typst functions.
Although _many_ things are built-in, not everything can be. That's why Typst has
a built-in [package manager]($packages) where the community can share their
creations and automations. Let's take, for instance, the _tablex_ package: This
package allows you to customize your tables in ways the built-in table does not
yet support. To use tablex in your document, you can just write:
creations and automations. Let's take, for instance, the _cetz_ package: This
package allows you to create complex drawings and plots. To use cetz in your
document, you can just write:
```typ
#import "@preview/tablex:0.0.5": tablex, gridx
#import "@preview/cetz:0.2.1"
```
(The `@preview` is a _namespace_ that is used while the package manager is still

View File

@ -16,12 +16,10 @@ request with the [community].
## Language and Compiler
- **Structure and Styling**
- Fix show rule recursion
- Fix show-set order
- Fix show-set where both show and set affect the same kind of element
(to set properties on elements that match a selector)
- Support for freezing content, so that e.g. numbers in it remain the same
if it appears multiple times
- Support for revoking style rules
- Ancestry selectors (e.g., within)
- Custom elements (that work with set and show rules)
- Possibly a capability system, e.g. to make your own element referenceable
- **Layout**
- Advanced floating layout
@ -35,21 +33,20 @@ request with the [community].
- Grid-based typesetting
- Layout with collision
- **Export**
- Implement emoji export
- Support for emojis in PDF
- HTML export
- EPUB export
- Tagged PDF for Accessibility
- PDF/A and PDF/X support
- **Text and Fonts**
- Font fallback warnings
- Proper foundations for i18n
- Bold, italic, and smallcaps synthesis
- Variable fonts support
- Ruby and Warichu
- Kashida justification
- **Scripting**
- Custom types (that work with set and show rules)
- Function hoisting if possible
- Get values of set rules
- Doc comments
- Type hints
- **Visualization**
@ -67,14 +64,12 @@ request with the [community].
## Library
- **Customization**
- Richer built-in outline customization
- Table stroke customization
- **Numbering**
- Relative counters, e.g. for figure numbering per section
- Improve equation numbering
- Fix issues with numbering patterns
- Enum continuation
- **Layout**
- Row span and column span in table
- Balanced columns
- Drop caps
- End notes, maybe margin notes
@ -89,20 +84,19 @@ request with the [community].
## Web App
- **Editing**
- Smarter & more action buttons
- Basic, built-in image editor (cropping, etc.)
- Inline documentation
- Preview autocomplete entry
- Go-to-definition
- Color Picker
- Symbol picker
- Basic, built-in image editor (cropping, etc.)
- GUI inspector for editing function calls
- Preview autocomplete entry
- Cursor in preview
- Inline documentation
- More export options
- Preview in a separate window
- **Writing**
- Spell check
- Outline panel
- Word count
- Structure view
- Pomodoro
- Text completion by LLM
- **Collaboration**
- Chat-like comments
@ -123,5 +117,4 @@ request with the [community].
- Two-Factor Authentication
- Advanced search in projects
- Private packages in teams
- On-Premise deployment
- Mobile improvements

View File

@ -20,7 +20,7 @@ pub fn resolve(link: &str, base: &str) -> StrResult<String> {
route.push_str(tail);
}
if !route.contains('#') && !route.ends_with('/') {
if !route.contains(['#', '?']) && !route.ends_with('/') {
route.push('/');
}
@ -89,9 +89,15 @@ fn resolve_definition(head: &str, base: &str) -> StrResult<String> {
let mut route = format!("{}reference/{}/{name}/", base, category.name());
if let Some(next) = parts.next() {
if value.field(next).is_ok() {
if let Ok(field) = value.field(next) {
route.push_str("#definitions-");
route.push_str(next);
if let Some(next) = parts.next() {
if field.cast::<Func>().is_ok_and(|func| func.param(next).is_some()) {
route.push('-');
route.push_str(next);
}
}
} else if value
.clone()
.cast::<Func>()