Sphinx automodule: how to reference classes in same module?

后端 未结 2 1710
误落风尘
误落风尘 2021-02-05 02:53

I am trying to use the sphinx autodoc extension and specifically the automodule directive to automatically generate documentation for django app I am working on. Th

2条回答
  •  鱼传尺愫
    2021-02-05 03:21

    You can reference a class like this:

    class B(object):
        """docs for B with reference to :class:`.A`"""
        pass
    

    Sphinx will intelligently try and figure out what you're referencing. If there are multiple classes with the name A, you might get a warning, but it should pick up the one in the current module.

提交回复
热议问题