refactor: let the schema decide an option's default - #68
Merged
Merged
Conversation
mcanouil
marked this pull request as ready for review
September 21, 2026 09:52
The schema declares a default for each of the seven options, and a table in the Lua declared the same seven again. The check already answers what the schema says, and that answer was dropped, so the literals decided while the schema was what the editor showed. Changing a default in _schema.yml alone did nothing. The check's answer is kept now. The table stays as a fallback for the two cases the schema cannot answer: a format the extension does not act on, where the check never runs, and a schema that could not be read, which is a state the extension renders through. Three fixtures cover it: the wrapper name comes from the schema, follows a change made there alone, and falls back when the file is gone. The three hotfix defaults are still declared twice. They are nested in the schema and read through a different path, so they are left alone here.
mcanouil
force-pushed
the
refactor/option-defaults-schema
branch
from
September 21, 2026 10:58
974f006 to
698505c
Compare
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.
_schema.ymldeclares a default for each of the seven options, and a table in the Lua declared the same seven again. The schema check already answers what the schema says, and that answer was thrown away, so the literals decided while the schema was what the editor showed. Changing a default in_schema.ymlalone did nothing, and nothing reported the difference.The check's answer is kept now, and the table is demoted to a fallback for the two cases the schema cannot answer: a format the extension does not act on, where the check never runs, and a schema that could not be read, which is a state the extension renders through rather than stopping for.
The schema is read first and the fallback fills only what it leaves unanswered. The other order would have made the fallback the list of options allowed to have a default at all, which is the coupling this removes.
Three checks cover it. The wrapper name comes from the schema, it follows a change made in the schema alone, and it falls back when the file is gone. The wrapper is the option under test because it reaches the Typst output word for word, and the middle check also requires the old name to be absent, so a rename that missed a call site fails.
The three hot-fix defaults are still kept by hand. They are nested in the schema and read on their own path, which takes a boolean or a map, so they need more than a table of defaults handed to the options reader. That is tracked separately, and the comment in the code says so rather than claiming the schema decides everything.
No behaviour changes, so there is no changelog entry. Nineteen tests pass,
example.qmdrenders byte-identical tomainin HTML, Typst and Reveal.js, and the documentation site renders with no warnings. Three review rounds.