Custom role to link PDF file as static content

喜你入骨 提交于 2021-01-29 10:51:19

问题


I am trying to write a custom role for Sphinx to allow linking to PDF files that are then displayed in the browser (rather than being downloaded when using the :download: role).

I have got as far as a role that creates a link to the PDF file:

:pdf:`Document Title <pdf/document.pdf>`

generates something like:

<a href="pdf/document.pdf>Document Title</a>

However, I don't know how to get Sphinx to copy the pdf directory to the output directory. Is this possible?


回答1:


Use html_static_path in your conf.py.

html_static_path = ['_static', 'pdf']


来源:https://stackoverflow.com/questions/64215666/custom-role-to-link-pdf-file-as-static-content

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!