在 Python 中记录模块/类/函数体 Sphinx 文档
Sphinx 文档是否可以通过 autodoc 功能输出函数或类体(代码本身)?我使用 autodoc 取得了很大的成功。除了将文档字符串拉入文档之外,我还想为每个函数添加一个单击链接,它将向您显示源代码......这可能吗?
这就是我的大部分文档现在的样子:
.. module:`foo.mymodule`
Title
===================
.. automodule:: foo.mymodule
.. autoclass:: MyModulesClass
:members:
:undoc-members:
Is there a way with Sphinx documentation to output a function or class body (the code itself) with the autodoc feature? I'm using autodoc to much success. In addition to the docstrings getting pulled in to the documentation I want like a link to click for each function where it will show you the source... is that possible?
This is about what most of my documentation looks like now:
.. module:`foo.mymodule`
Title
===================
.. automodule:: foo.mymodule
.. autoclass:: MyModulesClass
:members:
:undoc-members:
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
如果这仍然很重要: viewcode 扩展 可以做到这一点,但需要开发Sphinx 版本 (1.0)
If this still matters: The viewcode extension can do this, but needs the development version (1.0) of Sphinx
我不相信是这样。 Autodoc 仅用于从源代码中提取文档。
I don't believe so. Autodoc is only for pulling the documentation out of the source code.