微信公众号搜"智元新知"关注
微信扫一扫可直接关注哦!

python – 使用readthedocs.org使用的静态资源进行本地sphinx构建的简单方法是什么?

目前,我能找到获取readthedocs.org使用的当前设计资产的唯一方法是安装 full theme并构建它,这需要SASS等.

我想获得一组静态文件,让我在本地看到我的构建在readthedocs上的样子.有没有办法在没有从上面的链接建立资产的情况下做到这一点?目标是让新手很容易为文档做出贡献.

解决方法

如果您想为其贡献/开发,您只需要构建主题.您可以使用pip install sphinx_rtd_theme安装主题.然后,您可以在Sphinx conf.py中使用该主题.见: http://read-the-docs.readthedocs.org/en/latest/theme.html

# on_rtd is whether we are on readthedocs.org
import os
on_rtd = os.environ.get('READTHEDOCS',None) == 'True'

if not on_rtd:  # only import and set the theme if we're building docs locally
    import sphinx_rtd_theme
    html_theme = 'sphinx_rtd_theme'
    html_theme_path = [sphinx_rtd_theme.get_html_theme_path()]

# otherwise,readthedocs.org uses their theme by default,so no need to specify it

版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。

相关推荐