Difference between revisions of "Wiki Syntax Highlight"

From Hostek.com Wiki
Jump to: navigation, search
(Created page with "<p>We have a MediaWiki extension SyntaxHighlight GeSHi installed which will highlight code to make it easier to read. </p> ==Usuage== Here is an example highlighting PHP code:...")
 
(No difference)

Latest revision as of 18:01, 23 May 2013

We have a MediaWiki extension SyntaxHighlight GeSHi installed which will highlight code to make it easier to read.

Usuage

Here is an example highlighting PHP code:

<syntaxhighlight lang="php" >
<?php
    $string = "hello";    // comment
?>
html text
<?
    echo $string;         // end of php code
?>
</syntaxhighlight>

This will be displayed like:

<?php
    $string = "hello";    // comment
?>
html text
<?
    echo $string;         // end of php code
?>

Line numbering and highlighting

You could also have it number your lines and highlight a specific line.

Example:

<syntaxhighlight lang="php" line start="1" highlight="4">
<?php
    $x=5;
    $y=6;
    $z=$x+$y;
    echo $z;
?>
</syntaxhighlight>

Will display as:

  1. <?php
  2.     $x=5;
  3.     $y=6;
  4.     $z=$x+$y;
  5.     echo $z;
  6. ?>

Supported Languages

Refer to http://www.mediawiki.org/wiki/Extension:SyntaxHighlight_GeSHi#Supported_languages