【问题标题】:How can I put an intersphinx link to an arbitrary method in the standard library documentation?如何在标准库文档中将 intersphinx 链接放置到任意方法?
【发布时间】:2011-05-25 19:42:43
【问题描述】:

我正在尝试使用 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)}

【问题讨论】:

    标签: python python-sphinx cross-reference


    【解决方案1】:

    :py:meth: 应该是 :py:func:。基本上, 可以使用任何有效的domain

    【讨论】:

    • :py:func: 可以,但是要注意intersphinx必须先设置!
    【解决方案2】:

    您是否阅读过intersphinx 的文档?

    编辑

    使用它来工作:

    ***
    TRY
    ***
    
    My try
    ======
    
    sin
    :py:func:`math.cos`
    
    pop
    :py:meth:`dict.pop`
    
    dict
    :py:meth:`dict.items`
    
    zipfile
    :py:class:`zipfile.ZipFile`
    

    阅读这里的构造crossreference

    【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2023-03-13
    • 1970-01-01
    • 1970-01-01
    • 2012-08-15
    • 1970-01-01
    • 2018-07-11
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多