Help:Syntax Highlighting
You can use the <syntaxhighlight>
tag to format code blocks with GeSHi Syntax Highlighting.
Tip: Good languages for FGDs are: mupad and cpp. Both color pretty consistently and are also comment-friendly.
Note: Putting large blocks of code in <syntaxhighlight>
tags may cause pages to load significantly slower.
Syntax[edit source]
<syntaxhighlight lang="languagename"> PREFORMATTED CODE HERE </syntaxhighlight>
If no language is specified, "ini" is used as default (see below).
Example[edit source]
C++ example:
void CBaseEntity::FireBullets( const FireBulletsInfo_t &info )
{
static int tracerCount;
trace_t tr;
CAmmoDef* pAmmoDef = GetAmmoDef();
int nDamageType = pAmmoDef->DamageType(info.m_iAmmoType);
int nAmmoFlags = pAmmoDef->Flags(info.m_iAmmoType);
int iPlayerDamage = info.m_iPlayerDamage;
if ( iPlayerDamage == 0 )
{
if ( nAmmoFlags & AMMO_INTERPRET_PLRDAMAGE_AS_DAMAGE_TO_PLAYER )
{
iPlayerDamage = pAmmoDef->PlrDamage( info.m_iAmmoType );
}
}
// the default attacker is ourselves
CBaseEntity *pAttacker = info.m_pAttacker ? info.m_pAttacker : this;
// Make sure we don't have a dangling damage target from a recursive call
if ( g_MultiDamage.GetTarget() != NULL )
{
ApplyMultiDamage();
}
Supported languages[edit source]
ActionScript, Ada, ANTLR, AppleScript, Assembly (various), Asymptote, Awk, Befunge, Boo, BrainFuck, C, C++, C#, Clojure, CoffeeScript, ColdFusion, Common Lisp, Coq, Cryptol (incl. Literate Cryptol), Crystal, Cython, D, Dart, Delphi, Dylan, Elm, Erlang, Ezhil Ezhil - A Tamil programming language, Factor, Fancy, Fortran, F#, GAP, Gherkin (Cucumber), GL shaders, Groovy, Haskell (incl. Literate Haskell), IDL, Io, Java, JavaScript, Lasso, LLVM, Logtalk, Lua, Matlab, MiniD, Modelica, Modula-2, MuPad, Nemerle, Nimrod, Objective-C, Objective-J, Octave, OCaml, PHP, Perl, PovRay, PostScript, PowerShell, Prolog, Python 2.x and 3.x (incl. console sessions and tracebacks), REBOL, Red, Redcode, Ruby (incl. irb sessions), Rust, S, S-Plus, R, Scala, Scheme, Scilab, Smalltalk, SNOBOL, Tcl, Vala, Verilog, VHDL, Visual Basic.NET, Visual FoxPro, XQuery, Zephir