Exts:SyntaxHighlight GeSHi

From Zoelife4U Wiki
Jump to: navigation, search

Contents

Usage

On the wiki page, you can now use "source" elements:

<source lang="php">
<?php
    $v = "string";    // sample initialization
?>
html text
<?
    echo $v;         // end of php code
?>
</source>

Parameters

The effect and usage of these parameters can be consulted in GeSHi's documentation.

Since r22246, you can override the colors using [[MediaWiki:GeSHi.css]].

Examples

C#

<source lang="csharp">
// Hello World in Microsoft C# ("C-Sharp").

using System;

class HelloWorld
{
    public static int Main(String[] args)
    {
        Console.WriteLine("Hello, World!");
        return 0;
    }
}
</source>

Results in:

// Hello World in Microsoft C# ("C-Sharp").
 
using System;
 
class HelloWorld
{
    public static int Main(String[] args)
    {
        Console.WriteLine("Hello, World!");
        return 0;
    }
}

PHP

<source lang="php">
<?php
  // Hello World in PHP
  echo 'Hello World!';
?>
</source>

Results in:

<?php
  // Hello World in PHP
  echo 'Hello World!';
?>

Python

<source lang="python">
# Hello World in Python

def main():
    print "Hello World!"

if __name__ == '__main__':
    main()
</source>

Results in:

# Hello World in Python
 
def main():
    print "Hello World!"
 
if __name__ == '__main__':
    main()

Fortran

bugs:

  • comments for fortran77 do not work (line starts with C)
<source lang="fortran">
C *
C *testing this srcipt
C *
c * comments for fortran77 do not work!

hello = "Hello World!"

if hello .eq. 'test' then
 !do nothing
else
 !do something
 x = 1
endif
</source>

Results in:

C *
C *testing this srcipt
C *
c * comments for fortran77 do not work!
 
hello = "Hello World!"
 
if hello .eq. 'test' then
 !do nothing
else
 !do something
 x = 1
endif

Supported languages

These are the languages known by GeSHi that can be used in the lang parameter:

Code Language
abap ABAP
actionscript ActionScript
ada Ada
apache Apache Log
applescript AppleScript
asm ASM
asp Active Server Pages (ASP)
autoit AutoIt
bash Bash
basic4gl Basic4GL
blitzbasic Blitz BASIC
bnf Backus-Naur Form
c C
c_mac C (Mac)
caddcl AutoCAD DCL
cadlisp AutoLISP
cfdg CFDG
cfm ColdFusion
cpp-qt C++ (Qt toolkit)
cpp C++
csharp C#
css Cascading Style Sheets (CSS)
d D
delphi Delphi
diff Diff
div DIV
dos DOS batch file
dot DOT
eiffel Eiffel
fortran Fortran
freebasic FreeBASIC
genero Genero
gml Game Maker Language (GML)
groovy Groovy
haskell Haskell
html4strict HTML
idl Uno IDL
ini INI
inno Inno
io Io
java Java
java5 Java(TM) 2 Platform Standard Edition 5.0
javascript JavaScript
latex LaTeX
Code Language
lisp Lisp
lua Lua
m68k Motorola 68000 Assembler
matlab MATLAB M
mirc mIRC scripting language
mpasm Microchip Assembler
mysql MySQL
nsis Nullsoft Scriptable Install System (NSIS)
objc Objective-C
ocaml-brief OCaml
ocaml OCaml
oobas OpenOffice.org Basic
oracle8 Oracle 8 SQL
pascal Pascal
per per
perl Perl
php-brief PHP
php PHP
plsql PL/SQL
python Python
qbasic QBasic/QuickBASIC
rails Rails
reg Windows Registry
robots robots.txt
ruby Ruby
sas SAS
scheme Scheme
sdlbasic SdlBasic
smalltalk Smalltalk
smarty Smarty
sql SQL
tcl Tcl
text Plain text
thinbasic thinBasic
tsql Transact-SQL
vb Visual Basic
vbnet Visual Basic .NET
vhdl VHDL
visualfoxpro Visual FoxPro
winbatch Winbatch
xml XML
xpp X++
z80 ZiLOG Z80 Assembler

See also

Template:OnWikimedia Template:Languages

Personal tools
Online Users
Zoelife4U: