我有点困惑的是为什么我的交叉引用目标无法正常工作。只有完整路径似乎有效。我有以下项目结构:
my_project
-my_project
-adapters
-adapter_base
-adapter_1
-adapter_2
-docs
-build
-source
-config.py
config.py
sys.path.insert(0, os.path.abspath('..'))
index.rst
.. toctree::
:maxdepth: 2
modules/the_api
modules.rst
Adapter Base
------------
.. automodule:: my_project.adapters.base
:members:
:inherited-members:
:show-inheritance:
Adapter 1
---------
.. automodule:: my_project.adapters.adapter_1
:members:
:inherited-members:
:show-inheritance:
adapter_1.py
class Adapter1(object):
pass
class Adapter1API(object):
def method_a(self):
"""the docs for this method_b"""
pass
def method_b(self):
"""the docs for this method
This works :func:`my_project.adapters.adapter_1.method_a`
No link :func:`method_a`
No link :func:`.method_a`
No link :func:`.adapter_1.method_a`
"""
正如您在method_b中所看到的,我尝试了4种方法来创建method_a的目标路径,并且只有完整路径才有效。任何想法为什么其他3不是?
答案 0 :(得分:0)
令人尴尬的是,解决方案是:meth:
NOT :func:
不知何故我错过了sphinx有:meth:
指令的事实......