【问题标题】:How to create link to local index.html from Sphinx documentation?如何从 Sphinx 文档创建指向本地 index.html 的链接?
【发布时间】:2016-07-09 11:46:33
【问题描述】:

我正在为 Sphinx/rst 编写一些文档。如何链接到与您正在查看的页面相关的本地磁盘上的内容?

例如:

====================
My App documentation
====================

The official My App documentation can be found here:
https://myapp.com/docs

A local mirror is available:
../../_static/docs_mirror/index.html

在我的机器上,_static 文件夹位于:

file:///Users/fredrik/code/repos/myapp/docs/_static

...但我不想对该路径进行硬编码,因为该路径可能与另一个已下载克隆存储库的用户的路径不同。

【问题讨论】:

  • @mzjn 是的,非常好,效果很好:`local mirror <_static/docs_mirror/index.html>`_。如果您在此处添加答案,我会将其标记为正确答案。

标签: python-sphinx restructuredtext


【解决方案1】:

这是一种方法:

`local mirror <_static/docs_mirror/index.html>`_

另一种选择:

`local mirror`_

.. _local mirror: _static/docs_mirror/index.html

参考:http://docutils.sourceforge.net/docs/ref/rst/restructuredtext.html#hyperlink-references

【讨论】:

  • 这仅在您在文档根目录中使用此链接时才有效。在其他地方,local mirror 将插入当前 URL 分支的末尾并解析为无效页面。
猜你喜欢
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2011-05-22
  • 1970-01-01
  • 2018-09-20
  • 2012-03-28
相关资源
最近更新 更多