Repository navigation
Conversation
✅ 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. |
Add cell-id generation and Typst label/link support so that clicking a circled annotation number in code jumps to its description and vice versa. Add upstream-compatible Quarto functions (quarto-circled-number, quarto-annote-color, quarto-code-filename, quarto-code-annotation, quarto-annotation-item) to definitions.typ for forward compatibility with quarto-dev/quarto-cli#14170.
Update configuration examples to use nested `hotfix` key. Add hotfix options table and a dedicated "Temporary Hot-fixes (Typst)" section explaining that code-annotations and skylighting fixes will be removed once quarto-dev/quarto-cli#14170 lands. Add callout note in example.qmd about the temporary nature of Typst code-annotations support.
This comment was marked as outdated.
This comment was marked as outdated.
This comment was marked as outdated.
This comment was marked as outdated.
|
Bad merging conflict resolution it seems... oups. I'll fix this |
|
OK this should fix CI @mcanouil one thing I notice, the change will add a 'stroke' line across all code blocks Is this expected style change for default style (when filename not used) ? Thanks |
|
I need to check, because it's a workaround around skylighting destructing code blocks. |
cderv
left a comment
There was a problem hiding this comment.
Thanks for this, nice feature. We don't have a lot in v1.10, I was aiming for a improvement and bug fix only. So maybe this should go to v1.11 early as first feature and first pre-release 🤔
Two edge cases found with 🤖 review help (both Skylighting-path only, native path is fine) that end in a hard Typst compile error rather than a graceful fallback. we should probably see if we can cover for them.
I can't check the edge cases now, so yes let's put this for 1.11. |
To be clear, this could be a good idea to add this stroke. Maybe it helps with contrast and accessibility too. However, if we do that, we probably want to do it in all formats - unless this is a problem with Typst only. I did not check. |
The "missing stroke" is global, so if we want to address this, it should be in a follow-up PR and keep this PR's scope narrow to bringing the missing feature "as is". The screenshot in #14170 (comment) is from HTML format. |
a63e76e to
8092d5e
Compare
…ace definitions.typ
|
The executable-cell bug I noticed while working on this is tracked in #15215. |
f5f8457 to
e1f8b9b
Compare
A filter can redefine quarto-code-filename in the document body and call the original from there. The helper fallback treated that redefinition as the helper itself, so a format that replaces definitions.typ got no original and failed to compile.
Code blocks are drawn through quarto-code-block, which reads the inset, radius and outline from the quarto-code-block-style state. A filter that frames code blocks itself, such as a window with its own border, can remove the outline inside its frame instead of drawing a second one.
The previous check looked for the template's '#show: doc =>' line, which a format extension can write differently. A definition now counts only when it comes before the first use of the helper, comments aside.
…on-filename # Conflicts: # news/changelog-1.12.md



Description
Typst output now supports code annotations and the
filenameattribute.# <n>comments become circled numbers on the annotated lines, linked both ways with the list below the block, and afilenameshows as a bar above the code block.Code blocks also get a thin outline (
luma(128), which meets the 3:1 of WCAG 1.4.11), so a near-white theme stays visible.Every code block is drawn through
quarto-code-block, which reads its inset, radius and outline from thequarto-code-block-stylestate, so an extension that frames code blocks itself can drop the outline inside its frame.Other formats do not have the outline yet, and I will open an issue for it once this pull request is merged.
What needs a careful look:
format-typst.tspatches Pandoc's generatedSkylighting()function and merges the markers that the Lua filter emits.A patch that cannot apply warns with the Pandoc version and leaves the block unannotated.
definitions.typpartial get Quarto's definition of any annotation helper they lack.A helper counts as defined only when its definition comes before its first use, so a filter can redefine
quarto-code-filenameand still call the original, as mcanouil/quarto-code-window#91 does.ext-replaces-definitionstests this with a project-local extension, and a document with afilenameand annotations also renders withchristopherkenny/tufte, a community extension that replaces the partial.hoverandselectuse the gutter style, andselectwarns.How the pieces fit together is in
llm-docs/typst-code-annotations.md.Known limits:
layout-ncolloses its circles, with a warning that names the cell.code-annotationsoptions are not read, in any format. This was probably expected, but I was pretty sure it was possible to set it at code cell level.syntax-highlighting: idiomaticornone,code-line-numbers: trueshows no line numbers, because Typst's nativerawblock has none.definitions.typwith an older copy also lacks Quarto's margin and column helpers, so a.column-marginblock fails to compile inchristopherkenny/tuftewithunknown variable: marginalia, onmaintoo. The error is not very useful in Quarto's context, thus why there is a fallback for annotation in this PR. We could imagine to extend and improve this behaviour more generally across partials which would help extensions creators/maintainers.Before and after
Before is Quarto main, after is this pull request.
Select an image to enlarge it.
Case by case:
filenameon a code blocklst-caplisting.or:startFrom, with or withoutcode-line-numbers{{r}})layout-ncol).syntax-highlighting: idiomaticornonenonewithout a language tag.@fig-xor citationsCloses #9768.
Checklist
I have (if applicable):
AI-assisted PR
Note: autonomous AI agents submitting PRs without human oversight are not permitted — see the Code of Conduct.