How would I cross-reference a function generated by autodoc in Sphinx? How would I cross-reference a function generated by autodoc in Sphinx? python python

How would I cross-reference a function generated by autodoc in Sphinx?


You don't need to add labels. In order to refer to a Python class, method, or other documented object, use the markup provided by the Python domain.

For example, the following defines a cross-reference to the mymethod method:

:py:meth:`mymodule.MyClass.mymethod`

Or even simpler (since the Python domain is the default):

:meth:`mymodule.MyClass.mymethod`

The documentation of TextWrapper.wrap that you link to in the question includes two cross-references of this kind (click on "Show Source" to see the reST markup).