Skip to content

fix: honour code-window-collapse false on a block - #69

Merged
mcanouil merged 3 commits into
mainfrom
docs/accuracy-pass
Sep 23, 2026
Merged

mcanouil merged 3 commits into
mainfrom
docs/accuracy-pass

Conversation

@mcanouil

Copy link
Copy Markdown
Owner

code-window-collapse="false" could not turn collapsing off for a block.

A document that sets collapse folded 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 explicit false was 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_collapse answers whether the block decided, so an explicit false disables collapsing while an absent attribute still inherits.
    A value the schema does not accept keeps the old behaviour, inheriting while the check reports it.
  • A block that turns collapsing off carries 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:

  • A block with code-window-enabled="false" and a filename still gets a .code-with-filename wrapper 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:attributes runs for every format in the disabled branch while checker:options is gated on the acting formats, so a docx or latex render reports per-block findings only when the filter is off.

Verified locally: tests/run.sh 21 passed 0 failed, full quarto render docs (exit 0, no warnings), markdownlint-cli2 with my config (0 issues).

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 mcanouil added the Type: Bug 🐛 Issues related to bugs, errors, or mistakes label Sep 22, 2026
@mcanouil mcanouil self-assigned this Sep 22, 2026
@mcanouil
mcanouil marked this pull request as ready for review September 22, 2026 20:57
@mcanouil
mcanouil merged commit 9e82f85 into main Sep 23, 2026
4 checks passed
@mcanouil
mcanouil deleted the docs/accuracy-pass branch September 23, 2026 08:19
mcanouil added a commit that referenced this pull request Sep 23, 2026
The fix and docs entries for pull requests #69 and #61 were missing
their pull request reference.
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