Sphinx: Link 到外部 PPT 文档?
Sphinx: Link to External PPT Document?
我知道我可以将 link 添加到文档或外部网站的其他部分 link (https://sublime-and-sphinx-guide.readthedocs.io/en/latest/references.html)。但是有没有可能link到powerpoint PPT文件之类的外部文档呢?
如果用户能够点击 link 到 PPT 文件并自动下载和打开文件,那么在 web 文档或 PDF 中会很方便。
感谢您的见解!
我的适用于 PDF 和 HTML 的(低级)解决方案是将我所有的 PPT 文档放在 _static/
目录中,配置 html_static_path
变量,然后链接到所需的文件,像这样:
- 目录结构
repo-top/
conf.py
_static/
myDocument.pptx
- conf.py
html_static_path = ['_static']
- 您的 RST 文件
`Display Text <_static/myDocument.pptx>`_.
关于 html_static_path
的文档
https://www.sphinx-doc.org/en/master/usage/configuration.html#confval-html_static_path
这似乎也是这里的方法:
- 我还必须使用
sed
手动将所有绝对 file:/// URL 替换为相对 URL。然后您必须将 PDF 与 _static
目录一起发送。这是在 Mac
export LC_CTYPE=C
export LANG=C
sed -i '' 's/file:\/\/\/Users\/username\/Desktop\/project/./g' ./_build/filename.pdf
cp -r _static/* ./_build/_static
我知道我可以将 link 添加到文档或外部网站的其他部分 link (https://sublime-and-sphinx-guide.readthedocs.io/en/latest/references.html)。但是有没有可能link到powerpoint PPT文件之类的外部文档呢?
如果用户能够点击 link 到 PPT 文件并自动下载和打开文件,那么在 web 文档或 PDF 中会很方便。
感谢您的见解!
我的适用于 PDF 和 HTML 的(低级)解决方案是将我所有的 PPT 文档放在 _static/
目录中,配置 html_static_path
变量,然后链接到所需的文件,像这样:
- 目录结构
repo-top/
conf.py
_static/
myDocument.pptx
- conf.py
html_static_path = ['_static']
- 您的 RST 文件
`Display Text <_static/myDocument.pptx>`_.
关于 html_static_path
的文档
https://www.sphinx-doc.org/en/master/usage/configuration.html#confval-html_static_path
这似乎也是这里的方法:
- 我还必须使用
sed
手动将所有绝对 file:/// URL 替换为相对 URL。然后您必须将 PDF 与_static
目录一起发送。这是在 Mac
export LC_CTYPE=C
export LANG=C
sed -i '' 's/file:\/\/\/Users\/username\/Desktop\/project/./g' ./_build/filename.pdf
cp -r _static/* ./_build/_static