The Pygments reStructuredText directive
This fragment is a Docutils 0.5 directive that renders source code
(to HTML only, currently) via Pygments.
To use it, adjust the options below and copy the code into a module
that you import on initialization. The code then automatically
registers a sourcecode
directive that you can use instead of
normal code blocks like this:
.. sourcecode:: python
My code goes here.
If you want to have different code styles, e.g. one with line numbers
and one without, add formatters with their names in the VARIANTS dict
below. You can invoke them instead of the DEFAULT one by using a
directive option:
.. sourcecode:: python
:linenos:
My code goes here.
Look at the directive documentation to get all the gory details.
Copyright: | Copyright 2006-2014 by the Pygments team, see AUTHORS. |
License: | BSD, see LICENSE for details. |