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 This file.
For a more detailed guide see Sphinx and RST syntax guide
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:
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()
Making a list¶
It is easy to make lists in rest
Making a table¶
This shows you how to make a table – if you only want to make a list see Making a list.
| Name | Age |
|---|---|
| John D Hunter | 40 |
| Cast of Thousands | 41 |
| And Still More | 42 |
Making links¶
It is easy to make a link to yahoo or to some section inside this document (see Making a table) or another document.
You can also reference classes, modules, functions, etc that are
documented using the sphinx autodoc facilites. For example,
see the module matplotlib.backend_bases documentation, or the
class LocationEvent, or the method
mpl_connect().
This file¶
.. _sdl-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:`sdl-cheatsheet-literal`.
For a more detailed guide see `Sphinx and RST syntax guide <http://thomas-cokelaer.info/tutorials/sphinx/rest_syntax.html>`_
.. _sdl-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:: pyplots/ellipses.py
.. _sdl-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
.. _sdl-making-a-table:
Making a table
==============
This shows you how to make a table -- if you only want to make a list see :ref:`sdl-making-a-list`.
================== ============
Name Age
================== ============
John D Hunter 40
Cast of Thousands 41
And Still More 42
================== ============
.. _sdl-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:`sdl-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`.
.. _sdl-cheatsheet-literal:
This file
=========
.. literalinclude:: sdl_cheatsheet.rst