Sorting display by class using sphinx with 'autodoc'?

后端 未结 1 1808
臣服心动
臣服心动 2020-11-30 11:56

Is there a way to display a \"Classes\" list / tab using Sphinx, or to organize the html pages generated to show members by class, classes being visually well separated?

相关标签:
1条回答
  • 2020-11-30 12:31

    The autosummary extension, with the autosummary_generate configuration variable set to True, can be used to 1) generate compact summary listings and 2) generate class documentation with one page per class.

    You have to explicitly specify each class to be included, but once this is done you have a setup for generating clear documentation where the classes are visually well separated.

    The following markup will output one "stub" .rst page for each class (Class1, Class2, Class3). Each page is based on a template and includes an .. autoclass:: directive that extracts the full documentation. In the final HTML output, each class page is linked from the corresponding entry in the main autosummary table.

    :mod:`mymodule` --- Some module
    ===============================
    
    This module contains several classes. 
    
    .. currentmodule:: mymodule
    
    Class overview
    --------------
    
    .. autosummary::
       :toctree: stubs
       :template: class.rst
    
       Class1
       Class2
       Class3
    

    Details here: https://www.sphinx-doc.org/en/master/usage/extensions/autosummary.html

    0 讨论(0)
提交回复
热议问题