Skip to content

Conversation

@cscheid
Copy link
Collaborator

@cscheid cscheid commented Aug 20, 2025

Brings:

  • Pandoc to 3.8.3
  • typst to 0.14.2

@posit-snyk-bot
Copy link
Collaborator

posit-snyk-bot commented Aug 20, 2025

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.

@cscheid
Copy link
Collaborator Author

cscheid commented Aug 20, 2025

@tarleb It seems that there's a -f markdown change from Pandoc 3.6.3 to 3.7.0.2. Let's talk about it when we meet next? Thanks!

@tarleb
Copy link
Collaborator

tarleb commented Aug 21, 2025

Sorry, I hadn't seen this. I'll try to be there today.

@cscheid
Copy link
Collaborator Author

cscheid commented Aug 21, 2025

@tarleb suggests " -> \" as a path forward. Let's try it.

@cscheid
Copy link
Collaborator Author

cscheid commented Aug 21, 2025

@tarleb suggests " -> \" as a path forward. Let's try it.

On further thought, this only works if we know that the replacement for the shortcode is in a position where this escaping is required. In order to do that, we would have to enrich the LPEG parser to learn about parsing links and images, and then to process shortcodes differently inside links and images. That's a pretty large undertaking.

@cscheid
Copy link
Collaborator Author

cscheid commented Dec 13, 2025

@gordonwoodhull We should take a look at this PR together next week; there's some brand+typst failures on the update to Pandoc 3.8.3 that I think you'll be better equipped to sort out :)

Typst (sometimes +brand, often #NormalTok) failures:

JATS failures (looks like the Pandoc output doesn't validate?)

Docusaurus failures (apparently from display math markdown writer changing)

LaTeX compilation failures:

DocX snapshot failures:

@cscheid cscheid changed the title [deps] Pandoc 3.7.0.2 [deps] Pandoc 3.8.3, typst 0.14.2 Dec 13, 2025
@gordonwoodhull
Copy link
Contributor

I've pushed a fix: page inset needs to be typst raw inline.

Most of the other failures seem to be because we need to update the Typst templates from Pandoc to get Skylighting support. Not trivial as there's a bunch of new stuff, but not that bad.

for pandoc 3.8

next: investigate why this case enables syntax-highlighting
@gordonwoodhull
Copy link
Contributor

gordonwoodhull commented Dec 17, 2025

Importing highlighting-definitions in the typst template fixes all of the typst failures except for this listings one:

docs/smoke-all/crossrefs/float/typst/typst-listings-1.qmd

So all the stuff I need to update (merging Chris Kenny's improvements with brand yaml, basically) is not reflected in tests.

TL;DR We've been applying highlight-style for all formats, it just wasn't implemented for Typst before.

Now syntax highlighting will match by default!

Claude's explanation:

Quarto always sets highlight-style for ALL formats, including typst:

  1. Default value: kDefaultHighlightStyle = "arrow" defined in src/command/render/constants.ts:8 since March 2021
  2. Applied unconditionally: resolveTextHighlightStyle() in src/command/render/pandoc.ts:1741 is called for all formats with no format-specific checks
  3. For typst: Since extras.html?.[kTextHighlightingMode] is undefined for typst, it falls through to the default case (line 1789-1796) which sets highlight-style to the light theme path
  4. Result: Quarto passes --highlight-style=<path-to-arrow-light.theme> to pandoc even for typst output

Before pandoc 3.8/3.9: This didn't matter because pandoc ignored the highlight-style for typst and used typst's native highlighting.

After pandoc 3.8/3.9: Pandoc now respects --syntax-highlighting for typst output, so quarto's default "arrow" style triggers skylighting for ALL code blocks, including unlanguaged ones (wrapped in NormalTok).

What is NormalTok and why are unlanguaged blocks also invoking skylighting?

NormalTok is a TokenType in skylighting for "regular, unhighlighted text within a highlighted code block."

The typst writer explicitly adds a "default" class to code blocks before calling highlight, even when no language is specified. This allows skylighting to find a syntax definition and process all code blocks.

So the flow is:

  1. Quarto passes --syntax-highlighting=arrow to pandoc (the default)
  2. Pandoc's typst writer adds "default" class to unlanguaged code blocks
  3. Skylighting finds a syntax for "default" and tokenizes everything as NormalTok
  4. Output: #Skylighting(([#NormalTok("some code.");],))
  5. This triggers highlighting-definitions to be included in the template

@cderv
Copy link
Collaborator

cderv commented Dec 18, 2025

Thanks @gordonwoodhull! What I mentioned yesterday is also that Pandoc now uses --syntax-highlighting flag. This is new from pandoc 3.8 https://pandoc.org/releases.html#pandoc-3.8-2025-09-06

Add a new command line option --syntax-highlighting; this takes the values none, default, idiomatic, a style name, or a path to a theme file. It replaces the --no-highlighting, --highlighting-style, and --listings options, which will still work but with a deprecation warning. (Albert Krewinkel)

So I think we need to check if we use that flag, and probably anticipate the end of deprecation warning in our default file use.

We've been applying highlight-style for all formats,

The new option is now syntax-highlighting to use in the default file
https://pandoc.org/MANUAL.html#general-writer-options-1

Currently we use

highlight-style: C:\Users\chris\Documents\DEV_R\quarto-cli\src\resources\pandoc\highlight-styles\arrow-light.theme

And maybe in other places.

Should we do this in another PR maybe ? It is kind of part of the pandoc update though.

@cderv
Copy link
Collaborator

cderv commented Dec 19, 2025

I am just updating to benefit from new condensed logging

@cscheid
Copy link
Collaborator Author

cscheid commented Dec 19, 2025

I think the biggest cause of failures right now if from a LaTeX change in how table counters work in the Pandoc writer and templates. I still don't understand how to avoid that problem.

@cderv
Copy link
Collaborator

cderv commented Dec 19, 2025

Oh, I have dealt with that recently for the rticles R package. I needed to add the missing template part to the rticles' built-in template (rstudio/rticles#596)
Initially, this is the Pandoc change jgm/pandoc@e13aa5c following report jgm/pandoc#11141 and then the latex template change: jgm/pandoc@d835461 (jgm/pandoc#11201).

They do something in the Writer that expects something in the template. It could be either this template addition, or some adaptation in the way we create the table.

Also related, this change in Pandoc is for ensuring that unlabelled tables don't increment counter. I remember this was a problem in cross ref with counter workaround to decrement or something, so it could be now conflicting with what Pandoc is doing.

Hope it helps understand. (Disclaimer: I did not look at failing examples, just what I looked for my rticles maintainance about this)

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.

Typst: Improve syntax highlighting support

6 participants