Skip to content

fix: stand the Skylighting hot-fix down with the filter - #71

Merged
mcanouil merged 6 commits into
mainfrom
fix/skylighting-hotfix-gate
Sep 23, 2026
Merged

mcanouil merged 6 commits into
mainfrom
fix/skylighting-hotfix-gate

Conversation

@mcanouil

Copy link
Copy Markdown
Owner

A Typst document that sets enabled: false failed to compile, stopping on unknown variable: _cw-page-bg.

The extension declares its Typst colour helpers from code_window.Pandoc, which returns before writing anything when the filter is off. The Skylighting hot-fix was gated on hotfix_skylighting alone, so it still wrote an override calling those helpers, and Typst stopped on the first name it could not resolve. The hot-fix now asks draws_chrome(), the same question mark_cell_output and normalise_language already ask, so it stands down with the filter.

The module contributes two passes, and only one of them failed loudly. The inline pass writes a self-contained box where the theme gives a background colour, so with the filter off it added backgrounds nobody asked for and still compiled. Both passes are now covered.

  • Both disabled fixtures gain inline code and keep their Typst source, and the tests assert the absence of the _cw- helper calls and of the inline box.
  • The examples page and the reference said typst-title was the hot-fix that follows enabled. All three follow it, so a document with the filter off takes none of them.

Verified locally: tests/run.sh 27 passed, 0 failed; every fixture and example.qmd compiles to Typst; shellcheck, shfmt and markdownlint-cli2 clean. Reverting the gate in a scratch copy makes the render fail and both new assertions fire, so they catch the regression rather than passing by construction.

The hot-fix filters asked hotfix_skylighting alone, while the pass that
declares the Typst colour helpers asks whether the render draws chrome at
all. With the filter off, the helpers were never declared and the override
that calls them still went into the document, so Typst stopped on
_cw-page-bg and a document setting enabled: false failed to compile.

The hot-fix now asks draws_chrome, like every other pass that exists only
to serve the chrome.
The hot-fix gate becomes the one-line form the two passes above it use,
and the two new tests become one loop over both fixtures.
The test greps for the "_cw-" prefix rather than the Skylighting override
alone, so the annotation rule that can replace it and the inline-code
fallback are covered too.

The documentation said typst-title was the hot-fix that follows enabled.
All three follow it, so a document with the filter off takes none of them.
The hot-fix contributes a block pass and an inline pass, and the inline one
writes a box that names no helper where the theme gives a background colour.
Both disabled fixtures gain inline code, and the loop asserts the absence of
that box alongside the absence of the helpers.

The loop moves under its own banner, since it was splitting the section on
block languages.
Both hot-fix assertions are negative, so a missing file answered them the
same way a clean render does. The loop now checks for the file first.

The examples page also loses a count that no longer matched the text under
it, and stops listing effects as though they were all of them.
@mcanouil mcanouil added the Type: Bug 🐛 Issues related to bugs, errors, or mistakes label Sep 23, 2026
@mcanouil mcanouil self-assigned this Sep 23, 2026
@mcanouil
mcanouil marked this pull request as ready for review September 23, 2026 09:28
@mcanouil
mcanouil merged commit 6a5d5f0 into main Sep 23, 2026
4 checks passed
@mcanouil
mcanouil deleted the fix/skylighting-hotfix-gate branch September 23, 2026 09:36
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Type: Bug 🐛 Issues related to bugs, errors, or mistakes

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant