v2.3.0
Added
Page background color
.pageformat now accepts a background parameter to set the background color of each page:
.pageformat background:{orange}In paged documents, the background can be scoped to specific pages, as usual:
.pageformat pages:{1..3} background:{orange}Thanks @gggeon96!
Changed
Changed .extend behavior (breaking change)
.extend, introduced in v2.2.0 as experimental, has undergone a shift in behavior. This is going to play a major role in the next v2.4.0 release.
super now exposes the original function, rather than its precomputed output, and no longer needs to be declared as a parameter.
Because .super is the original function itself, it accepts the same arguments: anything you pass overrides the corresponding argument the wrapper was called with, while anything you leave out falls through unchanged. This lets the wrapper invoke the original with adjusted inputs.
.function {greet}
greeting name:
.greeting, .name!
.extend {greet}
name greeting:
.super greeting:{.greeting::uppercase}
.greet {Hello} {world}Output:
HELLO, world
Faster live preview
Live preview now references third-party libraries through symbolic links instead of copying them (although already checksum-optimized). Preview rebuilds are faster and use less disk space, especially in documents that include code blocks, equations, or Mermaid diagrams.
Important
This feature is experimental. There's a chance it might be reverted in a future release if unstable--please report any issues you may find.
Additionally, the live preview connection between the local server and the browser now runs over Server-Sent Events (SSE) instead of WebSockets.
Note
If you experience errors after launching live preview for the first time after updating, delete the output directory and run again (or run with --clean).
Fixed
Soft line breaks in CJK languages
Soft line breaks within paragraphs (newlines in the source that are not preceded by two or more spaces or a backslash) no longer insert a space when the document language is a CJK locale (Chinese, Japanese, Korean) set via .doclang.
For example, with .doclang {zh}:
这是一个
中文段落is now rendered as 这是一个中文段落 instead of 这是一个 中文段落.
In all other languages, soft line breaks continue to render as a single space, following the CommonMark specification.
Thanks @CarmJos!
Orphan headings at the bottom of a page
In paged documents, a heading that would otherwise land as the last line of a page is now pushed to the top of the next page, keeping it close to the content it introduces.
.container's foreground color not applied to headings
.container foreground:{color} now correctly applies to headings.
[Security] Native content injection via string manipulation
Fixed an issue that allowed string->string functions to let unsanitized HTML through, even when the native-content permission was not granted.
.extend on functions with injected parameters
The .extend function now maps parameters correctly when wrapping native functions that feature @Injected parameters, such as document metadata functions.
[LSP] Concurrency issue in document state
Document state and request dispatching now run through thread-safe primitives, ensuring consistent behavior even under heavy load.
Sponsors
Thanks to our sponsors! 🎉
