python - Sphinx 文件间链接函数

标签 python hyperlink python-sphinx cross-reference

我一直在 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/

相关文章:

javascript - 选择超链接内的标签问题

javascript - 'a' HTML标签在幕后调用window.location.assign?

php - 如何在本地主机和 Web 服务器上实现绝对 URL?

python - 狮身人面像模板

python - 在一个 python 文件上运行 Sphinx 的最简单方法

python - 浏览 Stanford CoreNLP 解析结果

python - 将实例变量设置为类函数的默认参数

python-sphinx - 使用 Read The Docs & Sphinx 和 ReadTheDocs 主题时删除查看源链接

python - Pandas 时区感知索引在转换为系列时会降低时区

python - 如何使类对象可迭代