sphinx 生成类模块概述 [英] sphinx generate class modules overview

查看:38
本文介绍了sphinx 生成类模块概述的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我希望 sphinx 生成一个类似于 doxygen 生成的模块概述,这里是一个示例

I'd like sphinx to generate a module overview similar to the one generated by doxygen, here is an example

我不知道 sphinx 是怎么做到的

I can't find how sphinx can do that

我可以使用 Graphviz 来生成某种图形,但我找不到一种方法可以在图形中获取与上述示例相同的操作方式的可点击对象.

I could use Graphviz to generate some sort of graph, but I can't find a way to get a clickable object in the graph that operates in the same way as the example above.

有什么办法可以直接在 sphinx 中做到这一点,或者通过一些 hack 使其作为 doxygen 模块概述工作吗?

Is there any way to do that in sphinx directly or some hack to make it work as the doxygen module overview?

推荐答案

Sphinx 有一个内置的 扩展 称为 sphinx.ext.inheritance_diagram使用Graphviz.它定义了一个指令:inheritance-diagram.以下是如何在 .rst 文件中使用它的示例:

Sphinx has a built-in extension called sphinx.ext.inheritance_diagram that uses Graphviz. It defines one directive: inheritance-diagram. Here is an example of how you could use it in an .rst file:

.. inheritance-diagram:: mymodule.MyClass1 mymodule.MyClass2
   :parts: 1

以下是 Sphinx 生成的文档中继承图的一些示例:

Here are some examples of inheritance diagrams in documents generated by Sphinx:

还有一个通用的"sphinx.ext.graphviz 扩展,用于在文档.

There is also a "generic" sphinx.ext.graphviz extension for embedding graphs in documentation.

这篇关于sphinx 生成类模块概述的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆