我正在尝试参考
http://docs.python.org/2.7/reference/datamodel.html#object.__enter__
来自我的 python Sphinx 文档,并且希望文档中的链接看起来像在当前类中实现的 func:func:
角色(即,以相同的样式并且简单地 as而不是 as .__enter__
__enter__
object.__enter__
有没有办法做到这一点?
我正在尝试参考
http://docs.python.org/2.7/reference/datamodel.html#object.__enter__
来自我的 python Sphinx 文档,并且希望文档中的链接看起来像在当前类中实现的 func:func:
角色(即,以相同的样式并且简单地 as而不是 as .__enter__
__enter__
object.__enter__
有没有办法做到这一点?
如果您已设置intersphinx,则以下标记将生成指向 Python 文档中指定目标的超链接,其中包含链接文本__enter__
:
:meth:`__enter__ <object.__enter__>`
替代:
:meth:`~.object.__enter__`
这将产生链接文本__enter__()
(默认情况下带有括号;请参阅http://sphinx-doc.org/config.html#confval-add_function_parentheses)。
或者只是使用这个:
`__enter__ <http://docs.python.org/2.7/reference/datamodel.html#object.__enter__>`_
请参阅http://sphinx-doc.org/markup/inline.html#cross-referencing-syntax和http://sphinx-doc.org/rest.html#hyperlinks。