如何在标准库文档中将intersphinx链接放置到任意方法?

问题描述

| 我正在尝试使用Sphinx来记录项目,但是我不知道如何使用 狮身人面像。我用这行:
:py:meth:`math.sin`
添加链接,但是在输出中,它显示为粗体,而不是链接。 尽管该行不起作用,但以下两项都可以:
:py:meth:`dict.items`
:py:class:`zipfile.ZipFile`
我在conf.py文件中的intersphinx_mapping值是:
intersphinx_mapping = {\'python\':(\'http://docs.python.org/2.7\',None)}
    

解决方法

您是否阅读过Intersphinx的文档? 编辑 使用它可以工作:
***
TRY
***

My try
======

sin
:py:func:`math.cos`

pop
:py:meth:`dict.pop`

dict
:py:meth:`dict.items`

zipfile
:py:class:`zipfile.ZipFile`
阅读有关交叉引用的结构     ,
:py:meth:
应为
:py:func:
。基本上, 可以使用任何有效域。