加入收藏 | 设为首页 | 会员中心 | 我要投稿 李大同 (https://www.lidatong.com.cn/)- 科技、建站、经验、云计算、5G、大数据,站长网!
当前位置: 首页 > 编程开发 > Python > 正文

python – 使用readthedocs.org使用的静态资源进行本地sphinx构

发布时间:2020-12-20 13:43:36 所属栏目:Python 来源:网络整理
导读:目前,我能找到获取readthedocs.org使用的当前设计资产的唯一方法是安装 full theme并构建它,这需要SASS等. 我想获得一组静态文件,让我在本地看到我的构建在readthedocs上的样子.有没有办法在没有从上面的链接建立资产的情况下做到这一点?目标是让新手很容易
目前,我能找到获取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

(编辑:李大同)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

    推荐文章
      热点阅读