我想使用 sphinx 构建我们的文档,并获得与 NumPy 文档相同的参数格式(https://github.com/numpy/numpy/blob/master/doc/HOWTO_DOCUMENT.rst.txt https://github.com/numpy/numpy/blob/master/doc/HOWTO_DOCUMENT.rst.txt )
我找到了两种使用 sphinx 来记录第一种样式参数的方法,其中一种是
:param name: description
or
:keyword name: description
另一个(NumPy 风格)
Parameters
----------
name: type
description
下面是一个示例:
http://docs.scipy.org/doc/numpy/reference/distutils.html#module-numpy.distutils http://docs.scipy.org/doc/numpy/reference/distutils.html#module-numpy.distutils
和来源
def get_subpackage(self,subpackage_name,
subpackage_path=None,
parent_name=None,
caller_level = 1):
"""Return list of subpackage configurations.
Parameters
----------
subpackage_name: str,None
Name of the subpackage to get the configuration. '*' in
subpackage_name is handled as a wildcard.
subpackage_path: str
If None, then the path is assumed to be the local path plus the
subpackage_name. If a setup.py file is not found in the
subpackage_path, then a default configuration is used.
parent_name: str
Parent name.
"""
但是,当我使用 sphinx 构建文档时(我使用 sphinx-apidoc 和 sphinx-build ),当我使用第一个语法( :param name: description )时,我可以生成格式化列表,但是当我尝试使用 NumPy 时样式我不明白格式。查看第一个语法(http://docutils.sourceforge.net/docs/ref/rst/restructedtext.html#sections http://docutils.sourceforge.net/docs/ref/rst/restructuredtext.html#sections)似乎是这样的
Parameters
----------
只是一个部分标题。但是,在 sphinx 中使用此格式时,标题参数不会出现在输出中,并且它不会获得任何参数部分格式。
有谁知道 NumPy 如何使用 sphinx 构建文档以使这种格式适用于参数?
我试图查看 makefile 和 conf.py,但我不确定如何