sphinx使用及其简单配置方法
时间:2022-07-07 09:51:08|栏目:Linux|点击: 次
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 ?C Bengali
ca ?C Catalan
cs ?C Czech
da ?C Danish
de ?C German
en ?C English
es ?C Spanish
fi ?C Finnish
fr ?C French
hr ?C Croatian
it ?C Italian
ja ?C Japanese
lt ?C Lithuanian
nl ?C Dutch
pl ?C Polish
pt_BR ?C Brazilian Portuguese
ru ?C Russian
sl ?C Slovenian
tr ?C Turkish
uk_UA ?C Ukrainian
zh_CN ?C Simplified Chinese
zh_TW ?C Traditional Chinese
进入你要创建文档的目录,例如要创建在目录/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 ?C Bengali
ca ?C Catalan
cs ?C Czech
da ?C Danish
de ?C German
en ?C English
es ?C Spanish
fi ?C Finnish
fr ?C French
hr ?C Croatian
it ?C Italian
ja ?C Japanese
lt ?C Lithuanian
nl ?C Dutch
pl ?C Polish
pt_BR ?C Brazilian Portuguese
ru ?C Russian
sl ?C Slovenian
tr ?C Turkish
uk_UA ?C Ukrainian
zh_CN ?C Simplified Chinese
zh_TW ?C Traditional Chinese
2)设置主题
找到html_theme = 'default',修改default即可。目前官方提供的主题见http://sphinx.pocoo.org/theming.html#builtin-themes
3)其它
还其它更多设置,具体请参考官方文档。
设置好以后,重新make html即可。
扩展阅读:
上一篇:ubuntu开机自启动服务设置
栏 目:Linux
下一篇:没有了
本文标题:sphinx使用及其简单配置方法
本文地址:http://www.codeinn.net/misctech/207120.html