[Dynamic Language] 用Sphinx自动生成python代码注释文档


pip install -U sphinx

mac-abeen:doc_logic abeen$ sphinx-apidoc --help
Usage: sphinx-apidoc [options] -o <output_path> <module_path> [exclude_path, ...]

Look recursively in <module_path> for Python modules and packages and create
one reST file with automodule directives per package in the <output_path>.

The <exclude_path>s can be files and/or directories that will be excluded
from generation.

Note: By default this script will not overwrite already created files.

-h, --help show this help message and exit
-o DESTDIR, --output-dir=DESTDIR
Directory to place all output
-d MAXDEPTH, --maxdepth=MAXDEPTH
Maximum depth of submodules to show in the TOC
(default: 4)
-f, --force Overwrite existing files
-l, --follow-links Follow symbolic links. Powerful when combined with
-n, --dry-run Run the script without creating files
-e, --separate Put documentation for each module on its own page
-P, --private Include "_private" modules
-T, --no-toc Don't create a table of contents file
-E, --no-headings Don't create headings for the module/package packages
(e.g. when the docstrings already contain them)
-M, --module-first Put module documentation before submodule
-s SUFFIX, --suffix=SUFFIX
file suffix (default: rst)
-F, --full Generate a full project with sphinx-quickstart
-H HEADER, --doc-project=HEADER
Project name (default: root module name)
-A AUTHOR, --doc-author=AUTHOR
Project author(s), used when --full is given
-V VERSION, --doc-version=VERSION
Project version, used when --full is given
-R RELEASE, --doc-release=RELEASE
Project release, used when --full is given, defaults
to --doc-version
--version Show version information and exit

sphinx-apidoc [options] -o outputdir packagedir [pathnames]
make html




Sphinx 标记语法示例
This is a Title
That has a paragraph about a main subject and is set when the '='
is at least the same length of the title itself.

Subject Subtitle
Subtitles are set with '-' and are required to have the same length 
of the subtitle itself, just like titles.

Lists can be unnumbered like:

 * Item Foo
 * Item Bar

Or automatically numbered:

 #. Item 1
 #. Item 2

Inline Markup
Words can have *emphasis in italics* or be **bold** and you can define
code samples with back quotes, like when you talk about a command: ``sudo`` 
gives you super user powers!
posted @ 2016-07-08 18:49 ABeen 阅读(...) 评论(...) 编辑 收藏