Repository navigation
Support for multiple bibliographies - #8307
Merged
Merged
Conversation
This was referenced May 26, 2026
Co-Authored-By: thuiop <[email protected]>
laurmaedje
marked this pull request as ready for review
May 26, 2026 14:38
laurmaedje
enabled auto-merge
May 26, 2026 14:42
ParaN3xus
added a commit
to ParaN3xus/tinymist
that referenced
this pull request
Jun 9, 2026
ParaN3xus
added a commit
to ParaN3xus/tinymist
that referenced
this pull request
Jun 9, 2026
ParaN3xus
added a commit
to ParaN3xus/tinymist
that referenced
this pull request
Jun 9, 2026
ParaN3xus
added a commit
to ParaN3xus/tinymist
that referenced
this pull request
Jun 9, 2026
ParaN3xus
added a commit
to ParaN3xus/tinymist
that referenced
this pull request
Jun 10, 2026
ParaN3xus
added a commit
to ParaN3xus/tinymist
that referenced
this pull request
Jun 10, 2026
Myriad-Dreamin
pushed a commit
to Myriad-Dreamin/tinymist
that referenced
this pull request
Jun 13, 2026
Myriad-Dreamin
pushed a commit
to Myriad-Dreamin/tinymist
that referenced
this pull request
Jun 13, 2026
Myriad-Dreamin
pushed a commit
to Myriad-Dreamin/tinymist
that referenced
this pull request
Jun 13, 2026
Myriad-Dreamin
pushed a commit
to Myriad-Dreamin/tinymist
that referenced
this pull request
Jun 13, 2026
Myriad-Dreamin
pushed a commit
to Myriad-Dreamin/tinymist
that referenced
this pull request
Jun 13, 2026
Myriad-Dreamin
pushed a commit
to Myriad-Dreamin/tinymist
that referenced
this pull request
Jun 13, 2026
Myriad-Dreamin
added a commit
to Myriad-Dreamin/tinymist
that referenced
this pull request
Jun 15, 2026
Part of the Typst 0.15 cleanup stack. This slice covers diagnostics/span migration and the minimal query prerequisites needed before the later export and text accessor slices. ## Upstream Typst Changes - [`typst/typst#8052`](typst/typst#8052) makes diagnostic hints carry span metadata. Tinymist renders the hint message payload instead of formatting the whole spanned wrapper. - [`typst/typst#8254`](typst/typst#8254) changes diagnostic, user-action, and test-range span handling. Tinymist updates LSP diagnostics, user-action conversion, and range-sensitive tests for the new span shape. - [`typst/typst#8188`](typst/typst#8188) changes syntax diagnostics. Tinymist updates syntax matchers and diagnostics conversion paths that inspect syntax-side errors. - [`typst/typst#8307`](typst/typst#8307) changes bibliography lookup. Tinymist now finds bibliography elements through the document introspector and packs them back to `BibliographyElem`. - Typst 0.15 deprecates rooted virtual-path access through `as_rooted_path`; diagnostics now use the slash-form virtual path accessor for extension checks. ## Tinymist Changes - Updates `tinymist-world` diagnostic rendering for spanned hint values. - Updates `tinymist-query`, `tinymist-analysis`, `tinymist-lint`, and debug-facing syntax diagnostics for the new span and syntax diagnostic APIs. - Updates user-action span conversion and affected test ranges. - Updates code-context path evaluation to construct `RangeMapper` from an iterator, matching the lint expectations of the current toolchain. - Carries the small bibliography lookup prerequisite in this slice so later query-oriented slices build on the updated Typst API. --------- Co-authored-by: paran3xus <[email protected]>
Myriad-Dreamin
added a commit
to Myriad-Dreamin/tinymist
that referenced
this pull request
Jun 15, 2026
Part of the Typst 0.15 cleanup stack. This slice covers diagnostics/span migration and the minimal query prerequisites needed before the later export and text accessor slices. ## Upstream Typst Changes - [`typst/typst#8052`](typst/typst#8052) makes diagnostic hints carry span metadata. Tinymist renders the hint message payload instead of formatting the whole spanned wrapper. - [`typst/typst#8254`](typst/typst#8254) changes diagnostic, user-action, and test-range span handling. Tinymist updates LSP diagnostics, user-action conversion, and range-sensitive tests for the new span shape. - [`typst/typst#8188`](typst/typst#8188) changes syntax diagnostics. Tinymist updates syntax matchers and diagnostics conversion paths that inspect syntax-side errors. - [`typst/typst#8307`](typst/typst#8307) changes bibliography lookup. Tinymist now finds bibliography elements through the document introspector and packs them back to `BibliographyElem`. - Typst 0.15 deprecates rooted virtual-path access through `as_rooted_path`; diagnostics now use the slash-form virtual path accessor for extension checks. ## Tinymist Changes - Updates `tinymist-world` diagnostic rendering for spanned hint values. - Updates `tinymist-query`, `tinymist-analysis`, `tinymist-lint`, and debug-facing syntax diagnostics for the new span and syntax diagnostic APIs. - Updates user-action span conversion and affected test ranges. - Updates code-context path evaluation to construct `RangeMapper` from an iterator, matching the lint expectations of the current toolchain. - Carries the small bibliography lookup prerequisite in this slice so later query-oriented slices build on the updated Typst API. --------- Co-authored-by: paran3xus <[email protected]>
Myriad-Dreamin
added a commit
to Myriad-Dreamin/tinymist
that referenced
this pull request
Jun 15, 2026
Part of the Typst 0.15 cleanup stack. This slice covers diagnostics/span migration and the minimal query prerequisites needed before the later export and text accessor slices. ## Upstream Typst Changes - [`typst/typst#8052`](typst/typst#8052) makes diagnostic hints carry span metadata. Tinymist renders the hint message payload instead of formatting the whole spanned wrapper. - [`typst/typst#8254`](typst/typst#8254) changes diagnostic, user-action, and test-range span handling. Tinymist updates LSP diagnostics, user-action conversion, and range-sensitive tests for the new span shape. - [`typst/typst#8188`](typst/typst#8188) changes syntax diagnostics. Tinymist updates syntax matchers and diagnostics conversion paths that inspect syntax-side errors. - [`typst/typst#8307`](typst/typst#8307) changes bibliography lookup. Tinymist now finds bibliography elements through the document introspector and packs them back to `BibliographyElem`. - Typst 0.15 deprecates rooted virtual-path access through `as_rooted_path`; diagnostics now use the slash-form virtual path accessor for extension checks. ## Tinymist Changes - Updates `tinymist-world` diagnostic rendering for spanned hint values. - Updates `tinymist-query`, `tinymist-analysis`, `tinymist-lint`, and debug-facing syntax diagnostics for the new span and syntax diagnostic APIs. - Updates user-action span conversion and affected test ranges. - Updates code-context path evaluation to construct `RangeMapper` from an iterator, matching the lint expectations of the current toolchain. - Carries the small bibliography lookup prerequisite in this slice so later query-oriented slices build on the updated Typst API. --------- Co-authored-by: paran3xus <[email protected]>
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 PR adds support for including multiple bibliographies in a single Typst document. When a Typst document contains multiple bibliographies, each citation is assigned to one of them. By default, Typst will automatically pick a suitable bibliography (typically, the closest following one that contains the referenced citation key). This covers common cases like by-chapter or thematic bibliographies. For more fine-grained control, citations can be explicitly targeted by a bibliography through a
targetselector.Closes #1097.
Design
The PR supersedes #7277, but follows largely the same design:
There is still the
bibliography.targetfield for fine-grained control over which bibliography picks up which citation. Thanks to @thuiop for this idea, it's a really nice general mechanism.The
kindfield from said PR was adjusted to match my original design intent and renamed togroupbecausekindfelt a bit too generic after all. The purpose of thegroupfield is to define groups of bibliographies that have shared citation numbering (you can view the updated docs for more info). I'm still not super happy with the design, but exposing some control over this seems important and it's not too bad.Implementation
Code-wise, the PR is fairly far removed from #7277, but conceptually there is really mostly just one core difference. When there are consecutive citations that will be picked up by different bibliographies, #7277 would already separate them during citation grouping in realization. While this is conceptually quite nice and clean, it would unfortunately incur an additional document iteration. This is too high a price to pay, so I've moved this logic into the bibliography generation (which is a bit annoying).
Beyond this, I've done some preparatory refactoring of the bibliography generation at large in #8283 to make all of this fit in more nicely, added various diagnostics, tests, docs, etc.
Before this is ready for merge, I still gotta land typst/hayagriva#409 and I have one TODO left there because the interaction of the offsetting with bibliography styles that are unnumbered does not seem ideal yet.
Example
As mentioned, for basic use cases like by-chapter or thematic bibliographies, no
targetselector is necessary, but here's an example of how thetargetselector could be used in combination with thewithinselector to have a bibliography local to an info box.