我正在尝试将我们项目的扩展文档链接到 Sphinx 中的核心文档。我试过 intersphinx,但从我看来它只支持对象,而我们的文档不涉及对象,它只是普通的 .rst。
我已经添加
intersphinx_mapping = {
'project': ('http://link-to-readthedocs/index.html', None),
}
到 conf.py 并编辑链接到 :ref:`Documentation` 和更高版本的 :doc:`Documentation`。它没有用。
问题:
如何从一个项目的文档链接到 Sphinx 中的另一个以获取纯 .rst 文件(不是对象)?
编辑 :我已经完成了'make html',找到了我的objects.inv,但现在我想我只有本地有它???我不知道我在做什么了,但是当我尝试检查 object references 时,我得到:
UserWarning: intersphinx inventory 'http://myproject.com/index.html/objects.inv' not fetchable due to <class 'urllib.error.HTTPError'>: HTTP Error 404: Not Found
'%s: %s' % (inv, err.__class__, err))
请您参考如下方法:
此处要修复的第一件事是您在项目文档的基本 URL 中包含的链接:
intersphinx_mapping = { 'project': ('http://link-to-readthedocs/index.html', None), }
根据
intersphinx
docs :
A dictionary mapping unique identifiers to a tuple
(target, inventory)
. Eachtarget
is the base URI of a foreign Sphinx documentation set and can be a local path or an HTTP URI. Theinventory
indicates where the inventory file can be found: it can beNone
(at the same location as the base URI) or another local or HTTP URI.
因此,错误在于
index.html
在您的
target
的末尾.它应该看起来像这样:
intersphinx_mapping = { 'project': ('http://project.readthedocs.io/en/latest', None), }
如果需要,替换
en
使用首选文档语言,以及
latest
使用文档的首选 RtD 构建版本。