summaryrefslogtreecommitdiff
path: root/docs
diff options
context:
space:
mode:
authorJulian Berman <Julian@GrayVines.com>2022-11-30 13:16:02 -0500
committerJulian Berman <Julian@GrayVines.com>2022-11-30 13:16:02 -0500
commit57f2948447b51979d273149708a4f9cdb3ea64df (patch)
tree2b9429fa7e62235fca9fc52676c1dfc96e1b3038 /docs
parentea1c71abbe70f426ee4667d965ab9aa2b1f07d4b (diff)
downloadjsonschema-57f2948447b51979d273149708a4f9cdb3ea64df.tar.gz
Handle the TypeVar for format checker callables.
Mostly follows sphinx-doc/sphinx#10785
Diffstat (limited to 'docs')
-rw-r--r--docs/api/jsonschema/index.rst3
-rw-r--r--docs/conf.py27
2 files changed, 30 insertions, 0 deletions
diff --git a/docs/api/jsonschema/index.rst b/docs/api/jsonschema/index.rst
index 21ba070..ebf4c8a 100644
--- a/docs/api/jsonschema/index.rst
+++ b/docs/api/jsonschema/index.rst
@@ -17,3 +17,6 @@ Package summary
.. automodule:: jsonschema
:members:
:imported-members:
+
+
+.. autodata:: jsonschema._format._F
diff --git a/docs/conf.py b/docs/conf.py
index 3f1f4a9..d691aaf 100644
--- a/docs/conf.py
+++ b/docs/conf.py
@@ -36,6 +36,33 @@ pygments_dark_style = "one-dark"
html_theme = "furo"
+# See sphinx-doc/sphinx#10785
+_TYPE_ALIASES = {
+ "jsonschema._format._F", # format checkers
+}
+
+
+def _resolve_type_aliases(app, env, node, contnode):
+ if (
+ node["refdomain"] == "py"
+ and node["reftype"] == "class"
+ and node["reftarget"] in _TYPE_ALIASES
+ ):
+ return app.env.get_domain("py").resolve_xref(
+ env,
+ node["refdoc"],
+ app.builder,
+ "data",
+ node["reftarget"],
+ node,
+ contnode,
+ )
+
+
+def setup(app):
+ app.connect("missing-reference", _resolve_type_aliases)
+
+
# = Builders =
doctest_global_setup = """