Sphinx 的“意外章节标题”——问题是 numpy 吗?

mel*_*ort 4 python restructuredtext numpy python-sphinx

跑步时

sphinx-build . html/
Run Code Online (Sandbox Code Playgroud)

在我的doc/目录中,我得到以下输出:

$ sphinx-build . html/
Running Sphinx v0.6.4
No builder selected, using default: html
loading pickled environment... done
building [html]: targets for 0 source files that are out of date
updating environment: 0 added, 1 changed, 0 removed
reading sources... [100%] index                 
reST markup error:
HIDDEN/PATH/matplotlib_visualization.py:docstring of simulator.extensions.matplotlib_visualization.beta:20: (SEVERE/4) Unexpected section title.
Run Code Online (Sandbox Code Playgroud)

这个文件有numpy导入,经过一些研究,似乎 sphinx 使用的 RST 标记在记录方式上有问题numpy。当我取出 numpy 导入时,html 构建良好。

解决此问题的最佳方法是什么?

Jor*_*ona 5

该主题在此线程中讨论:https : //groups.google.com/d/msg/sphinx-users/MAFTlX8pAvk/B9hx7MuBVbIJ

Pierre GM 说:“fredrik,看起来您正在为您的文档使用 thw numpy 标准。然后考虑使用 Pauli Virtanen 实现的 numpydoc 扩展:它可以在这里找到: http://sphinx.googlecode.com/svn/contrib/trunk/

当前信息与 numpydoc 相关: https://github.com/numpy/numpy/blob/master/doc/HOWTO_DOCUMENT.rst.txt

移动关于 NumpyDoc 的信息:https ://numpydoc.readthedocs.io/en/latest/format.html#docstring-standard