当前位置: 移动技术网 > 网络运营>服务器>Linux > sphinx使用及其简单配置方法

sphinx使用及其简单配置方法

2019年05月06日  | 移动技术网网络运营  | 我要评论
sphinx使用
进入你要创建文档的目录,例如要创建在目录/home/wwwroot/doc下
cd /home/wwwroot/doc
开始使用向导创建你的文档项目
sphinx-quickstart
程序会提示输入一些选项,如输入根目录,大部分使用默认选项,直接按回车即可。
复制代码 代码如下:

enter the root path for documentation.
> root path for the documentation [.]:
//输入跟目录,直接回车
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]:
//是否分离source和build目录,建议选y,方便管理
inside the root directory, two more directories will be created; "_templates"
for custom html templates and "_static" for custom stylesheets and other static
files. you can enter another prefix (such as ".") to replace the underscore.
> name prefix for templates and static dir [_]:
//直接回车
the project name will occur in several places in the built documentation.
> project name: f2e cookbook
> author name(s): imbingdian
//输入项目名称
//输入作者名称
the file name suffix for source files. commonly, this is either ".txt"
or ".rst". only files with this suffix are considered documents.
> source file suffix [.rst]: .txt
//档文件的扩展名,默认是.rst
//后面的操作基本回车就好

完成后可以看到doc文件中生了以下目录文件
build--生成文档目录
source--源文件目录
make.bat
makefile
生成html文档
make html
看一下build目录下是不是生成了html文档了?
^_^ enjoy it!
查看demo:http://doc.litejs.com/
sphinx简单配置
source目录下的conf.py文件为sphinx的配置文件。
1)修改文档语言为中文:
找到#language = none,修改为:language ='zh_cn',其它语言见下表
复制代码 代码如下:

bn – bengali
ca – catalan
cs – czech
da – danish
de – german
en – english
es – spanish
fi – finnish
fr – french
hr – croatian
it – italian
ja – japanese
lt – lithuanian
nl – dutch
pl – polish
pt_br – brazilian portuguese
ru – russian
sl – slovenian
tr – turkish
uk_ua – ukrainian
zh_cn – simplified chinese
zh_tw – traditional chinese

2)设置主题

找到html_theme = 'default',修改default即可。目前官方提供的主题见

3)其它

还其它更多设置,具体请参考。

设置好以后,重新make html即可。

扩展阅读:


如对本文有疑问, 点击进行留言回复!!

相关文章:

验证码:
移动技术网