前言:

使用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. 【Java程序】约瑟夫环

    今天看视频教程无意间看到了一个数3减1的问题,百度之发现叫约瑟夫环问题,于是写了程序,问题大致描述如下: 一群带有编号的孩子手拉手围成一个圈报数,开始的孩子数1,他右边数2,再右边数3,数到n的孩子o ...

  2. double中首字母大写与小写的区别

    Double 是类 double是基础数据类型.Double类型是double的包装类.Double 和double之间的相互转化称为自动拆箱和自动装箱.如果从对象角度理解,那么Double就是对象, ...

  3. 升级ceph

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

  4. 【HDU6602】Longest Subarray【线段树+分治】

    题目大意:给出一串序列,询问最长的合法子串为多长,其中合法子串必须满足子串中[1,C]的数量大于等于K或者为0 题解: 定义右端点为包含某一点所需要的最小区间的右端点 那么初始化时就可以O(n)求出每 ...

  5. 后端优化(2)—— BA与图优化

  6. MySql中4种批量更新的方法update table2,table1,批量更新用insert into ...on duplicate key update, 慎用replace into.

    mysql 批量更新记录 MySql中4种批量更新的方法最近在完成MySql项目集成的情况下,需要增加批量更新的功能,根据网上的资料整理了一下,很好用,都测试过,可以直接使用. mysql 批量更新共 ...

  7. 90、Tensorflow实现分布式学习,多台电脑,多个GPU 异步试学习

    ''' Created on 2017年5月28日 @author: weizhen ''' import time import tensorflow as tf from tensorflow.e ...

  8. PHP错误检测

    开发的时候,我们有时候需要打开错误信息.这时候,可以在php文件里设置:ini_set('display_errors','on');error_reporting(E_ALL); 不过有时候我们及时 ...

  9. ML&MLDS笔记:偏差 vs 方差

    原文地址:https://www.jianshu.com/p/a02c6bd5d5e9 error来自哪?来自于偏差Bias和方差Variance. 就如打靶时瞄准一个点\(\overline{f}\ ...

  10. POJ3641 Pseudoprime numbers (幂取模板子)

    给你两个数字p,a.如果p是素数,并且ap mod p = a,输出“yes”,否则输出“no”. 很简单的板子题.核心算法是幂取模(算法详见<算法竞赛入门经典>315页). 幂取模板子: ...