mirror of
https://github.com/typst/typst
synced 2025-08-11 13:47:55 +08:00
14 KiB
14 KiB
title | description |
---|---|
0.13.0 | Changes in Typst 0.13.0 |
Version 0.13.0
Highlights
- There is now a distinction between proper paragraphs and just inline-level content. This is important for future work on accessibility and means that first line indent can now be enabled for all paragraphs instead of just consecutive ones.
- The [
outline
] has a better out-of-the-box look and is more customizable - The new [
curve
] function (that supersedes thepath
function) provides a simpler and more flexible interface for creating Bézier curves - The
image
function now supports raw pixel raster formats for generating images from within Typst - Functions that accept file paths now also accept raw [bytes] instead, for full flexibility
- WebAssembly plugins are more flexible and automatically run multi-threaded
- Fixed a long-standing bug where single-letter strings in math (
[$"a"$]
) would be displayed in italics - You can now specify which charset should be covered by which font family
- The [
pdf.embed
] function lets you embed arbitrary files in the exported PDF - HTML export is currently under active development. The feature is still very incomplete, but already available for experimentation behind a feature flag.
Model
- There is now a distinction between proper paragraphs and just
inline-level content (Breaking change)
- All text at the root of a document is wrapped in paragraphs. Meanwhile, text in a container (like a block) is only wrapped in a paragraph if the container holds any block-level content. If all of the content is inline-level, no paragraph is created.
- In the laid-out document, it's not immediately visible whether text became
part of a paragraph. However, it is still important for accessibility, HTML
export, and for properties like
first-line-indent
. - Show rules on
par
now only affect proper paragraphs - The
first-line-indent
andhanging-indent
properties also only affect proper paragraphs - Creating a
{par[..]}
with body content that is not fully inline-level will result in a warning - The default show rules of various built-in elements like lists, quotes, etc. were adjusted to ensure they produce/don't produce paragraphs as appropriate
- The [
outline
] function was fully reworked to improve its out-of-the-box behaviour (Breaking change)- Outline entries are now blocks and are thus affected by block spacing
- The
{auto}
indentation mode now aligns numberings and titles outline-wide for a grid-like look - Automatic indentation now also indents entries without a numbering
- Titles wrapping over multiple lines now have hanging indent
- The page number won't appear alone on its own line anymore
- The link now spans the full entry instead of just the title and page number
- The default spacing between outline leader dots was increased
- The
fill
parameter was moved fromoutline
tooutline.entry
and can thus be configured through show-set rules - Removed
body
andpage
fields from outline entry - Added
indented
,prefix
,inner
,body
, andpage
methods on outline entries to simplify writing of show rules
- Added configuration to [
par.first-line-indent
] for indenting all paragraphs instead of just consecutive ones - Added
form
parameter toref
function. Setting the form to{"page"}
will produce a page reference instead of a textual one. - Added [
document.description
] field, which results in corresponding PDF and HTML metadata - Added [
enum.reversed
] parameter - Added support for Greek [numbering]
- When the [
link
] function wraps around a container like a [block], it will now generate only one link for the whole block instead of individual links for all the visible leaf elements. This significantly reduces PDF file sizes when combininglink
and [repeat
]. - The [
link
] function will now only strip one prefix (likemailto:
ortel:
) instead of multiple - The link function now suppresses hyphenation via a built-in show-set rule rather than through its default show rule
- Displaying the page counter without a specified numbering will now take the page numbering into account
Visualization
- Added new [
curve
] function that supersedes the [path
] function and provides a simpler and more flexible interface. Thepath
function is now deprecated. - The
image
function now supports raw pixel raster formats. This can be used to generate images from within Typst without the need for encoding in an image exchange format. - Added [
image.scaling
] parameter for configuring how an image is scaled by PNG export and PDF viewers (smooth or pixelated) - Added [
image.icc
] parameter for providing or overriding the ICC profile of an image - Renamed
pattern
to [tiling
]. The namepattern
remains as a deprecated alias. - Added [
gradient.center
], [gradient.radius
], [gradient.focal-center
], and [gradient.focal-radius
] methods - Fixed interaction of clipping and outset on [
box
] and [block
] - Fixed panic with [
path
] of infinite length - Fixed non-solid (e.g. tiling) text fills in clipped blocks
- Auto-detection of image formats from a raw buffer now has basic support for SVGs
Scripting
- Functions that accept file paths now also accept raw
[bytes]
- [
image
], [cbor
], [csv
], [json
], [toml
], [xml
], and [yaml
] now support a path string or bytes and their.decode
variants are deprecated - [
plugin
], [bibliography
], [bibliography.style
], [cite.style
], [raw.theme
], and [raw.syntaxes
] now accept bytes in addition to path strings. These did not have.decode
variants, so this adds new flexibility. - The
path
argument/field of [image
] and [bibliography
] was renamed tosource
andsources
, respectively (Minor breaking change)
- [
- Improved WebAssembly plugins
- The
plugin
type is replaced by aplugin
function that returns a [module] containing normal Typst functions. This module can be used with import syntax. (Breaking change) - Plugins now automatically run in multiple threads without any changes by plugin authors
- A new [
plugin.transition
] API is introduced which allows plugins to run impure initialization in a way that doesn't break Typst's purity guarantees
- The
- The variable name bound by a bare import (no renaming, no import list) is now
determined statically and dynamic imports without
{as}
renaming (e.g.{import "ot" + "her.typ"}
) are a hard error (Breaking change) - Values of the [
arguments
] type can now be added with+
and joined in curly-braced code blocks - Functions in an element function's scope can now be called with method syntax,
bringing elements and types closer (in anticipation of a future full
unification of the two). Currently, this is only useful for [
outline.entry
] as no other element function defines methods. - Added [
calc.norm
] function - Added support for 32-bit floats in [
float.from-bytes
] and [float.to-bytes
] - The [
decimal
] constructor now also accepts decimal values - Improved
repr
of symbols, [arguments], and types - Duplicate [symbol] variants and modifiers are now a hard error (Breaking change)
Math
- Fixed a bug where single letter strings in math (
[$"a"$]
) would be displayed in italics - Math function calls can now have hyphenated named arguments and support argument spreading
- Better looking accents thanks to support for the
flac
(Flattened Accent Forms) anddtls
(Dotless Forms) OpenType features - Added
lcm
text operator - The
bold
function now works with ϝ and Ϝ - The
italic
function now works with ħ - Fixed a bug where the extent of a math equation was wrongly affected by internal metadata
- Fixed interaction of
lr
and [context] expressions - Fixed weak spacing being unconditionally ignored in
lr
- Fixed sub/superscripts sometimes being in the wrong position with
lr
- Fixed multi-line annotations (e.g. overbrace) changing the math baseline
- Fixed merging of attachments when the base is a nested equation
- Fixed resolving of contextual (em-based) text sizes within math
- Fixed spacing around ⊥
Bibliography
TODO (update after hayagriva bump)
Text
- Added support for specifying which charset should be covered by which font family
- Added
all
parameter tosmallcaps
function that also enables small capitals on uppercase letters - Added basic i18n for Basque and Bulgarian
- Justification does not affect [raw] blocks anymore
- CJK-Latin-spacing does not affect [raw] text anymore
- Fixed wrong language codes being used for Greek and Ukrainian
- Fixed default quotes for Croatian
- Fixed crash in RTL text handling
- New font metadata exception for New Computer Modern Sans Math
- Updated bundled New Computer Modern fonts to version 7.0
Layout
- Fixed various bugs with footnotes
- Fixed footnotes getting lost when multiple footnotes were nested within another footnote
- Fixed endless loops with empty and overlarge footnotes
- Fixed crash with overlarge footnotes within a floating placement
- Fixed sizing of quadratic shapes ([
square
] and [circle
]) - Fixed [
block.sticky
] not working properly at the top of a container - Fixed crash due to consecutive weak spacing
- Fixed crash when a [block] or text have negative sizes
- Fixed unnecessary hyphenations occurring in rare scenarios due to a bad interaction between padding and paragraph optimization
- Fixed lone citations in [
align
] not becoming their own paragraph
Syntax
- Top-level closing square brackets that do not have a matching opening square bracket are now a hard error (Minor breaking change)
- Adding a space between the identifier and the parentheses in a set rule is not allowed anymore (Minor breaking change)
- Numbers with a unit cannot have a base prefix anymore, e.g.
0b100000pt
is not allowed anymore. Previously, it was syntactically allowed but always resolved to a value of zero. (Minor breaking change) - Using
is
as an identifier will now warn as it might become a keyword in the future - Fixed minor whitespace handling bugs
- in math mode argument lists
- at the end of headings
- between a term list's term and description
- Fixed parsing of empty single line raw blocks with 3+ backticks and a language tag
- Fixed minor bug with parentheses parsing in math
- Markup that can only appear at the start of the line (headings, lists) can now also appear at the start of a list item
- A shebang
#!
at the very start of a file is now ignored
PDF export
- Added
pdf.embed
function for embedding arbitrary files in the exported PDF - Added support for PDF/A-3b export
- The PDF timestamp will now contain the timezone by default
HTML export
Note: HTML export is currently under active development. The feature is still very incomplete, but already available for experimentation behind a feature flag.
- Added HTML output support for some (but not all) of the built-in elements
- Added [
html.elem
] function for outputting an arbitrary HTML element - Added [
html.frame
] function for integrating content that requires layout into HTML (by embedding an SVG) - Added [
target
] function which returns either{"paged"}
or{"html"}
depending on the export target
Tooling and Diagnostics
- Autocompletion improvements
- Added autocompletion for file paths
- Smarter autocompletion of variables: Completing
{rect(fill: |)}
will now only show variables which contain a valid fill (either directly or nested, e.g. a dictionary containing a valid fill) - Different functions will now autocomplete with different brackets (round vs square) depending on which kind is more useful
- Positional parameters which are already provided aren't autocompleted again anymore
- Fixed variable autocompletion not considering parameters
- Added autocompletion snippets for common figure usages
- Fixed autocompletion after half-completed import item
- Fixed autocompletion for
cite
function
- Added warning when an unconditional return in a code block discards joined content
- Fixed error message when accessing non-existent label
- Fixed handling of nested imports in IDE functionality
Command Line Interface
- Added
--features
argument andTYPST_FEATURES
environment variable for opting into experimental features. The only feature so far ishtml
. - Added a live reloading HTTP server to
typst watch
when targeting HTML - Fixed self-update not being aware about certain target architectures
- Fixed crash when piping
typst fonts
output to another command
Symbols
- Added:
numero
,eq.triple.not
,asymp
,asymp.not
TODO (update after codex bump)
Deprecations
- The [
path
] function in favor of the [curve
] function - The name
pattern
for tiling patterns in favor of the new name [tiling
] - [
image.decode
], [cbor.decode
], [csv.decode
], [json.decode
], [toml.decode
], [xml.decode
], [yaml.decode
] in favor of the top-level functions directly accepting both paths and bytes - The
sect
symbol, its variants, andintegral.sect
- Fully removed type/str compatibility behaviour (e.g.
{int == "integer"}
) which was temporarily introduced in Typst 0.8 (Breaking change)
Development
- The
typst::compile
function is now generic and can return either aPagedDocument
or anHtmlDocument
typst-timing
now supports WebAssembly targets viaweb-sys
when thewasm
feature is enabled- Increased minimum supported Rust version to 1.80
- Fixed linux/arm64 Docker image