Using Sphinx to automatically generate a separate document for each function

天大地大妈咪最大 提交于 2019-11-28 00:11:36
mzjn

In the answer to Sorting display by class using sphinx with 'autodoc'? it is explained how to generate documentation for classes with one page per class, using autosummary with autosummary_generate=True.

This mechanism works for functions too. Use something like this:

EoN API documentation
=====================

.. currentmodule:: EoN

.. autosummary::
   :toctree: functions

   my_function1
   my_function2
   my_function3
   ...

You have to enumerate each function in the autosummary directive, but the corresponding *.rst files are generated automatically (in the functions subdirectory).

astrofrog

I think the sphinx-automodapi Sphinx extension may do what you need. Essentially to document a module you would just do:

.. automodapi:: mypackage.mymodule

and it will generate the table and individual pages for each function.

Disclaimer: I am an author of sphinx-automodapi

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!