I've been looking for an answer on stackoverflow and in official docs and still can't find the solution.

In the main Sphinx-doc document I have:

Contents:

.. toctree::

    views/index.rst
    db/index.rst

In views/index.rst

.. py:currentmodule:: app.views
.. py:function:: create_user

  this function uses create_user_db

and in db/index.rst

.. py:currentmodule:: app.db

.. py:function:: create_user_db
   this function creates the user in database

What I need is a hyperlink from create_user to exacly the place create_user_db is.

Functions are not genereated by autodoc, I don't want to use sections and *.. _section_label :* for every function that is listed in db/index.

Is it even possible to link it that way that views can move you to db/index.html#app.db.create_user_db using :doc:, :ref: or something?

有帮助吗?

解决方案

This should work:

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

You need to use the fully qualified name.

许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top