Sphinx:链接到嵌入式二进制文件 (PDF)
Sphinx: Linking to Embedded Binary Files (PDFs)
我正在使用 sphinx 和 RST 生成一些技术文档 HTML,但在获取本地 PDF 时遇到问题参考作为 hyperlink 工作。我见过人们使用 :download:
到 link 到本地 PDF,但我将 PDF 嵌入到 /docs
目录中以供参考。我不喜欢 :download:
,因为它不会在浏览器中内联显示 PDF,这需要代表用户执行额外的步骤才能使用。
sphinx-build -b html
不会复制任何文件,除非它们在 config.py
挂钩 html_static_path
或 html_extra_path
中指定 - 即使这样它们也会被删除到 root
目录或 _static
个文件夹。
是否有在 sphinx 中嵌入 linked 二进制文件的建议方法,或者这是一种糟糕的做法?通常 link 会使用未在其他任何地方托管的幻灯片或设计图。
linked PDF 的 RST 示例
.. important:: View the agile course on scrum basics
- View `these slides to dive deeper into Agile Basics <docs/agile-101.pdf>`_.
我想出的解决方案是将 PDF 添加到 html_static_path
并在 link 中引用 _static
输出路径而不是 docs
路径它存在于源头。现在 PDF 可以在浏览器中打开,而不必下载它们进行查看。
如果有一个 sphinx 扩展/指令来处理这个问题就好了 (:download-inline:
)。
conf.py
html_static_path = ['_static', 'agile-101/docs']
敏捷-101.rst
.. important:: View the agile course on scrum basics
- View `these slides to dive deeper into Agile Basics <../_static/agile-101.pdf>`_.
我正在使用 sphinx 和 RST 生成一些技术文档 HTML,但在获取本地 PDF 时遇到问题参考作为 hyperlink 工作。我见过人们使用 :download:
到 link 到本地 PDF,但我将 PDF 嵌入到 /docs
目录中以供参考。我不喜欢 :download:
,因为它不会在浏览器中内联显示 PDF,这需要代表用户执行额外的步骤才能使用。
sphinx-build -b html
不会复制任何文件,除非它们在 config.py
挂钩 html_static_path
或 html_extra_path
中指定 - 即使这样它们也会被删除到 root
目录或 _static
个文件夹。
是否有在 sphinx 中嵌入 linked 二进制文件的建议方法,或者这是一种糟糕的做法?通常 link 会使用未在其他任何地方托管的幻灯片或设计图。
linked PDF 的 RST 示例
.. important:: View the agile course on scrum basics
- View `these slides to dive deeper into Agile Basics <docs/agile-101.pdf>`_.
我想出的解决方案是将 PDF 添加到 html_static_path
并在 link 中引用 _static
输出路径而不是 docs
路径它存在于源头。现在 PDF 可以在浏览器中打开,而不必下载它们进行查看。
如果有一个 sphinx 扩展/指令来处理这个问题就好了 (:download-inline:
)。
conf.py
html_static_path = ['_static', 'agile-101/docs']
敏捷-101.rst
.. important:: View the agile course on scrum basics
- View `these slides to dive deeper into Agile Basics <../_static/agile-101.pdf>`_.