sphinx使用及其简单配置方法

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即可。目前官方提供的主题见http://sphinx.pocoo.org/theming.html#builtin-themes

3)其它

还其它更多设置,具体请参考官方文档

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

扩展阅读:

(0)

相关推荐

  • Python生成pdf文件的方法

    本文实例演示了Python生成pdf文件的方法,是比较实用的功能,主要包含2个文件.具体实现方法如下: pdf.py文件如下: #!/usr/bin/python from reportlab.pdfgen import canvas def hello(): c = canvas.Canvas("helloworld.pdf") c.drawString(100,100,"Hello,World") c.showPage() c.save() hello() di

  • Sphinx/MySQL 协议支持与SphinxQL应用实例

    Sphinx的searchd守护程序从版本0.9.9-rc2开始支持MySQL二进制网络协议,并且能够通过标准的MySQL API访问.例如,"mysql"命令行程序可以很好地工作. 以下是用MySQL客户端对Sphinx进行查询的例子: 复制代码 代码如下: $ mysql -P 9306Welcome to the MySQL monitor.  Commands end with ; or \g.Your MySQL connection id is 1Server versio

  • Python实现批量把SVG格式转成png、pdf格式的代码分享

    需要提前安装cairosvg模块,下载地址http://cairosvg.org/download/ Code: #! encoding:UTF-8 import cairosvg import os   loop = True while loop:     svgDir = raw_input("请输入SVG文件目录")     if os.path.exists(svgDir) and os.path.isdir(svgDir):         loop = False    

  • 使用rst2pdf实现将sphinx生成PDF

    当初项目文档是用sphinx写的,一套rst下来make html得到一整个漂亮的在线文档.现在想要将文档导出为离线的handbook pdf,于是找到了rst2pdf这个项目,作为sphinx的拓展,然后加上少量配置即可输出中文PDF. rst2pdf 简介 rst2pdf是一个将 reStructuredText 转换为 PDF 的工具,具有下列特性: 自定义页面布局 支持层叠样式表 支持内嵌TTF和Type1字体 支持几乎所有语言的语法高亮 使用reStructuredText作为源文件

  • python将html转成PDF的实现代码(包含中文)

    前提: 安装xhtml2pdf https://pypi.python.org/pypi/xhtml2pdf/下载字体:微软雅黑:给个地址:http://www.jb51.net/fonts/8481.html 待转换的文件:1.htm 复制代码 代码如下: <meta charset="utf8"/><style type='text/css'>@font-face {         font-family: "code2000";   

  • 深入解析php之sphinx

    <?php //参数筛选 //筛选cat_id=2$cl->SetFilter("cat_id",array(2));//仅在id为1.3.7的子论坛中搜索$cl->SetFilter("forum_id",array(1,3,7)); //范围筛选//筛选发布时间为今天,参数为int时间戳$cl->SetFilterRange("starttime",123,124);//筛选价格$cl->SetFilterRan

  • php启用sphinx全文搜索的实现方法

    本文实例讲述了php启用sphinx全文搜索的实现方法.分享给大家供大家参考.具体分析如下: 在编译安装 sphinx 的时候出现很多中文乱码,最后抛出错误卡住了,我去到官方直接下载一个 rpm 包,安装就很爽,具体错误不想研究了,忙开发呢. 安装两个包,一个是 mmseg 这个是生成中文字典的程序,一个是  csft 也就是中国版的sphinx . rpm -ivh 安装完以后,很顺利~~不到半分钟就装完了. 中文字典库,我直接去 csft 官方下载了,挺好的想得很周到. unigram.tx

  • python使用reportlab实现图片转换成pdf的方法

    本文实例讲述了python使用reportlab实现图片转换成pdf的方法.分享给大家供大家参考.具体实现方法如下: #!/usr/bin/env python import os import sys from reportlab.lib.pagesizes import A4, landscape from reportlab.pdfgen import canvas f = sys.argv[1] filename = ''.join(f.split('/')[-1:])[:-4] f_j

  • sphinx使用及其简单配置方法

    sphinx使用 进入你要创建文档的目录,例如要创建在目录/home/wwwroot/doc下 cd /home/wwwroot/doc 开始使用向导创建你的文档项目 sphinx-quickstart 程序会提示输入一些选项,如输入根目录,大部分使用默认选项,直接按回车即可. 复制代码 代码如下: Enter the root path for documentation. > Root path for the documentation [.]: //输入跟目录,直接回车 You have

  • Nginx负载均衡配置简单配置方法

    背景 当一个网站从小到大,访问量逐渐增大现有的服务器已经支撑不住,一般的解决方案就是缓存.加服务器.数据库读写分离.实行负载均衡分布式等等,本人对这些技术方案都没有在项目中具体的实践过, 但是一直听同事过说起,利用空闲时间自我学习了解下: 负载均衡 什么是负载均衡,就是当快要承受不住的时候,又给你一台服务器来分担压力,请求会分配到两台服务器上,两台服务器上部署相同的内容相当于一个分身,可以处理相同的事情: Nginx作为负载均衡服务器,用户请求先到达nginx,再由nginx根据负载配置将请求转

  • spring boot配置MySQL数据库连接、Hikari连接池和Mybatis的简单配置方法

    此方法为极简配置,支持MySQL数据库多库连接.支持Hikari连接池.支持MyBatis(包括Dao类和xml文件位置的配置). 1.pom.xml中引入依赖: <!-- Begin of DB related --> <dependency> <groupId>org.mybatis.spring.boot</groupId> <artifactId>mybatis-spring-boot-starter</artifactId>

  • webpack+vue+express(hot)热启动调试简单配置方法

    前言 最近搞vue+webpack,vue的api还是比较容易懂的,每次build很复杂,这里就介绍下热启动调试吧,心累~~~ ITDogFire –sky 工具及目录 所用的到的简单工具 webstorm +vue +webpack +express,小项目都是官方down下来的. 目录介绍如下 package { "name": "yx", "version": "1.0.0", "description&quo

  • php错误日志简单配置方法

    本文实例讲述了php配置错误日志的方法.分享给大家供大家参考,具体如下: php.ini: ; 错误日志 log_errors = On ; 显示错误 display_errors = Off ; 日志路径 error_log = "/usr/local/lnmp/php/var/log/error_log" ; 错误等级 error_reporting = E_ALL&~E_NOTICE php-fpm.conf: [global] ; php-fpm pid文件 pid =

  • 用cwrsync同步windows下数据的简单配置方法

    cwrsync下载地址 http://sourceforge.net/projects/sereds/files/cwRsync 或者到 s.jb51.net下载 cwrsync分客户端和服务端两部分,拿cwrsync 4.0.版来说,分别对应cwRsync_4.0.5_Installer.zip和cwRsyncServer_4.0.5_Installer.zip 安装: 客户端安装比较简单,一直下一步就可以了. 服务端安装到Service Account这一步的时候,这一步会建立cwrsync

  • 四个系列低端路由器简单配置方法

    一 CISCO2500系列: 首先启动PC机的超级终端,通过console口登录到路由器上. 步骤1.修改路由器广域网端口. 1.conf t 2.int s0(进入相应的端口) 3.ip addr 202.102.47.6 255.255.255.252(将IP地址修改成新分配的IP广域口地址) 4.no shutdown 步骤2.修改局域网端口 1.conf t 2.int e0(进入相应的端口) 3.ip addr 202.102.8.226 255.255.255.248(将IP地址修改

  • ckeditor 简单配置方法

    下载ckeidtor,解压至WebRoot目录下 在要使用ckeditor的页面引入ckeidtor.js 假设<textarea/>的name属性为content,则在其后添加JavaScript代码如下: 复制代码 代码如下: <script type="text/javascript"> if (typeof CKEDITOR == 'undefined') { document.write('加载CKEditor失败'); } else { var ed

  • nginx 负载均衡的简单配置方法

    复制代码 代码如下: http      {        upstream www.test2.com {                  server 10.1.165.36:80  weight = 3;                  server 10.249.198.235;               server 10.1.168.1  down;                server 10.1.168.2  backup;              #ip_hash;

  • mysql 5.7.20常用下载、安装和配置方法及简单操作技巧(解压版免安装)

    话说凌晨刚折腾完一台MySQL 5.7.19版本的安装,未曾料到早上MySQL官方就发布了最新的5.7.20版本.这个版本看似更新不多,但是加入了一个我们所急需的功能. MySQL 5.7.20版本新增了参数group-replication-member-weight,用来表示选主时服务器的优先级.若没有这个优先级,则之前版本的MGR会选择一个或许不是用户想要的节点,这是一个令人头疼的问题.相信5.7.20版本新增的该参数能解决一些用户的痛点. 1. 下载: mysql-5.7.20是解压版免

随机推荐