Skip to main content

Module builtin

Module builtin 

Source
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 allocated Vec<String> on every call, and LiteralIncludeValidator::validate calls 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 a literalinclude — against an option the very same validator advertised as valid — and the task-16 audit found the same shape in code-block (force), figure (figwidth/figclass, warned about under the image directive’s name) and image (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§

AdmonitionValidator
Validator for admonition directive
CodeBlockValidator
Validator for code-block directive
FigureValidator
Validator for figure directive
ImageValidator
Validator for image directive
IncludeValidator
Validator for include directive
LiteralIncludeValidator
Validator for literalinclude directive
MathValidator
Validator for math directive
NoteValidator
Validator for note directive
TocTreeValidator
Validator for toctree directive
WarningValidator
Validator for warning directive