Add `tests/test_theming/test_theming.py::test_theme_builds`, which is a parametrized test against all builtin sphinx HTML themes, that tests:
1. that the themes builds without warnings for a basic project, and
2. that all `.html` files it produces are valid XML (see https://html.spec.whatwg.org/)
https://pypi.org/project/defusedxml/ was added to the test dependencies, in order to safely parse the XML
This required one fix for `sphinx/themes/basic/search.html`, and one for `sphinx/themes/bizstyle/layout.html`
Also, `tests/test_theming` was removed from the `ruff format` exclude list
Fix a bug whereby the wrong file extension may be used,
when multiple suffixes are specified in the `source_suffix` configuration.
Co-authored-by: Chris Sewell <chrisj_sewell@hotmail.com>
This type alias has now been fully documented for public consumption.
This will be beneficial to the sphinx ecosystem,
to aide/encourage extension developers to provide the correct metadata.
Co-authored-by: Bénédikt Tran <10796600+picnixz@users.noreply.github.com>
This commit overrides the `SphinxLoggerAdapter.warning` method,
to provide documentation and type annotations specific to logging sphinx warnings.
This should aide sphinx core/extension developers in creating good warnings.
Co-authored-by: Bénédikt Tran <10796600+picnixz@users.noreply.github.com>
Co-authored-by: danieleades <33452915+danieleades@users.noreply.github.com>
Consolidate the provision of a single `http_server` utility method, with `tls_enabled` as a boolean flag,
and rework type annotations to make them more understandable.
Co-authored-by: Bénédikt Tran <10796600+picnixz@users.noreply.github.com>
Co-authored-by: Chris Sewell <chrisj_sewell@hotmail.com>
This comit removes select sphinx top-level modules from the `ruff format` exclude list.
They were selected based on the fact that they have the least diffs when formatted,
are not believe to introduce changes that would adversely affect any existing PRs.
This commit fixes the issue of `objects.inv` denoting object names, whilst the `external` role only allows for role names.
As an example, take the `objects.inv` for the sphinx documentation, which contains:
```
py:function
compile : usage/domains/python.html#compile
```
A user might understandably expect that they could reference this using `` :external:py:function:`compile` ``, but actually this would previously error with:
```
WARNING: role for external cross-reference not found: py:function
```
this is because, `function` is the object type, yet `external` expects the related role name `func`.
It should not be necessary for the user to know about this distinction,
so in this commit, we add logic, to first look if the name relates to a role name (as previous, to not be back-breaking) but, if not, then also look if the name relates to an object that has a known role and, if so, use that.
Co-authored-by: Bénédikt Tran <10796600+picnixz@users.noreply.github.com>