fix: honour code-window-collapse false on a block - #69
Merged
Merged
Conversation
The call site read the block override with a bare or, so an explicit false fell through to the document option and the block was folded anyway. The comment above the reader already said this must not happen.
The script reads a missing marker as an inheriting block, so the Lua change alone left the block folded in the browser. The opt-out now carries cw-collapse-none, which the script honours as off.
mcanouil
marked this pull request as ready for review
September 22, 2026 20:57
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.
code-window-collapse="false"could not turn collapsing off for a block.A document that sets
collapsefolded every block, and a block that opted out was folded with the rest.The call site read the block override with a bare
or, so an explicitfalsewas indistinguishable from an absent attribute and fell through to the document setting.The comment above the reader already said this must not happen.
The fix has two halves, because the first alone changed nothing a reader would see:
read_block_collapseanswers whether the block decided, so an explicitfalsedisables collapsing while an absent attribute still inherits.A value the schema does not accept keeps the old behaviour, inheriting while the check reports it.
cw-collapse-none, and the injected script honours it as a hard off.Without that marker the script reads a missing class as "this block said nothing" and applies the document default anyway.
A fixture covers both blocks, one opting out and one inheriting, and asserts that the two differ and that the document setting still reaches the page.
The suite is 21 passed, 0 failed.
Two further findings from the review are not addressed here:
code-window-enabled="false"and afilenamestill gets a.code-with-filenamewrapper from Quarto, so with a collapsing document the script styles and folds a block that opted out of the extension entirely.I reproduced it and left it for its own change, since it needs a fixture of its own.
checker:attributesruns for every format in the disabled branch whilechecker:optionsis gated on the acting formats, so adocxorlatexrender reports per-block findings only when the filter is off.Verified locally:
tests/run.sh21 passed 0 failed, fullquarto render docs(exit 0, no warnings),markdownlint-cli2with my config (0 issues).