-
Notifications
You must be signed in to change notification settings - Fork 403
fix(typst): prevent breaking inside definition items #13978
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
fix(typst): prevent breaking inside definition items #13978
Conversation
Ensure that terms and their descriptions remain together by setting the block to be non-breakable.
✅ Snyk checks have passed. No issues have been found so far.
💻 Catch issues earlier using the plugins for VS Code, JetBrains IDEs, Visual Studio, and Eclipse. |
Verifies that definition list terms and descriptions stay on the same page and that descriptions are indented from terms. Co-Authored-By: Claude Opus 4.5 <[email protected]>
|
I added a test using ensurePdfTextPositions. Without the fix, it reports |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Wow, is this ensurePdfTextPositions new?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, I added these to validate article layout in Typst PDF output.
It's currently just right-of, above, etc, and per-side alignment, so I tested that they are not left-aligned, but the predicates only work if the items are on the same page, so it worked out handy for this.
Come to think of it, I think I could have tested that the left edge is to the right of the other left edge as a positive test. 🤔
I'm still getting used to it and figuring out the complete API, please try it out and see if it's helpful. I'll add dev-docs soon.
In theory it should also work with LaTeX tagged PDFs, but I haven't tested that yet.
Ensure terms and their descriptions remain together by preventing breaks within definition items.
The rule needs to be separate from the content rule, because here we play on the implicit block generated by Typst.
As this is a visual change, there are no tests, but I believe non breaking term/definition is a sensible default.