Syntax Highlighting

This wiki allows syntax highlighting using Geshi and a module extension for Mediawiki. You can specify more than 120 supported languages in using the highlighter.

The system also works well for export (check out this page via this URL):
 * http://wiki.opensemanticframework.org/index.php/Syntax_Highlighting?action=render (then, View Source)

Basic Usage
To use the system, you need to bracket your code example with these tags: Following are some examples:

Export and External Style Sheet
The code generated by the highlighter embeds a dynamic style sheet. To use the same code without Geshi in an external application, you must add new classes and colors to your external style sheet.

Depending on the language you are highlighting, you may get different classes listed.

For pages on which you are using highlighting, do a View Source and look for something like this generated table (this example is for 'PHP'): /*<![CDATA[*/ .source-php {line-height: normal;} .source-php li, .source-php pre { line-height: normal; border: 0px none white; } /** .source-php .de1, .source-php .de2 {font-family: monospace; font-weight: normal; font-style: normal; margin:0; padding:0; background:inherit;} .source-php {font-family: monospace;} .source-php .imp {font-weight: bold; color: red;} .source-php li, .source-php li.li1 {font-weight: normal;} .source-php li.li2 {font-weight: bold;} .source-php .kw1 {color: #b1b100;} .source-php .kw2 {color: #000000; font-weight: bold;} .source-php .kw3 {color: #990000;} .source-php .co1 {color: #666666; font-style: italic;} .source-php .co2 {color: #666666; font-style: italic;} .source-php .co3 {color: #0000cc; font-style: italic;} .source-php .coMULTI {color: #666666; font-style: italic;} .source-php .es0 {color: #000099; font-weight: bold;} .source-php .br0 {color: #009900;} .source-php .sy0 {color: #339933;} .source-php .st0 {color: #0000ff;} .source-php .nu0 {color: #cc66cc;} .source-php .me1 {color: #004000;} .source-php .me2 {color: #004000;} .source-php .re0 {color: #000088;} .source-php .ln-xtra, .source-php li.ln-xtra, .source-php div.ln-xtra {background-color: #ffc;} .source-php span.xtra { display:block; }
 * GeSHi Dynamically Generated Stylesheet
 * Dynamically generated stylesheet for php
 * CSS class: source-php, CSS id:
 * GeSHi (C) 2004 - 2007 Nigel McNie, 2007 - 2008 Benny Baumann
 * (http://qbnz.com/highlighter/ and http://geshi.org/)
 * (http://qbnz.com/highlighter/ and http://geshi.org/)

/*]]>*/

Make sure you have a color assignment for each of the classes so listed in your external style sheet.

pre Tag
The following material is in a pre tag. We are using PHP as the default. SOURCE DOES NOT WORK !!!!:

PHP
Here is the PHP example:

HTML
Here is the HTML example: