Help:SyntaxHighlight GeSHi

From Apache OpenOffice Wiki
Jump to: navigation, search

Former: Extension:SyntaxHighlight GeSHi

This extension is replaced by the Extension:SyntaxHighlight, it adds the <syntaxhighlight> tag to present formatted source code.

Usage

You can wrap source code with <syntaxhighlight lang=LANG>...</syntaxhighlight> where LANG is a supported language. This will syntax highlight the source code when viewed in the Wiki page.

Example

<syntaxhighlight lang="php">
<?php
    $v = "string";    // sample initialization
?>
html text
<?
    echo $v;         // end of php code
?>
</syntaxhighlight>

shows:

<?php
    $v = "string";    // sample initialization
?>
html text
<?
    echo $v;         // end of php code
?>

Parameters

  • lang="??": Defines what programming language the source code is using. This affects how the extension highlights the source code. See the section Supported languages for details of supported languages.
  • line="GESHI_NORMAL_LINE_NUMBERS|GESHI_FANCY_LINE_NUMBERS": Type of line numbering to use (default is no line numbering). Corresponds to the flag enable_line_numbers in GeSHi.
  • line start="??": 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
  • highlight="??": Specifies which line is highlighted. Note that the parameter line start="??" doesn't affect how it counts the lines.
  • enclose="??": 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.
  • strict: Type the name of the parameter to enable the strict mode. Corresponds to enable_strict_mode method on GeSHi.
Personal tools