1.. -*- mode: rst -*- 2 3================================ 4Using Pygments in ReST documents 5================================ 6 7Many Python people use `ReST`_ for documentation their sourcecode, programs, 8scripts et cetera. This also means that documentation often includes sourcecode 9samples or snippets. 10 11You can easily enable Pygments support for your ReST texts using a custom 12directive -- this is also how this documentation displays source code. 13 14From Pygments 0.9, the directive is shipped in the distribution as 15`external/rst-directive.py`. You can copy and adapt this code to your liking. 16 17.. removed -- too confusing 18 *Loosely related note:* The ReST lexer now recognizes ``.. sourcecode::`` and 19 ``.. code::`` directives and highlights the contents in the specified language 20 if the `handlecodeblocks` option is true. 21 22.. _ReST: https://docutils.sourceforge.io/rst.html 23