文档地址:http://pythonhosted.org/an_example_pypi_project/sphinx.html#bold-italics
粗体和斜体
**bold***italics*
列表
* a thing.* b thing.或者1. item 1.2. item 2.3. item 3.或者- a thing.- b thing.- c thing.
headers
h1 --- top of page tops*************************?h2 -- page sections=====================?h3 -- subsections-------------------?h4 -- subsubsections++++++++++++++++++++++++
表格
complex table:?+------------+------------+-----------+| header 1 | header 2 | header 3|+============+============+===========+| body row 1 | column 2 | column 3|+------------+------------+-----------+| body row 2 | cells may span columns.|+------------+------------+-----------+| body row 3 | cells may| - cells |+------------+ span rows. | - contain || body row 4 || - blocks. |+------------+------------+-----------+?simple table:?================ inputs output------------------aba or b================falsefalsefalsetrue falsetruefalsetrue truetrue true true================
链接
`docs for this project `_`table of contents`_
图片(images)
images==================?.. _is_sweaty:.. figure:: .static/abc.jpg :align: center? proof that getting rich is mostly luck.?this picture is_sweaty_.
代码
here is something i want to talk about::?def my_fn(foo, bar=true):a really useful function.?returns nonepassif a ==b :print 1?inlines--------------this is inline ``if __name__ == '__main__':``
函数定义
========================
.. function:: format_exception(etype, value, tb[, limit=none])? format the exception with a traceback.? :param etype: exception type :param value: exception value :param tb: traceback object :param limit: maximum number of stack frames to show :type limit: integer or none :rtype: list of strings
python语法连接
=========================
i really like the :mod:`threading` module which has the:class:`threading.thread` class.?here is a link :func:`time.time`.
段落标识
=============================
.. note:: test?.. warning:: test?.. versionadded:: version?.. versionchanged:: version?.. seealso:: test例子------------------------?this is a statement.?.. warning::? never, ever, use this code!?.. versionadded:: 0.0.1?it's okay to use this code.
需要注意的地方:
标题的长度,要小于等于====的长度。
否则会在编译的过程中出现title undline too short.的错误。
如果rst文件中出现了中文的,需要进行特殊处理,才能保证编译不会出现问题。
修改conf.pyimport sysreload(sys)sys.setdefaultencoding('utf8')
原文地址:sphinx-doc学习, 感谢原作者分享。
