前言:

使用Sphinx 生成文档和使用 Read The Docsreadthedocs/sphinx_rtd_theme,假设是在Windows上运行并已安装好 python,可以执行python的 pip命令

  1. 通过 pip命令安装 sphinx 和 sphinx_rtd_theme
pip install -U Sphinx
pip install sphinx-rtd-theme
  1. 在一个系统中的一个空的文件夹中运行: 如我在D 盘中新建了一个名字为 sphinx的文件夹
sphinx-quickstart


D:\>mkdir sphinx-study D:\>cd sphinx-study D:\sphinx-study>sphinx-quickstart
Welcome to the Sphinx 2.2.0 quickstart utility. Please enter values for the following settings (just press Enter to
accept a default value, if one is given in brackets). Selected root path: . You have two options for placing the build directory for Sphinx output.
Either, you use a directory "_build" within the root path, or you separate
"source" and "build" directories within the root path.
> Separate source and build directories (y/n) [n]: y The project name will occur in several places in the built documentation.
> Project name: Study
> Author name(s): wakasann
> Project release []: 1.0.0 If the documents are to be written in a language other than English,
you can select a language here by its language code. Sphinx will then
translate text that it generates into that language. For a list of supported codes, see
https://www.sphinx-doc.org/en/master/usage/configuration.html#confval-language.
> Project language [en]: zh_CN Creating file .\source\conf.py.
Creating file .\source\index.rst.
Creating file .\Makefile.
Creating file .\make.bat. Finished: An initial directory structure has been created. You should now populate your master file .\source\index.rst and create other documentation
source files. Use the Makefile to build the docs, like so:
make builder
where "builder" is one of the supported builders, e.g. html, latex or linkcheck. D:\sphinx-study>

从上面的末尾的提示,可以看到,可以通过make builder来编译文档,builder是如html,latex 或者linkcheck其中的一个支持的编译器。

如命令: make html 是生成html格式的文档

  1. 在Sphinx项目中使用sphinx-rtd-theme主题,将下面的配置项加到 conf.py文件中
import sphinx_rtd_theme

extensions = [
...
"sphinx_rtd_theme",
] html_theme = "sphinx_rtd_theme"

来自 Read the Docs Sphinx Theme的README.md的说明

  1. 生成 html 格式的文档

命令行 进入 Sphinx 项目,运行

make html

or

make.bat html

如果需要发布到 RTD官网

  1. 编译失败,如在编译时遇到以下错误
Sphinx error: master file [..]/checkouts/latest/contents.rst not found

修复方法是: 修改 sphinx项目的conf.py 添加以下的一行:

master_doc = 'index'

References

  1. 技术文档编写利器:Sphinx+Read the Docs
  2. Getting Started
  3. Read the Docs Sphinx Theme
  4. Sphinx error: master file ../checkouts/latest/contents.rst not found
  5. Removing “Edit on …” Buttons from Documentation 隐藏RTD上的 "Edit on Github"信息

Sphinx + Read the docs theme的更多相关文章

  1. 文档整体解决方案(readthedocs、github 、sphinx)使用

    这里是总结了一下,用的工具或者平台:readthedocs.github .sphinx. 使用这三个工具即可轻松创建高效的文档管理库,可以用来翻译,水平再高一点可以写书. readthedocs 文 ...

  2. Sphinx编译docs文档

    在使用Python.Django的过程中,经常看到docs目录,里面存放着一些txt文本文件,也就是自带的一些帮助文档,里面有make.bat,在dos目录下直接执行make,给出的帮助是可以转换成H ...

  3. Sphinx Building Docs in horizon

    Building Contributor Documentation This documentation is written by contributors, for contributors. ...

  4. 【文档】使用Sphinx + reST编写文档

    0 前言 写文档是开发人员日常工作中的一项重要内容,除了word之外,我更偏爱使用标记语言(Markup Language).使用标记语言,可以利用简单.免费的文本编辑器(记事本,vim, emacs ...

  5. python文档生成工具:pydoc、sphinx;django如何使用sphinx?

    文档生成工具: 自带的pydoc,比较差 建议使用sphinx 安装: pip install sphinx 安装主题: 由各种主题,我选择常用的sphinx_rtd_theme pip instal ...

  6. 【Sphinx】 为Python自动生成文档

    sphinx 前言 Sphinx是一个可以用于Python的自动文档生成工具,可以自动的把docstring转换为文档,并支持多种输出格式包括html,latex,pdf等 开始 建一个存放文档的do ...

  7. 使用python编写量子线路打印的简单项目,并使用Sphinx自动化生成API文档

    技术背景 该文章一方面从量子线路的打印着手,介绍了一个简单的python量子线路工程.同时基于这个简单的小工程,我们顺带的介绍了python的API文档自动化生成工具Sphinx的基本使用方法. 量子 ...

  8. coreseek+sphinx+mysql+thinkphp整合

    1.安装coreseek 1.1首先升级或安装系统依赖库 yum install make gcc g++ automake libtool mysql-client libmysqlclient15 ...

  9. 全文检索解决方案(lucene工具类以及sphinx相关资料)

    介绍两种全文检索的技术. 1.  lucene+ 中文分词(IK) 关于lucene的原理,在这里可以得到很好的学习. http://www.blogjava.net/zhyiwww/archive/ ...

随机推荐

  1. 何时使用move

    https://zhidao.baidu.com/question/1514190267640555740.html 但编译器有copy elision优化,相当于原地构造,效率要高于move,手动指 ...

  2. 升级ceph

    参考文档 https://blog.51cto.com/jerrymin/2140258 https://www.virtualtothecore.com/en/upgrade-ceph-cluste ...

  3. JMeter 阶梯式加压测试插件 Concurrency Thread Group

    jmeter阶梯式加压测试:JMeter 阶梯式加压测试插件 Stepping Thread Group 由于Stepping Thread Group插件相对来说过于老旧,已不被官方所推荐. 所以这 ...

  4. js 常用功能实现(函数)

    1.10 个短小实用的代码片段 :https://www.jianshu.com/p/3ef822ec5a63 2.js常用函数  : https://www.cnblogs.com/wangyuyu ...

  5. docker-compose快速搭建 Prometheus+Grafana监控系统

    一.说明Prometheus负责收集数据,Grafana负责展示数据.其中采用Prometheus 中的 Exporter含:1)Node Exporter,负责收集 host 硬件和操作系统数据.它 ...

  6. sqlserver2008新建查询,表名下出现红波浪线,显示“表名无效”,但仍然可以查询得到结果(转)

    转:http://zhidao.baidu.com/link?url=82Xf_uK9VgIeYM_1kczmvKhiEQKLCqhN4_Tfe_cvriqkeP7Wggy5D60VTnMxFREwz ...

  7. EditText的常用点,输入控制(包含inputType)

    部分内容参考:http://www.cnblogs.com/hnrainll/archive/2012/11/24/2786159.html 控制EditText的输入的时候: 1)常用设置 andr ...

  8. PostgreSQL的约束

    约束类型:检查约束.非空约束.唯一约束.主键.外键 1.  检查约束 设置某个字段里的数值必须满足约束表达式的条件. 例:限制人的年龄在0~120之间,语句如下: create table perso ...

  9. HTML-参考手册: HTML 符号实体

    ylbtech-HTML-参考手册: HTML 符号实体 1.返回顶部 1. HTML 符号实体 本字符实体参考手册包括了数学符号.希腊字符.各种箭头记号.科技符号以及形状. 注释: 实体名称对大小写 ...

  10. 81、Tensorflow实现LeNet-5模型,多层卷积层,识别mnist数据集

    ''' Created on 2017年4月22日 @author: weizhen ''' import os import tensorflow as tf import numpy as np ...