Skip to content

Commit 78a54f8

Browse files
committed
fix: merge parent block from code cell with annotation marker regex for 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.
1 parent 9416ad1 commit 78a54f8

1 file changed

Lines changed: 4 additions & 3 deletions

File tree

src/format/typst/format-typst.ts

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -207,7 +207,7 @@ function skylightingPostProcessor(brandBgColor?: string) {
207207

208208
// Annotation markers emitted by the Lua filter as Typst comments
209209
const annotationMarkerRe =
210-
/\/\/ quarto-code-annotations: (\([^)]*\))\n\s*#Skylighting\(/g;
210+
/\/\/ quarto-code-annotations: (\([^)]*\))\n(\s*(?:#block\[\s*)*(?:#quarto-code-filename\([^\n]*\)\[\s*)?)#Skylighting\(/g;
211211

212212
return async (output: string) => {
213213
let content = Deno.readTextFileSync(output);
@@ -260,10 +260,11 @@ function skylightingPostProcessor(brandBgColor?: string) {
260260
}
261261
}
262262

263-
// Merge annotation markers into Skylighting call sites
263+
// Merge annotation markers into Skylighting call sites, including
264+
// optional #block[ wrappers and #quarto-code-filename(...)[ wrappers.
264265
const merged = content.replace(
265266
annotationMarkerRe,
266-
"#Skylighting(annotations: $1, ",
267+
"$2#Skylighting(annotations: $1, ",
267268
);
268269
if (merged !== content) {
269270
content = merged;

0 commit comments

Comments
 (0)