Wiki source for SyntaxHighlighter


Show raw source

===== Syntax Highlighting for Code Blocks=====

>>==See Wikka in action:==
~-""<a href="http://wikkawiki.org/WikkaInAction#hn_7._Adding_a_code_block">Adding a code block</a>"" {{image url="images/action/qt.gif" alt="quicktime icon" title="Wikka clips"}}
==See also:==
~-Development: [[http://wikkawiki.org/WikkaGeshiIntegration | WikkaGeshiIntegration]].
~-[[ThirdPartyInfo | Third-party software bundled with Wikka]]
~-FormattingRules for the usage
>>{{since version="1.1.6.0" align="left"}}This is the documentation page for the syntax highlighter.

{{image alt="Code highlighting sample" title="GeSHi support" url="images//features/code_highlighting.jpg"}}
::c::
[[http://qbnz.com/highlighter/ | GeSHi]] is now hooked into Wikka.

Usage: ##""%%(formatter[;line-number][;filename]) code %%""##

==Line-numbers==
If ##geshi_line_numbers##in the ConfigurationOptions is enabeld, simply add a ##;line-number## after the language formatter to display line-numbers starting at ##line-number##.

~##""%%(php;""{{color c="red" text="15"}}"")<br /><?php<br />echo "Hello, World!";<br />?><br />%%""##

%%(php;15)
<?php
echo "Hello, World!";
?>
%%

==Setting a file name for download==
If you specify a ##filename##, this will be used for downloading the code.

~##""%%(php;15;""{{color c="red" text="test.php"}}"")<br /><?php<br />echo "Hello, World!";<br />?><br />%%""##

%%(php;15;test.php)
<?php
echo "Hello, World!";
?>
%%

==Linking to online documention==
If you click on a function name, you get to the entry of this function in the online manual of the language (only for some languages). You can try it out with the php-example below.

=== Available formatters ===

== GeSHi formatters ==
|?|List of available code formatters {{since display="inline" version="1.1.6.4"}}||
||
|=|Language|=|Formatter|=|Language|=|Formatter|=|Language|=|Formatter||
|#|
|=|Actionscript||##actionscript##|=|ABAP||##abap##|=|ADA||##ada##||
|=|Apache Log||##apache##|=|""AppleScript""||##applescript##|=|ASM||##asm##||
|=|ASP||##asp##|=|""AutoIT""||##autoit##|=|Bash||##bash##||
|=|""BlitzBasic""||##blitzbasic##|=|""Basic4GL""||##basic4gl##|=|bnf||##bnf##||
|=|C||##c##|=|C for Macs||##c_mac##|=|C#||##csharp##||
|=|C""++""||##cpp##|=|C""++"" (+QT)||##cpp-qt##|=|CAD DCL||##caddcl##||
|=|""CadLisp""||##cadlisp##|=|CFDG||##cfdg##|=|""ColdFusion""||##cfm##||
|=|CSS||##css##|=|CSV ""<sup>†</sup""||##csv##|=|D||##d##||
|=|Delphi||##delphi##|=|Diff-Output||##diff##|=|DIV||##div##||
|=|DOS||##dos##|=|Dot||##dot##|=|Eiffel||##eiffel##||
|=|Fortran||##fortran##|=|""FreeBasic""||##freebasic##|=|FOURJ\'s Genero 4GL||##genero##||
|=|GML||##gml##|=|Groovy||##groovy##|=|Haskell||##haskell##||
|=|HTML||##html4strict##|=|INI||##ini##|=|Inno Script||##inno##||
|=|Io||##io##|=|Java 5||##java5##|=|Java||##java##||
|=|Javascript||##javascript##|=|""LaTeX""||##latex##|=|Lisp||##lisp##||
|=|Lua||##lua##|=|Matlab||##matlab##|=|mIRC Scripting||##mirc##||
|=|Microchip Assembler||##mpasm##|=|Microsoft Registry||##reg##|=|Motorola 68k Assembler||##m68k##||
|=|""MySQL""||##mysql##|=|NSIS||##nsis##|=|Objective C||##objc##||
|=|""OpenOffice"" BASIC||##oobas##|=|Objective Caml||##ocaml##|=|Objective Caml (brief)||##ocaml-brief##||
|=|Oracle 8||##oracle8##|=|Pascal||##pascal##|=|Per (FOURJ\'s Genero 4GL)||##per##||
|=|Perl||##perl##|=|PHP||##php##|=|PHP (brief)||##php-brief##||
|=|PL/SQL||##plsql##|=|Python||##phyton##|=|Q(uick)BASIC||##qbasic##||
|=|robots.txt||##robots##|=|Ruby on Rails||##rails##|=|Ruby||##ruby##||
|=|SAS||##sas##|=|Scheme||##scheme##|=|sdlBasic||##sdlbasic##||
|=|Smarty||##smarty##|=|SQL||##sql##|=|TCL/iTCL||##tcl##||
|=|T-SQL||##tsql##|=|Text||##text##|=|thinBasic||##thinbasic##||
|=|Unoidl||##idl##|=|VB.NET||##vbnet##|=|VHDL||##vhdl##||
|=|Visual BASIC||##vb##|=|Visual Fox Pro||##visualfoxpro##|=|""WinBatch""||##winbatch##||
|=|XML||##xml##|=|X""++""||##xpp##|=|""ZiLOG"" Z80 Assembler||##z80##||
""<sup>†</sup>"" CSV is not handled by GeSHi, but by a Wikka handler: [[FormatterCSV]]{{since version="1.4.2" display="inline"}}


==built-in:==
~-INI file
~-email (with quotation indentation)
~-php (taken care of by ""GeSHi"", if present)
~-code, unknown language, plain text

Note that ""GeSHi"" syntax highlighting takes precedence over built-in syntax highlighting.

===Examples===

==highlighted with [[http://qbnz.com/highlighter/ | GeSHi]]==

""%%(php;1) PHP code with line-numbers%%:""
%%(php;1)
<?php
phpinfo();
$text = "Hello, World!";
print $text;
?>
%%

""%%(css) CSS code%%""
%%(css)
body {
font-family: "Trebuchet MS", Georgia, serif;
font-size: .9em;
line-height: 1.4em;
font-weight: normal;
color: #000000;
background-image: url(../images/wikkalight.jpg);
background-attachment: fixed;
background-repeat: no-repeat;
background-color: #000;
margin: 0px;
}
%%

""%%(javascript;129) JavaScript code starting on line 129%%""
%%(javascript;129)
function fKeyDown()
{
if (event.keyCode == 9)
{
event.returnValue = false;
document.selection.createRange().text = String.fromCharCode(9);
}
}
%%

""%%(php;1) PHP code with line-numbers and filename%%:""
%%(php;1;test.php)
<?php
phpinfo();
$text = "Hello, World!";
print $text;
?>
%%

==Wikka built-in highlighter==

The built-int highlighter does not supported line numbering and is maintained for backwards-compatibility.

""%%(ini) INI file contents%%:""
%%(ini)
; Menu specification file for Opera 7.0

[Version]
File Version=2

[Info] #background info
Name=Munin++ Menu
Description=Munin++ Menu
Author=NonTroppo (originally by Rijk van Geijtenbeek)
Version=1.9
%%

""%%(email) Email message%%:""
%%(email)
Hi!
>>>> My Llama loves foot massage.
>>> You really think so?
>> Yes, I know he does.
>Are you sure?

Of course, yes!

Mr. Scruff
%%

""%%code%%:""
%%
int main(int arc,char **argv)
{
printf("Hello, %s!
", (argc>1) ? argv[1] : "World");
return 0;
}
%%


----
CategoryEN
Valid XHTML :: Valid CSS: :: Powered by WikkaWiki