Syntax Highlighting

Here at the T3D wiki, we use a custom syntax highlighter which looks really nice, but has a few quirks. First of all, a comparison. This is built-in Wikidot highlighting (CPP brush):

function Coin::onCollision(%this, %obj, %col, %vec, %len)
{
   %obj.delete();
   $CoinsFound++;
   if(Coins.getCount() <= 0)
   {
      commandToClient(%col.client, 'ShowVictory', $CoinsFound);
   }
}

This is the custom highlighter:

This comes at the cost of longer load times, because of the way Wikidot works with client-side scripts and a different syntax. To use the highlighter, you use the following snippet:

[[include inc:code |type={lang}
|code=
// Code here
]]

Where {lang} can be anyone of the following:

Abbreviation Language
ts TorqueScript
cpp C++
csharp C#
css CSS
java Java
jscript JavaScript
php PHP
python Python
ruby Ruby
sql SQL
vb VisualBasic
xml XML
perl Perl
hs Haskell

Please note that the abbreviations is what you put in {lang}, and they should always be lowercase. Example:

[[include inc:code |type=ts
|code=
function Coin::onCollision(%this, %obj, %col, %vec, %len)
{
%obj.delete();
$CoinsFound++;
if(Coins.getCount() <= 0)
{
commandToClient(%col.client, 'ShowVictory', $CoinsFound);
}
}
]]

Unless otherwise stated, the content of this page is licensed under Creative Commons Attribution-ShareAlike 3.0 License