How do I reference a documented Python function parameter using Sphinx markup?

前端 未结 4 1158
闹比i
闹比i 2021-02-06 21:29

I\'d like to reference a previously-documented function parameter elsewhere in a Python docstring. Consider the following (admittedly completely artificial) example:

         


        
4条回答
  •  误落风尘
    2021-02-06 22:09

    There is no simple way to get a direct reference to a parameter of a function with sphinx and I don't know an extension for this problem.

    The documentation of the python domain explains which objects can be cross referenced.

    A possible way to give the user a reference to parameter bar of function foo would be

    See parameter ``bar`` in :func:`foo`.
    

    Maybe a direct reference would be possible by writing an extension.

提交回复
热议问题