MediaWiki REL1_30
README
Go to the documentation of this file.
1This extension allows source code to be syntax highlighted on the wiki pages.
2This README file might be out of date, have a look at the extension page
3for updated informations:
4
5 https://www.mediawiki.org/wiki/Extension:SyntaxHighlight_GeSHi
6
7== Requirements ==
8
9This version of the extension has been tested with Pygments 1.6, 2.0.2 and
10MediaWiki 1.25 as of 2015-06-19. To get releases of this extension compatible
11with earlier versions of MediaWiki, visit:
12
13 https://www.mediawiki.org/wiki/Special:ExtensionDistributor/SyntaxHighlight_GeSHi
14
15== Installation ==
16
17First, you will need to ensure that this extension's Composer-managed
18dependencies are available. In the extension directory, run 'composer update'.
19
20Next, Add this line to your LocalSettings.php:
21
22 wfLoadExtension( 'SyntaxHighlight_GeSHi' );
23
24By default, this extension will use a bundled copy of Pygments 2.0.2. If you
25would like to use a different copy of the library, you can set
26$wgPygmentizePath to point to the path to the 'pygmentize' binary.
27
28== Usage ==
29
30On the wiki page, you can now use "source" elements:
31
32<source lang="php">
33<?php
34 v = "string"; // sample initialization
35?>
36html text
37<?php
38 echo v; // end of php code
39?>
40</source>
41
42== Parameters ==
43
44For details information of these parameters, see the documentation of Pygments'
45HtmlFormatter at <http://pygments.org/docs/formatters/#HtmlFormatter>.
46
47* lang; Defines the language.
48* line; Corresponds to linenos="inline" option.
49* start; Corresponds to linenostart opion.
50* enclose; If set to "none", corresponds to the nowrap=1 option.
51* inline; Corresponds to the nowrap=1 option.
52* highlight; Corresponds to hl_lines option (comma separated).
53
54== Note ==
55
56Pygments is generous about creating HTML elements: highlighting large blocks of
57code can easily generate enough of them to crash a browser. As a guard, syntax
58highlighting is turned off for code fragments larger than 100 kB.