微信公众号搜"智元新知"关注
微信扫一扫可直接关注哦!

Sphinx 将方法参数生成为项目符号而不是表格

如何解决Sphinx 将方法参数生成为项目符号而不是表格

我在使用 karma 主题通过 sphinx 生成 api 文档时遇到问题。 目前,它生成方法参数并以项目符号而不是表格形式返回。

左侧是我们的 api 文档,右侧是 karma-sphinx 示例:

On the left is our api doc,on the right is the karma-sphinx example

这是我们的 conf.py

import os
import sys

sys.path.insert(0,os.path.abspath('./..'))

project = 'x'
copyright = 'x'
author = 'x'

release = 'alpha'

extensions = ['sphinx.ext.autodoc','m2r2','sphinx.ext.napoleon'
              ]

templates_path = ['_templates']

exclude_patterns = ['_build','Thumbs.db','.DS_Store']

html_theme = 'karma_sphinx_theme'

html_static_path = []

autodoc_mock_imports = ['sip','PyQt5','PyQt5.QtGui','PyQt5.QtCore','PyQt5.QtWidgets','digi','flask','baseconvert','numpy','dronekit','pyzmq','matplotlib','requests','future','flask_cors']

这是我们的模块之一 .rst

Frontend package
================

Subpackages
-----------

.. toctree::
   :maxdepth: 4

   Frontend.Components
   Frontend.Map


Frontend.MainWindow module
--------------------------

.. automodule:: Frontend.MainWindow
   :members:
   :undoc-members:
   :show-inheritance:

Frontend.MainWindowUI module
----------------------------

.. automodule:: Frontend.MainWindowUI
   :members:
   :undoc-members:
   :show-inheritance:

Module contents
---------------

.. automodule:: Frontend
   :members:
   :undoc-members:
   :show-inheritance:

是否有将其从项目符号更改为表格的设置还是这是一个错误? 我们还尝试了 read the docs 主题,结果相同。 我们使用 make html 来构建没有错误页面

编辑: 我试图复制粘贴业力示例(rst + conf.py 并自己构建 html 并遇到了同样的问题。

Result when code copy pasted from the karma example

再次左边是我的,右边是例子。我还有一个朋友在他的 PC 上构建了 html,当然还有 read-the-docs。但是在所有版本中问题仍然存在,因此应该不是 sphinx/theme 安装的问题。

解决方法

似乎 karma-sphinx(以及与此相关的 insegel-sphinx)与当前版本的 Sphinx 无法正常工作。

我在 Sphinx 1.7.5 版中正常工作(表格而不是项目符号),但它从 Sphinx 2.0 开始(从 pip 安装)被破坏了。

很遗憾,因为我认为 karma-sphinx 很漂亮。

版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。