Help:Extension:SyntaxHighlight GeSHi

As taken directly from the extension page on MediaWiki:

Usage
On the wiki page, you can now use "syntaxhighlight" elements:

shows:

Alternative Tag
is also used in some other languages (for example XML). If your source code contains is provided. is recommended to avoid the conflicts mentioned above.

Parameters

 * Defines what programming language the source code is using. This affects how the extension highlights the source code. See the section "Supported languages" in this page for details of supported languages.
 * Defines what programming language the source code is using. This affects how the extension highlights the source code. See the section "Supported languages" in this page for details of supported languages.


 * Type of line numbering to use. If you do not provide this parameter, then lines will not be numbered. Corresponds to enable_line_numbers the flag in GeSHi.
 * Type of line numbering to use. If you do not provide this parameter, then lines will not be numbered. Corresponds to enable_line_numbers the flag in GeSHi.


 * Equivalent to
 * Equivalent to


 * Use together with the parameter "line". Define the start number of the line. If you type line start="55", it will start counting at 55, then 56,57,58... and so on. Corresponds to start_line_numbers_at method on GeSHi
 * Use together with the parameter "line". Define the start number of the line. If you type line start="55", it will start counting at 55, then 56,57,58... and so on. Corresponds to start_line_numbers_at method on GeSHi


 * Specifies which line is highlighted. Note that the parameter line start="??" doesn't affect how it counts the lines.
 * Specifies which line is highlighted. Note that the parameter line start="??" doesn't affect how it counts the lines.


 * Specifies what container is used to enclose the source code. Takes values "pre" (default value), "div", "none". Corresponds to set_header_type method on GeSHi. Choosing "div" will cause text to wrap, which is helpful if text is extending off the edge of the screen, causing horizontal scrolling.
 * Specifies what container is used to enclose the source code. Takes values "pre" (default value), "div", "none". Corresponds to set_header_type method on GeSHi. Choosing "div" will cause text to wrap, which is helpful if text is extending off the edge of the screen, causing horizontal scrolling.


 * Type the name of the parameter to enable the strict mode. Corresponds to enable_strict_mode method on GeSHi.
 * Type the name of the parameter to enable the strict mode. Corresponds to enable_strict_mode method on GeSHi.

The effect and usage of these parameters can be consulted in GeSHi's documentation.

Since r22246, you can override the colors using MediaWiki:Geshi.css.

More Usage
When line numbering is added with line, long code lines will be wrapped. See the example below. When text is the selected language, and numbering is used, the behaviour resembles the use of pre tags with numbering and long-line wrapping.

The following example shows how to color an HTML code listing: A typical result is just:

Supported languages
These are the languages known by GeSHi that can be used in the lang parameter.

Note that installed GeSHi version (can be revealed by previewing e.g. ) might not be the most recent version;  see 10967 for Wikimedia sites.

Default Source Language
Added in 50693.

If the site mainly quotes the source code of a specific programming language, it would be helpful to set a default language.

To do so, add a new variable to LocalSettings.php, just after the require_once line. We set C programming language as an example: