Sphinx + Read the docs theme
前言:
使用Sphinx 生成文档和使用 Read The Docs 的 readthedocs/sphinx_rtd_theme,假设是在Windows上运行并已安装好 python,可以执行python的 pip命令
- 通过 pip命令安装 sphinx 和 sphinx_rtd_theme
pip install -U Sphinx
pip install sphinx-rtd-theme
- 在一个系统中的一个空的文件夹中运行: 如我在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格式的文档
- 在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的说明
- 生成 html 格式的文档
命令行 进入 Sphinx 项目,运行
make html
or
make.bat html
如果需要发布到 RTD官网
- 编译失败,如在编译时遇到以下错误
Sphinx error: master file [..]/checkouts/latest/contents.rst not found
修复方法是: 修改 sphinx项目的conf.py 添加以下的一行:
master_doc = 'index'
References
- 技术文档编写利器:Sphinx+Read the Docs
- Getting Started
- Read the Docs Sphinx Theme
- Sphinx error: master file ../checkouts/latest/contents.rst not found
- Removing “Edit on …” Buttons from Documentation 隐藏RTD上的 "Edit on Github"信息
Sphinx + Read the docs theme的更多相关文章
- 文档整体解决方案(readthedocs、github 、sphinx)使用
这里是总结了一下,用的工具或者平台:readthedocs.github .sphinx. 使用这三个工具即可轻松创建高效的文档管理库,可以用来翻译,水平再高一点可以写书. readthedocs 文 ...
- Sphinx编译docs文档
在使用Python.Django的过程中,经常看到docs目录,里面存放着一些txt文本文件,也就是自带的一些帮助文档,里面有make.bat,在dos目录下直接执行make,给出的帮助是可以转换成H ...
- Sphinx Building Docs in horizon
Building Contributor Documentation This documentation is written by contributors, for contributors. ...
- 【文档】使用Sphinx + reST编写文档
0 前言 写文档是开发人员日常工作中的一项重要内容,除了word之外,我更偏爱使用标记语言(Markup Language).使用标记语言,可以利用简单.免费的文本编辑器(记事本,vim, emacs ...
- python文档生成工具:pydoc、sphinx;django如何使用sphinx?
文档生成工具: 自带的pydoc,比较差 建议使用sphinx 安装: pip install sphinx 安装主题: 由各种主题,我选择常用的sphinx_rtd_theme pip instal ...
- 【Sphinx】 为Python自动生成文档
sphinx 前言 Sphinx是一个可以用于Python的自动文档生成工具,可以自动的把docstring转换为文档,并支持多种输出格式包括html,latex,pdf等 开始 建一个存放文档的do ...
- 使用python编写量子线路打印的简单项目,并使用Sphinx自动化生成API文档
技术背景 该文章一方面从量子线路的打印着手,介绍了一个简单的python量子线路工程.同时基于这个简单的小工程,我们顺带的介绍了python的API文档自动化生成工具Sphinx的基本使用方法. 量子 ...
- coreseek+sphinx+mysql+thinkphp整合
1.安装coreseek 1.1首先升级或安装系统依赖库 yum install make gcc g++ automake libtool mysql-client libmysqlclient15 ...
- 全文检索解决方案(lucene工具类以及sphinx相关资料)
介绍两种全文检索的技术. 1. lucene+ 中文分词(IK) 关于lucene的原理,在这里可以得到很好的学习. http://www.blogjava.net/zhyiwww/archive/ ...
随机推荐
- 六、SpringBoot配置@ConfigurationProperties与@Value区别
1.@Value的使用 三种用法 // ${key} 从环境变量.配置文件中取值 @Value("${person.last-name}") private String last ...
- JavaScript仿淘宝实现放大镜效果的实例
我们都知道放大镜效果一般都是用于一些商城中的,列如每当我们打开淘宝,天猫等pc端时,看到心仪的物品时,点击图片时,便呈现出放大镜的效果.在没有去理解分析它的原理时,感觉非常的神奇,当真正地去接触,也是 ...
- MAS(转)
1.为什么要使用微服务? 要说为什么要使用微服务,我们要先说下传统的企业架构模式-垂直架构/单块架构模式,简单点说:我们一般将系统分为三层架构,但是这是逻辑上的三层,而非物理上的三层,这就意味着经过编 ...
- JavaSE---多线程---集合类
1.概述 1.1 Java提供的ArrayList.LinkedList.HashMap等都是线程不安全的类,如何解决: 1.1 使用Collections类提供的方法将 其 包装成线程安全类: ...
- 【leetcode】996. Number of Squareful Arrays
题目如下: Given an array A of non-negative integers, the array is squareful if for every pair of adjacen ...
- Java虚拟机解析篇之---垃圾回收器
上一篇说了虚拟机的内存模型,在说到堆内存的时候我们提到了,堆内存是Java内存中区域最大的一部分,而且垃圾回收器主要就是回收这部分的内容.那么这篇就来介绍一下垃圾回收器的原理以及回收的算法. Java ...
- redis常用命令-2
redis常用命令 type your_key #查看Key类型 del your_key #删除key keys * #所有key info #信息 /usr/local/bin/redis-cli ...
- iOS 109个Demo范例
https://github.com/subdigital/nsscreencast 版权声明:本文为博主原创文章,未经博主允许不得转载.
- 探索Redis设计与实现7:Redis内部数据结构详解——intset
本文转自互联网 本系列文章将整理到我在GitHub上的<Java面试指南>仓库,更多精彩内容请到我的仓库里查看 https://github.com/h2pl/Java-Tutorial ...
- webpack构建缓存机制-hash介绍
前言 浏览器为了优化体验,会有缓存机制.如果浏览器判断当前资源没有更新,就不会去服务端下载,而是直接使用本地资源.在webpack的构建中,我们通常使用给文件添加后缀值来改名以及提取公共代码到不会改变 ...