Skip to content

fix: read the code block attributes through the schema - #60

Merged
mcanouil merged 15 commits into
mainfrom
build/update-the-vendored-modules
Sep 16, 2026
Merged

mcanouil merged 15 commits into
mainfrom
build/update-the-vendored-modules

Conversation

@mcanouil

@mcanouil mcanouil commented Sep 13, 2026

Copy link
Copy Markdown
Owner

The code-window group 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 documented true or false warned 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-style and code-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/typst format guard.

The vendored quarto-lua-modules moves to 2.5.0 and the schema validator is pinned to quarto-wizard's schema-v2.2.0 release train.

`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.
@mcanouil mcanouil added the Type: Dependencies ⬆️ Issues related to dependencies, which are external libraries or packages that are used label Sep 13, 2026
@mcanouil mcanouil self-assigned this Sep 13, 2026
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.
@mcanouil mcanouil added Type: Enhancement 💡 Issues related to enhancements, improvements, new features, or new analyses and removed Type: Dependencies ⬆️ Issues related to dependencies, which are external libraries or packages that are used labels Sep 14, 2026
@mcanouil mcanouil changed the title build: update the vendored modules feat: report an unknown key nested in an option Sep 14, 2026
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 mcanouil added Type: Bug 🐛 Issues related to bugs, errors, or mistakes and removed Type: Enhancement 💡 Issues related to enhancements, improvements, new features, or new analyses labels Sep 16, 2026
@mcanouil mcanouil changed the title feat: report an unknown key nested in an option fix: read the code block attributes through the schema Sep 16, 2026
@mcanouil
mcanouil marked this pull request as ready for review September 16, 2026 20:22
@mcanouil
mcanouil merged commit c855d25 into main Sep 16, 2026
4 checks passed
@mcanouil
mcanouil deleted the build/update-the-vendored-modules branch September 16, 2026 20:58
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