Skip to content

Commit 391c13a

Browse files
authored
Disable cross-ref links for type annotations (#1374)
1 parent cb5b4e6 commit 391c13a

File tree

1 file changed

+13
-0
lines changed

1 file changed

+13
-0
lines changed

docs/source/conf.py

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -192,3 +192,16 @@
192192

193193
# If true, `todo` and `todoList` produce output, else they produce nothing.
194194
todo_include_todos = True
195+
196+
# -- Type hints configs ------------------------------------------------------
197+
198+
autodoc_typehints = "signature"
199+
200+
# -- A patch that turns-off cross refs for type annotations ------------------
201+
202+
import sphinx.domains.python
203+
from docutils import nodes
204+
from sphinx import addnodes
205+
206+
# replaces pending_xref node with desc_type for type annotations
207+
sphinx.domains.python.type_to_xref = lambda t, e=None: addnodes.desc_type("", nodes.Text(t))

0 commit comments

Comments
 (0)