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

相关文章

功能概要:(目前已实现功能)公共展示部分:1.网站首页展示...
大体上把Python中的数据类型分为如下几类: Number(数字) ...
开发之前第一步,就是构造整个的项目结构。这就好比作一幅画...
源码编译方式安装Apache首先下载Apache源码压缩包,地址为ht...
前面说完了此项目的创建及数据模型设计的过程。如果未看过,...
python中常用的写爬虫的库有urllib2、requests,对于大多数比...