Merged
Conversation
Contributor
|
One step closer to docs in Typst! After reading a bit about counters in #7735 (comment), I'm wondering if this "solves" #7342 as well. If you somehow can get |
cady-b
reviewed
Mar 10, 2026
cady-b
reviewed
Mar 10, 2026
cady-b
reviewed
Mar 10, 2026
cady-b
reviewed
Mar 10, 2026
reknih
reviewed
Mar 11, 2026
saecki
reviewed
Mar 11, 2026
add897f to
2d297af
Compare
This will be used in bundle export.
If you're using `typst` as a crate, you now need to depend on `typst-layout` separately to compile a paged document.
Not every output must be a document, c.f. the upcoming bundle output.
Documents are cloned due to memoization and deep-cloning the introspector isn't great.
The generic term `Position` being the more specific struct compared to `DocumentPosition` isn't great.
There is a name collision with link anchors here.
Previously, they were only emitted when linked to (at least since krilla). This was, however, not the original design intent.
In preparation of the bundle introspector working quite differently from the existing ones.
This will be useful for making paged documents hashable without hashing the introspector.
This will be useful for memoizing paged exports during bundle export.
- Makes document properties configured on a `document` element contextually available - Ensures properties configured via a bundle-level set rule or on a `document` element are taken into account for `DocumentInfo`
Not yet exposed, but useful for scoping things down to a document in bundle export.
2d297af to
c93830c
Compare
hpcfzl
reviewed
Mar 13, 2026
| /// window or the browser tab of the page. | ||
| /// | ||
| /// By default, the configured title is not visibly rendered in the | ||
| /// document. You can add the title to the document's contents by using the |
Contributor
There was a problem hiding this comment.
Suggested change
| /// document. You can add the title to the document's contents by using the | |
| /// document. You can add the title to the document's contents by using |
Sorry, I know I'm late for this, but I thought I would point out this extra the.
This was referenced Mar 30, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This pull request implements a new experimental export target that can emit multiple files from a single Typst project. The implementation mostly follows the design laid out in #7735.
The new export target is primarily useful for multi-page websites, but is not limited to that. You can create bundles containing any combination of HTML pages, PDFs, PNGs, SVGs, and arbitrary assets.
The primary motivation to ship this new target now is to use it in the ongoing work on porting the Typst documentation to Typst. However, it's also a big step in generally making HTML export more practically useful.
Example
In the example, we create two HTML documents: A home page and a blog. The home page links to the blog through a label link. Typst's built-in linking mechanism natively supports cross-document links and resolves the correct relative paths for you. The bundle also contains a PDF version of the blog, which is linked from the HTML version. In practice, you could now share the content between the HTML and PDF version by storing it in a variable and using it in both. This is omitted here for brevity. Finally, the bundle contains an icon asset for the website. In this case, we're providing the asset's data by reading a file from disk. Alternatively, it's also possible to generate asset data from within Typst (e.g. via a function like
json.encode).Scope
Compared to the design issue, this is a slightly scoped down version. Specifically, for now, I omitted the
ppi,pages, andpdfparameters todocument. Instead, export of individual documents respects the usual CLI parameters. In principle, I still want to expose these configuration options at the Typst level, but it's not blocking for landing the work itself and also not necessary for the docs work. Moreover, to make CLI settings and in-document settings interact cleanly, a few things need sorting out first.1As mentioned in the issue, I've also decided to accept that introspections are always global to the bundle for the time being. Often, this is exactly what you want, but in some cases, it's unwieldy. I don't think there's a simple clean "fix" for that. Rather, improving this will be more of a long-term process of evolving the introspection subsystem.
Notes
The history is carefully crafted with
jj:), so if you want to take a look at what's changed / how it's implemented, I invite you to read the commits in isolation.Linked issues
Closes #7735
Footnotes
Primarily that
SOURCE_DATE_EPOCHis not perfectly handled at the moment. It behaves exactly like--creation-timestampwhile in reality it should behave more like if the system clock happened to be it at its timestamp. I'll open a separate issue about that. ↩