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/ ...
随机推荐
- 【转载】将本地图片转成base64
<!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8&quo ...
- vue img标签用法
:符号是v-bind的缩写 服务器图片路径和请求本地路径 <img class="v-step-0" id="avatar" :src="myP ...
- oracle trim无效?
这里说说如果是全角空格怎么去除 方法一 trim(TO_SINGLE_BYTE('aaa')) 方法二 SELECT TRIM(replace('aaa',' ','')) FROM dual
- PHP上传文件和下载
PHP 中文件上传的基础知识: 1)客户端 form 表单设置 必须设置的 form 表单项: <!DOCTYPE html> <html> <head> < ...
- mysql查询表的创建时间
mysql查询表的创建时间 查询语句: SELECT table_name,create_time FROM information_schema.TABLES;
- kvm搭建
今日做公司项目时恰好是这个,然后就做一个博客,希望可以帮助到你们 1.把虚拟机zmedu63内存调成6G以上,因为我们要在VMware虚拟中安装KVM,然后在KVM中再安装虚拟机,需要内存大一些.zm ...
- Android Studio 打包生成正式apk(XXX-release.apk)的两种方式
{ 方式一:使用Android Studio生成1.点击Build->Generate Signed apk,首次点击可能会提示输入操作系统密码2.弹出如下对话框,还没有生成过keystore ...
- 【纪中集训】2019.08.01【NOIP提高组】模拟 A 组TJ
T1 Description 给定一个\(N*N(N≤8)\)的矩阵,每一格有一个0~5的颜色.每次可将左上角的格子所在连通块变为一种颜色,求最少操作数. Solution IDA*=启发式迭代加深 ...
- [CSP-S模拟测试62]题解
A.Graph 因为点可以随便走,所以对于每个联通块,答案为边数/2向下取整. 用类似Tarjan的方式,对于每个联通块建立一棵搜索树,尽量让每一个节点的儿子两两配对,如果做不到就用上头顶的天线. # ...
- js判断是否pc端
function IsPC() { var userAgentInfo = navigator.userAgent; var Agents = ['Android', 'iPhone', 'Symbi ...