Skip to content

fix: keep the Typst title bar with its code - #80

Merged
mcanouil merged 6 commits into
mainfrom
fix/sticky-typst-title-bar
Nov 3, 2026
Merged

mcanouil merged 6 commits into
mainfrom
fix/sticky-typst-title-bar

Conversation

@mcanouil

@mcanouil mcanouil commented Nov 3, 2026

Copy link
Copy Markdown
Owner

In Typst output, a code window that starts near the bottom of a page can leave its title bar there alone, while the code moves to the next page.
This puts sticky: true back on the title-bar block, so the title bar now moves with the first lines of its code.

Release 1.2.1 removed sticky (#35) because Typst 0.13 and older pushed a window close to a page in height whole to the next page, which left near-empty pages behind.
Quarto 1.10.19, the minimum this extension now requires, bundles Typst 0.15.1.
That version breaks a tall window from the page it starts on, with or without sticky.

Before After
The title bar of plain.py sits alone at the bottom of page 2, and its code starts at the top of page 3 Page 2 is empty at the bottom, and page 3 shows the plain.py title bar with its code

A new fixture places a plain window and an annotated window where only the title bar fits, and a 60-line window after a heading.
The tests check that each title bar shares a page with its first line of code, and that the tall window starts on the current page.
They then render again without sticky and expect the title bar to land alone, which proves the fixture still forces the break.
The page-break tests read the PDF text with pdftotext from poppler.

When a code window started near the bottom of a page, Typst could break
the page right after the title bar, leaving it alone there while the
code moved to the next page. The title bar block is now sticky, so it
moves with the first lines of code. Long code still splits across pages.
@mcanouil mcanouil added the Type: Bug 🐛 Issues related to bugs, errors, or mistakes label Nov 3, 2026
@mcanouil mcanouil self-assigned this Nov 3, 2026
@mcanouil
mcanouil marked this pull request as ready for review November 3, 2026 23:26
@mcanouil
mcanouil merged commit 8767908 into main Nov 3, 2026
@mcanouil
mcanouil deleted the fix/sticky-typst-title-bar branch November 3, 2026 23:27
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Type: Bug 🐛 Issues related to bugs, errors, or mistakes

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant