前言:

使用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. Linux里lftp总结

    lftp的功能比较强大,相比原来用ftp,方便了很多. 1.登陆: lftp ftp://yourname@site pwd:***** 或 open ftp://yourname@site 基本操作 ...

  2. Vue路由组件vue-router

    一.路由介绍 Creating a Single-page Application with Vue + Vue Router is dead simple. With Vue.js, we are ...

  3. postgres服务相关语法

    远程登陆 psql -h 主机 -U 用户 -p端口 -W -d 数据库 #-W表示密码,例如:psql -h 192.168.137.3 -U postgres -p 5432 -W -d post ...

  4. Python--前端基础之JavaScript(JS的引入方式,JS的变量、常量和标识符,JS的数据类型,运算符,流程控制,JavaScript的对象)

    JavaScript介绍 JavaScript是运行在浏览器端的脚步语言,JavaScript主要解决的是前端与用户交互的问题,包括使用交互与数据交互. JavaScript是浏览器解释执行的,前端脚 ...

  5. Mybatis基于XML配置SQL映射器(一)

    Durid和Mybatis开发环境搭建 SpringBoot搭建基于Spring+SpringMvc+Mybatis的REST服务(http://www.cnblogs.com/nbfujx/p/76 ...

  6. 容器————priority_queue

    #include <queue> 与queue不同的是可以自定义其中数据的优先级,让优先级高的先出队列. 优先队列具有队列的所有特性,包括基本操作,只是在这基础上添加了内部的一个排序,它本 ...

  7. 微信小程序学习笔记(三)--框架-逻辑层

    逻辑层将数据进行处理后发送给视图层,同时接受视图层的事件反馈. 开发者写的所有代码最终将会打包成一份 JavaScript 文件,并在小程序启动的时候运行,直到小程序销毁.这一行为类似 Service ...

  8. 【缓存与性能优化】方法论:如何优化一个Web系统的性能

    1.性能简介 一个网络请求的等待: 减少等待时间方式 不同位置对性能的操控 开发人员优化性能的方式 性能指标 2.缓存 缓存是把一些需要计算或者访问数据库的数据,放到内存中,当客户端访问时,直接从内存 ...

  9. java Wrapper包装类

    什么是包装类?为什么需要包装类? 这是大家要了解的 对于java中的基本数据类型我们如果想要把当当做类来使用怎么办呢? 如果想要对这些基本数据类型直接调用一些方法来操作的话 怎么做呢? 由以上就产生了 ...

  10. Nginx网络架构实战学习笔记(一):Nginx简介、安装、信号控制、nginx虚拟主机配置、日志管理、location 语法、Rewrite语法详解

    文章目录 nginx简介 nginx安装 nginx信号控制 nginx虚拟主机配置 日志管理 location 语法 精准匹配的一般匹配 正则匹配 总结 Rewrite语法详解 nginx简介 Ng ...