Sphinx备忘单

这是一份奇妙的便签,关于你在Sphinx和ReST中需要用到的常见资料。你可以查看 这个文档的源码

文本格式

你可以使用行间标记来标记文本成 斜体粗体,或者 monotype

你可以相当简单地展现代码块:

import numpy as np
x = np.random.rand(12)

或者之间将代码纳入进来:

from pylab import *
from matplotlib.patches import Ellipse

delta = 45.0 # degrees

angles = arange(0, 360+delta, delta)
ells = [Ellipse((1, 1), 4, 2, a) for a in angles]

a = subplot(111, aspect='equal')

for e in ells:
    e.set_clip_box(a.bbox)
    e.set_alpha(0.1)
    a.add_artist(e)

xlim(-2, 4)
ylim(-1, 3)

show()

制作列表

生成列表是一件非常容易的事情。

要点列表

这段介绍如何制作要点列表。

  • point A
  • point B
  • point C

有序列表

这段介绍何如制作有序列表。

  1. point A
  2. point B
  3. point C

制作表格

这里介绍了怎么样制作一张表格——如果你指向制作一张列表请看 制作列表

Name Age
John D Hunter 40
Cast of Thousands 41
And Still More 42

脚注

这段介绍一个脚注是如何制作的。[1] 如下代码,效果见脚注[1]:

Lorem ipsum [#f1]_ dolor sit amet ... [#f2]_

.. rubric:: Footnotes

.. [#f1] Text of the first footnote.
.. [#f2] Text of the second footnote.

这个文档的源码

.. _cheat-sheet:

******************
Sphinx备忘单
******************

这是一份奇妙的便签,关于你在Sphinx和ReST中需要用到的常见资料。你可以查看 :ref:`cheatsheet-literal`。


.. _formatting-text:

文本格式
===============
你可以使用行间标记来标记文本成 *斜体*, **粗体**,或者 ``monotype``。

你可以相当简单地展现代码块::

   import numpy as np
   x = np.random.rand(12)

或者之间将代码纳入进来:

.. literalinclude:: ellipses.py


.. _making-a-list:

制作列表
=============
生成列表是一件非常容易的事情。

要点列表
-------------
这段介绍如何制作要点列表。

* point A

* point B

* point C

有序列表
------------------
这段介绍何如制作有序列表。

#. point A

#. point B

#. point C


.. _making-a-table:

制作表格
==============
这里介绍了怎么样制作一张表格——如果你指向制作一张列表请看 :ref:`making-a-list` 。

==================   ============
Name                 Age
==================   ============
John D Hunter        40
Cast of Thousands    41
And Still More       42
==================   ============

脚注
=============
这段介绍一个脚注是如何制作的。[1]_ 如下代码,效果见脚注[1]::

    Lorem ipsum [#f1]_ dolor sit amet ... [#f2]_

    .. rubric:: Footnotes

    .. [#f1] Text of the first footnote.
    .. [#f2] Text of the second footnote.

.. _making-links:

制作超链接
============
你可以很容易的生成一个超链接到 `新浪 <http://sina.com.cn>`_ 或者到这篇文档的一个
小结 (见: :ref:`making-a-table` ) 又或者到另外一个文档。

(未翻译)You can also reference classes, modules, functions, etc that are
documented using the sphinx `autodoc
<http://sphinx.pocoo.org/ext/autodoc.html>`_ facilites.  For example,
see the module :mod:`matplotlib.backend_bases` documentation, or the
class :class:`~matplotlib.backend_bases.LocationEvent`, or the method
:meth:`~matplotlib.backend_bases.FigureCanvasBase.mpl_connect`.

.. _cheatsheet-literal:

这个文档的源码
==================

.. literalinclude:: cheatsheet.rst

英文源码 [2]_
==================
.. literalinclude:: cheatsheet_eng_version.txt

.. rubric:: 脚注
.. [1] 这是一个脚注的内容。
.. [2] 英文源链接:http://matplotlib.org/sampledoc/cheatsheet.html#making-a-list

英文源码 [2]

.. _cheat-sheet:

******************
Sphinx cheat sheet
******************

Here is a quick and dirty cheat sheet for some common stuff you want
to do in sphinx and ReST.  You can see the literal source for this
file at :ref:`cheatsheet-literal`.


.. _formatting-text:

Formatting text
===============

You use inline markup to make text *italics*, **bold**, or ``monotype``.

You can represent code blocks fairly easily::

   import numpy as np
   x = np.random.rand(12)

Or literally include code:

.. literalinclude:: ellipses.py

.. _making-a-list:

Making a list
=============

It is easy to make lists in rest

Bullet points
-------------

This is a subsection making bullet points

* point A

* point B

* point C


Enumerated points
------------------

This is a subsection making numbered points

#. point A

#. point B

#. point C


.. _making-a-table:

Making a table
==============

This shows you how to make a table -- if you only want to make a list see :ref:`making-a-list`.

==================   ============
Name                 Age
==================   ============
John D Hunter        40
Cast of Thousands    41
And Still More       42
==================   ============

.. _making-links:

Making links
============

It is easy to make a link to `yahoo <http://yahoo.com>`_ or to some
section inside this document (see :ref:`making-a-table`) or another
document.

You can also reference classes, modules, functions, etc that are
documented using the sphinx `autodoc
<http://sphinx.pocoo.org/ext/autodoc.html>`_ facilites.  For example,
see the module :mod:`matplotlib.backend_bases` documentation, or the
class :class:`~matplotlib.backend_bases.LocationEvent`, or the method
:meth:`~matplotlib.backend_bases.FigureCanvasBase.mpl_connect`.



.. _cheatsheet-literal:

This file
=========

.. literalinclude:: cheatsheet.rst

脚注

[1]这是一个脚注的内容。
[2]英文源链接:http://matplotlib.org/sampledoc/cheatsheet.html#making-a-list