我一直在 stackoverflow 和官方文档中寻找答案,但仍然找不到解决方案。
在主 Sphinx-doc 文档中我有:
Contents:
.. toctree::
views/index.rst
db/index.rst
在 views/index.rst 中
.. py:currentmodule:: app.views
.. py:function:: create_user
this function uses create_user_db
在 db/index.rst 中
.. py:currentmodule:: app.db
.. py:function:: create_user_db
this function creates the user in database
我需要的是从 create_user 到 create_user_db 所在位置的超链接。
函数不是由 autodoc 生成的,我不想对 db/index 中列出的每个函数使用节和 *.. _section_label :*。
是否有可能以这种方式链接它,以便 View 可以使用 :doc:、:ref: 或其他方式将您移动到 db/index.html#app.db.create_user_db?
最佳答案
这应该有效:
this function uses :py:func:`app.db.create_user_db`
您需要使用完全限定名称。
关于python - Sphinx 文件间链接函数,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/18417712/