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 thedocsfolder looks like: -
docs ├── Makefile ├── build ├── make.bat └── source ├── _static ├── _templates ├── conf.py └── index.rst
- After running
- sphinx-apidoc generates reStructuredText files to document from all found modules.
- After running sphinx-apidoc -f -o source/ ../trees/ the layout of the
docsfolder 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
- After running sphinx-apidoc -f -o source/ ../trees/ the layout of the
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

最低0.47元/天 解锁文章
492

被折叠的 条评论
为什么被折叠?



