Expand description
Built-in directive validators for common Sphinx directives
§Option lists
Each validator’s option list is spelled ONCE, as a shared &[&str]
const, for two reasons found the hard way in wave 4.5:
valid_options()returns a freshly allocatedVec<String>on every call, andLiteralIncludeValidator::validatecalls it from inside its per-option loop;- more importantly, a validator that spells its options twice drifts.
Task 14’s env oracle caught the build warning
Unknown option 'lines'on aliteralinclude— against an option the very same validator advertised as valid — and the task-16 audit found the same shape incode-block(force),figure(figwidth/figclass, warned about under the image directive’s name) andimage(loading).
Every list mirrors the directive’s parse-time option_spec in
src/rst/block.rs, which is this crate’s probe-verified transcription
of the real docutils/sphinx spec. The test
validator_option_lists_match_the_parser_spec holds the two together in
BOTH directions, and every_validator_accepts_every_option_it_advertises
holds each list against its own validate. A fabricated “Unknown
option” warning is not cosmetic: it fails -W on projects Sphinx builds
clean.
Structs§
- Admonition
Validator - Validator for admonition directive
- Code
Block Validator - Validator for code-block directive
- Figure
Validator - Validator for figure directive
- Image
Validator - Validator for image directive
- Include
Validator - Validator for include directive
- Literal
Include Validator - Validator for literalinclude directive
- Math
Validator - Validator for math directive
- Note
Validator - Validator for note directive
- TocTree
Validator - Validator for toctree directive
- Warning
Validator - Validator for warning directive