fix: read the code block attributes through the schema - #60
Merged
Merged
Conversation
`quarto-lua-modules` moves to 2.5.0, which adds `Checker:option` for reading what the schema resolves an option to. `quarto-wizard` moves to 3.6.3, whose `schema.lua` is unchanged from the vendored 3.6.0.
No schema in the fleet declared `additionalProperties: false`, so a key nested inside an option was never checked and a typo did nothing in silence. The nested object blocks now declare it. A union such as `type: [string, object]` is unaffected in its string form, and the extension's own documented configuration still passes.
Quarto Wizard publishes the editor extension and the Lua reference validator apart. The validator is tagged `schema-v<version>` and is at 2.1.0; the manifest pinned 3.6.3, which is a version of the editor. The source now declares `tag-prefix: schema-v` and names the version of the validator, so `--check` reads the train the file actually comes from rather than the newest release the origin happens to publish. 2.1.0 carries the fix that accepts only `true` and `false` as a boolean.
The code-window-* attributes were read from the document text, so a value the schema rejects was applied without a word. The schema now resolves every attribute of the CodeBlock group, in both the HTML/Reveal.js and the Typst code paths, and a value it rejects is named one time. The extension's own "Unknown block style" and "Unknown collapse value" warnings duplicated what the schema now reports for the same two attributes, so both are removed; the fallback behaviour is unchanged.
The schema declares this attribute boolean with a default of false, and its description says it suppresses auto-filename "without changing the global setting", but the code only tested whether the attribute was written, not what it said, because Lua treats any non-nil string as true regardless of its text. An explicit "false" has therefore always suppressed auto-filename exactly like "true". The resolved, schema-coerced boolean is now read and stringified before the comparison, so only "true" suppresses; absence and an explicit "false" both leave auto-filename alone, in both the HTML/Reveal.js and the Typst code paths.
The extension's own "Unknown collapse value" warning named the same mistake checker:options now reports for the "collapse" document option, on top of the same duplicate already removed for the "code-window-collapse" block attribute. The warning is removed from both call sites; the fallback (no collapsing for an unrecognised value) behaves exactly as before.
The extension's own "Unknown style" warning named the same mistake checker:options now reports for the "style" document option, the same shape already removed for "collapse". The warning is removed; the fallback (VALID_STYLES[opts['style']] and opts['style'] or 'macos') behaves exactly as before.
A Pandoc attribute value is always a string, but code-window-collapse declared type: [boolean, string] with an enum holding the unquoted YAML booleans true and false alongside the strings "open" and "closed". The vendored validator's coercion returns a value unchanged as soon as its current Lua type already matches a member of the declared type list, so the string always won and boolean coercion was never attempted, and the enum check then compared the string "true" against the schema's own boolean true and failed. Every legal code-window-collapse="true" or ="false" render has therefore warned since the schema check was added, even though the value is exactly what the extension's own documentation asks for. Declared type: string with a quoted enum instead, the convention quarto-modal already uses for its own fullscreen attribute. The now -inert stringify_bool step in resolve_collapse is removed with it: neither caller of that function is ever handed a Lua boolean, because the document option is read through a helper that already stringifies and the attribute no longer declares the union type that could produce one.
CodeBlock (the HTML/Reveal.js handler) skipped checker:attributes for an output-of-an-executed-cell block, because the is_plain_output early return sat before the html branch that calls it. process_typst_block already checks every attribute unconditionally, before its own is_unnamed_cell_output test, so the same document reported a finding for such a block on the Typst path and stayed silent about the identical attributes on the HTML path. The html branch now checks before the is_plain_output return, so both formats validate the same block the same way; nothing about how either format renders that block changes.
The extension only acts on html and typst. checker:options ran before that union was known to matter, so any other format reported a configuration mistake for a check that never happens there. Gate the call on the same CURRENT_FORMAT union the html and typst branches already use further down in Meta.
An unknown key nested inside an option is now reported as a warning rather than as an error, which matches how an unknown key at the top of the extension's own block is reported. One nested typo no longer marks the whole options result invalid.
mcanouil
marked this pull request as ready for review
September 16, 2026 20:22
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.
The
code-windowgroup of attributes (code-window-enabled,code-window-style,code-window-collapse,code-window-lines,code-window-no-auto-filename, and the rest) is now read through the schema, so a rejected value is named once instead of being applied without a word.Three related bugs are fixed along the way.
code-window-no-auto-filename="false"used to suppress the automatic filename exactly like"true", because only presence was read; the actual boolean value is now honoured.code-window-collapse's schema mixed unquoted booleans into its enum, so a documentedtrueorfalsewarned on every render; the enum members are now quoted strings, matching what a Pandoc attribute value always is.The extension's own duplicate warnings for
code-window-styleandcode-window-collapse, at both the attribute and the document-option level, are removed now that the schema reports each mistake once.A code block holding an executed cell's output is now validated on the HTML path the same way it already was on the Typst path.
The options check now runs only after the
html/typstformat guard.The vendored
quarto-lua-modulesmoves to 2.5.0 and the schema validator is pinned toquarto-wizard'sschema-v2.2.0release train.