【发布时间】:2016-04-06 14:27:46
【问题描述】:
你好,
我有一个 python 模块“example_doc”,其中包含“MyObj”,我正在尝试使用 sphinx 进行记录。当我使用 'autodoc' 和 autoclass 指令时:
.. autoclass:: testdoc.example_doc.MyObj
它会生成带有对象描述的正确页面,并且由于我使用的是“viewcode”sphinx 扩展,因此我在旁边获得了指向源代码的链接。
但是,当我尝试直接使用类指令来重现结果时:
.. class:: testdoc.example_doc.MyObj
我没有得到源代码的链接。
编辑: 我正在为 conda 使用最新版本的 sphinx,即 sphinx 1.3.5 和 我的 conf.py 中只有“sphinx.ext.autodoc”和“sphinx.ext.viewcode”作为扩展名。
使用的代码:
Source link
===========
autodoc below
.. autoclass:: testdoc.example_doc.MyObj
class below
.. class:: testdoc.example_doc.MyObj
结果:
【问题讨论】:
-
我无法重现此内容。使用
.. class::时,我也会得到一个 [来源] 链接。 -
我仍然无法重现该问题。你用的是什么版本的狮身人面像?
-
@mzjn 我编辑了我的帖子以包含 sphinx 版本(来自 conda 包的 1.3.5)
标签: python python-sphinx