Sphinx sphinx-quickstart sphinx-apidoc auto generate API documents

How to use Sphinx?

Sphinx uses reStructuredText as its markup language. 

The process of Sphinx generating documents is like this:

Project source code (Python or other supported languages)->reStructuredText files ->documents (HTML or other supported format)

Sphinx provides two command-line tools: sphinx-quickstart and sphinx-apidoc.

  • sphinx-quickstart sets up a source directory and creates a default configuration, conf.py, and a master document, index.rst, which serves as a welcome page of a document.
    • After running sphinx-quickstart, the layout of the docs folder looks like:
    • docs
      ├── Makefile
      ├── build
      ├── make.bat
      └── source
          ├── _static
          ├── _templates
          ├── conf.py
          └── index.rst
  • sphinx-apidoc generates reStructuredText files to document from all found modules.
    • After running sphinx-apidoc -f -o source/ ../trees/ the layout of the docs folder looks like:
      • modules.rst and trees.rst and so on being added to source folder.
    • docs
      ├── Makefile
      ├── build
      │   └── doctrees
      │       ├── environment.pickle
      │       └── index.doctree
      ├── make.bat
      └── source
          ├── _static
          ├── _templates
          ├── conf.py
          ├── index.rst
          ├── modules.rst
          ├── trees.bin.rst
          ├── trees.binary_trees.rst
          └── trees.rst

In short, we use these two tools to generate Sphinx source code, i.e., reStructuredText files,

and we modify these reStructuredText files,

and finally use Sphinx to build excellent documents. 

Workflow

 The same as software needs a developer’s maintenance, writing a software document is not a one-time job.

It needs to be updated when the software changes.

The picture below demonstrates the basic Sphinx workflow.

The following sections detail each step of the workflow.

Prepare 

Before we start using Sphinx, we need to set up our working environment.

  • u
评论
成就一亿技术人!
拼手气红包6.0元
还能输入1000个字符
 
红包 添加红包
表情包 插入表情
 条评论被折叠 查看
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值