Skip to content

feat: check the document configuration against the extension schema - #54

Merged
mcanouil merged 2 commits into
mainfrom
feat/check-the-document-against-the-schema
Sep 6, 2026
Merged

feat: check the document configuration against the extension schema#54
mcanouil merged 2 commits into
mainfrom
feat/check-the-document-against-the-schema

Conversation

@mcanouil

@mcanouil mcanouil commented Sep 6, 2026

Copy link
Copy Markdown
Owner

This adds the runtime schema check to code-window and moves the manifest to quarto-lua-modules 2.2.0.
The manifest now declares schema-check.lua alongside the logging.lua and string.lua siblings it loads, and adds quarto-wizard 3.5.0 for schema.lua, fetched from the release asset.
main.lua builds the checker at file scope and hands it to code-window.lua, which is where the filter registration actually lands, because main.lua registers code_window.Meta, so the call sits at the top of that handler and before the first option is read.
A probe under extensions.code-window reported an out-of-enum style and an unrecognised key the extension never reads, and the documented configuration produced no message at all.
Deleting the vendored schema-check.lua aborts the documentation render, which proves the check is reached rather than merely present.

Two disagreements between the schema and the code that reads it, both recorded and left uncorrected.
Booleans: _vendor/quarto-wizard/schema.lua:317 coerces yes and no to real booleans, so enabled: yes passes the check in silence, while code-window.lua:726 compares the stringified value against the exact string true and turns the extension off.
Rendered both ways, enabled: true produced the window markup and enabled: yes produced none.
The same idiom carries auto-filename, cell-output and lines-label at code-window.lua:727, 729 and 732 against _schema.yml:9, 18 and 31, and the three hotfix entries at code-window.lua:719 against _schema.yml:39, 50 and 61.
Wrapper: _schema.yml:22 declares type: string with no pattern, so wrapper: "my window" passes the check and code-window.lua:730 writes it into the Typst source, where the compile then fails.

Two things this repository turns out not to have.
The schema declares no enumCaseInsensitive, so style: MACOS is rejected by the check and by the extension alike.
The collapse enum mixes bare true and false with strings and is harmless as a document option, since collapse: true passed the check and applied the collapsed mode.

Correcting the schema is separate work, and nothing here changes what the extension does with a valid configuration.

@mcanouil mcanouil added the Type: Enhancement 💡 Issues related to enhancements, improvements, new features, or new analyses label Sep 6, 2026
@mcanouil mcanouil self-assigned this Sep 6, 2026
@mcanouil
mcanouil marked this pull request as ready for review September 6, 2026 21:36
@mcanouil
mcanouil merged commit 81a6f86 into main Sep 6, 2026
4 checks passed
@mcanouil
mcanouil deleted the feat/check-the-document-against-the-schema branch September 6, 2026 21:50
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Type: Enhancement 💡 Issues related to enhancements, improvements, new features, or new analyses

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant