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

前端 未结 1 1767
青春惊慌失措
青春惊慌失措 2020-12-05 04:15

I am using the Sphinx autodoc feature to generate documentation based on the docstrings of my Python library.

The syntax for cross referencing

相关标签:
1条回答
  • 2020-12-05 04:30

    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).

    0 讨论(0)
提交回复
热议问题