Skip to content

feat(typst): add code annotation and filename support#14170

Draft
mcanouil wants to merge 14 commits intoquarto-dev:mainfrom
mcanouil:feat/typst-annotation-filename
Draft

feat(typst): add code annotation and filename support#14170
mcanouil wants to merge 14 commits intoquarto-dev:mainfrom
mcanouil:feat/typst-annotation-filename

Conversation

@mcanouil
Copy link
Collaborator

@mcanouil mcanouil commented Mar 6, 2026

Introduce a unified wrapper for code blocks and skylighting transformed code blocks in Typst.

Add filename processing (lua/Typst) and code-annotation processing (lua/Typst).

mcanouil added 9 commits March 6, 2026 10:15
Add quarto-circled-number, quarto-code-block, and quarto-annotation-item
functions for code annotation support and filename bar in Typst output.
Route all native raw code blocks through the unified wrapper.
Lua filters need to know whether Skylighting is active to choose
between emitting annotation markers (Skylighting) or wrapping
CodeBlocks directly (native/none highlighting).
Add helper functions for Typst annotation data (typstAnnotationsDict,
typstAnnotationMarker, wrapTypstAnnotatedCode), register Typst
annotation processor, and handle standalone CodeBlock,
DecoratedCodeBlock, and OL paths for Typst output.

Skylighting mode emits a comment marker for the TS post-processor.
Native mode wraps CodeBlocks in quarto-code-block with annotations.
OL items become quarto-annotation-item raw Typst blocks.
Patch Skylighting function to accept annotations parameter, track line
position unconditionally, render circled annotation numbers per line,
and route output through quarto-code-block wrapper. Merge Lua-emitted
annotation comment markers into Skylighting call sites.
Wrap code blocks with filename attribute in quarto-code-block(filename: ...)
for Typst output, rendering a simple filename bar above the code.
Add smoke-all tests for:
- Code annotations with Skylighting (default)
- Code annotations with native highlighting
- Code annotations disabled (none)
- Filename bar on code blocks
@mcanouil mcanouil self-assigned this Mar 6, 2026
@mcanouil mcanouil changed the title feat(typst)= Add code annotation and filename support feat(typst): add code annotation and filename support Mar 6, 2026
@posit-snyk-bot
Copy link
Collaborator

posit-snyk-bot commented Mar 6, 2026

Snyk checks have passed. No issues have been found so far.

Status Scanner Critical High Medium Low Total (0)
Open Source Security 0 0 0 0 0 issues
Licenses 0 0 0 0 0 issues

💻 Catch issues earlier using the plugins for VS Code, JetBrains IDEs, Visual Studio, and Eclipse.

mcanouil added 5 commits March 6, 2026 21:34
…or Skylighting

Update the annotation marker regex to support optional #block[ and #quarto-code-filename(...) wrappers in Skylighting call sites. This improves compatibility with various annotation formats.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants