斯芬克斯创建类属性选项卡

2024-06-06 14:52:45 发布

您现在位置:Python中文网/ 问答频道 /正文

我将sphinx-apidocsphinx-buildscipy-sphinx-theme一起使用,从numpy-style文档字符串自动构建我的项目文档。你知道吗

我希望sphinx将我的类属性格式化为一个表,而不是一个描述列表,就像autosummary制作一个很好的方法表一样,因为我发现这样做浪费了空间,并且破坏了类属性的概述,如果它们如下图所示很多的话。你知道吗

enter image description here

我的类__init__文档大致如下所示。因为属性是运行时定义的,所以我需要在Attributes部分显式地记录它们。但在默认情况下,它们会被放在一个描述列表中,而不是一个表中。你知道吗

.. rubric:: Methods
.. autoautosummary:: htmdmol.molecule.Molecule
   :methods:

.. rubric:: Attributes

Attributes
----------

numAtoms : int
    Number of atoms in the Molecule
numFrames : int
    Number of conformers / simulation frames in the Molecule

我试过在属性列表中寻找生成<dd> <dl>元素的模板,但没有成功。如果有人能帮助我使Attributes部分看起来和Methods部分一样,我会非常高兴的。你知道吗


Tags: ofthein文档buildnumber列表属性