使用sphinx来创建文档

本文介绍如何使用Sphinx生成文档,包括安装步骤、项目创建流程及文件编辑方法,并对比tag2txt工具,适用于API和接口文档编写。

tag2txt 只生成单个html文档,比较合适写一些api或接口的文档,如果做大项目文档还是想使用sphinx

 

安装(需要安装python和easy_install)

easy_install sphinx

生成一个项目(按向导进行)

sphinx-quickstart

生成的文件&目录

-rw-r--r--  1 bluefrog bluefrog 7670 2012-05-28 16:32 conf.py
-rw-r--r--  1 bluefrog bluefrog  417 2012-05-28 16:32 index.rst
-rw-r--r--  1 bluefrog bluefrog 5092 2012-05-28 16:32 make.bat
-rw-r--r--  1 bluefrog bluefrog 5556 2012-05-28 16:32 Makefile
drwxr-xr-x  2 bluefrog bluefrog 4096 2012-05-28 16:32 _static/
drwxr-xr-x  2 bluefrog bluefrog 4096 2012-05-28 16:32 _templates/

编辑index.rst文件

.. test documentation master file, created by
   sphinx-quickstart on Mon May 28 16:32:00 2012.
   You can adapt this file completely to your liking, but it should at least
   contain the root `toctree` directive.

Welcome to test's documentation!
================================

Contents:

.. toctree::
   :maxdepth: 2



Indices and tables
==================

* :ref:`genindex`
* :ref:`modindex`
* :ref:`search`

编译文档

mkdir doc
sphinx-build . doc

 

改天有空可以写一个简单的语法教程

注:python的文档就是使用sphinx来生成的

 

公司大牛有用php写了一个doczen http://www.ec-os.net/doczen.html 个人还是使用sphinx吧

使用 doczen 生成的示例:

http://wiki.zx.shopex.cn/

http://ec-os.net/doc.html

http://doc.ec-ae.com/

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值