Debian Codegraph @

doc/docs/moinmoin.rst

raw
1 .. -*- mode: rst -*-
2
3 ============================
4 Using Pygments with MoinMoin
5 ============================
6
7 From Pygments 0.7, the source distribution ships a `Moin`_ parser plugin that
8 can be used to get Pygments highlighting in Moin wiki pages.
9
10 To use it, copy the file `external/moin-parser.py` from the Pygments
11 distribution to the `data/plugin/parser` subdirectory of your Moin instance.
12 Edit the options at the top of the file (currently ``ATTACHMENTS`` and
13 ``INLINESTYLES``) and rename the file to the name that the parser directive
14 should have. For example, if you name the file ``code.py``, you can get a
15 highlighted Python code sample with this Wiki markup::
16
17 {{{
18 #!code python
19 [...]
20 }}}
21
22 where ``python`` is the Pygments name of the lexer to use.
23
24 Additionally, if you set the ``ATTACHMENTS`` option to True, Pygments will also
25 be called for all attachments for whose filenames there is no other parser
26 registered.
27
28 You are responsible for including CSS rules that will map the Pygments CSS
29 classes to colors. You can output a stylesheet file with `pygmentize`, put it
30 into the `htdocs` directory of your Moin instance and then include it in the
31 `stylesheets` configuration option in the Moin config, e.g.::
32
33 stylesheets = [('screen', '/htdocs/pygments.css')]
34
35 If you do not want to do that and are willing to accept larger HTML output, you
36 can set the ``INLINESTYLES`` option to True.
37
38
39 .. _Moin: https://moinmo.in/