feat(typst): add code annotation and filename support#14170
Draft
mcanouil wants to merge 14 commits intoquarto-dev:mainfrom
Draft
feat(typst): add code annotation and filename support#14170mcanouil wants to merge 14 commits intoquarto-dev:mainfrom
mcanouil wants to merge 14 commits intoquarto-dev:mainfrom
Conversation
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
…o-code-annotation
Collaborator
✅ 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. |
…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.
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.
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).