【问题标题】:Sphinx linking functions between files文件之间的 Sphinx 链接函数
【发布时间】:2013-08-24 10:46:49
【问题描述】:

我一直在 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 :*。

是否有可能使用 :doc:、:ref: 或其他方式将视图链接到 db/index.html#app.db.create_user_db?

【问题讨论】:

    标签: python hyperlink python-sphinx cross-reference


    【解决方案1】:

    这应该可行:

    this function uses :py:func:`app.db.create_user_db`
    

    您需要使用完全限定名称。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2016-05-26
      • 2012-08-27
      • 2019-11-09
      • 1970-01-01
      • 2021-11-06
      • 2012-12-30
      相关资源
      最近更新 更多