Support using beartype
and MyST-Parser for creating a custom role which requires an Inliner
#1017
Labels
enhancement
New feature or request
Describe the feature you'd like to request
Goals
docutils.parsers.rst.roles.code_role
.mypy
)beartype
)Below is a minimized example of my work towards supporting MyST for
substitution-code
within https://github.com/adamtheturtle/sphinx-substitution-extensions.Requirements
beartype==0.19.0
myst-parser==4.0.0
types-docutils==0.21.0.20241128
Files
Layout as described in
https://www.sphinx-doc.org/en/master/usage/configuration.html#confval-extensions.
Command
sphinx-build -M html . build/
Error
Describe the solution you'd like
Modify
MockInliner
as per https://beartype.readthedocs.io/en/latest/faq/#mock-types to define a new__class__
property which returnsInliner
.Describe alternatives you've considered
My workaround is to have
role_fn
hintinliner
asinliner: Inliner | MockInliner
, and then to create a newInliner
object as needed forcode_role
:Another alternative is to contribute to
types-docutils
to havecode_role
take aProtocol
of just what is needed fromInliner
, so it supportsMockInliner
, too.The text was updated successfully, but these errors were encountered: