Skip to content

✨ Parse directive source without a directive schema - #1233

Open
adamtheturtle wants to merge 1 commit into
executablebooks:masterfrom
adamtheturtle:adamtheturtle/directive-parsing-without-schema
Open

adamtheturtle wants to merge 1 commit into
executablebooks:masterfrom
adamtheturtle:adamtheturtle/directive-parsing-without-schema

Conversation

@adamtheturtle

Copy link
Copy Markdown

Source-analysis tools currently have to define a placeholder docutils directive and custom option_spec just to extract arbitrary options and body offsets. Allow parse_directive_text(None, first_line, content) to parse the syntax without a directive schema, retaining string values and syntax diagnostics.

Make DirectiveParsingResult generic and type the schema-free overload as DirectiveParsingResult[str]. Calls with a directive class or full-YAML mode keep support for arbitrary converted values. Existing directive validation and rendering behavior is unchanged.

Closes #1232.

This removes the abstract directive, custom option mapping and Pylint/Pyright suppressions from the downstream integration in adamtheturtle/sybil-extras#1369.

Validation:

  • tox -e py311-sphinx9: 1,575 passed, 11 skipped.
  • tox -e mypy,ruff-check,ruff-fmt and pre-commit run --all-files: passed.
  • tox -e docs-clean -- -T: passed with warnings treated as errors.
  • Downstream: 1,007 tests with 100% line/branch coverage and all four type checkers passed using the simplified adapter without suppressions.

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Allow directive source extraction without defining a docutils directive

1 participant