Help:Highlighting Syntax
From rPath Wiki
Usage and Example
You can add source code and highlight the code's syntax in the rPath Wiki. To do so, use the <source></source> markup tag. Specify the source code language to have the elements highlighted properly via the lang argument.
For example, to add some Python code to a wiki page, use the following syntax:
<source lang="python">
#!/usr/bin/python
import sys
import string
import getopt
program = sys.argv[0]
def usage(status, msg=''):
stdout = sys.stdout
try:
sys.stdout = sys.stderr
if msg:
print msg
print __doc__ % globals()
finally:
sys.stdout = stdout
sys.exit(status)
...
</source>
Here is what the above example looks like when rendered:
#!/usr/bin/python import sys import string import getopt program = sys.argv[0] def usage(status, msg=''): stdout = sys.stdout try: sys.stdout = sys.stderr if msg: print msg print __doc__ % globals() finally: sys.stdout = stdout sys.exit(status) ...
Available Language Specifiers
Some of the available language specifiers for the source tag include -- other languages supported by the GeSHi syntax highlighter should work as well:
actionscript, actionscript-french, ada, apache, applescript, asm, asp, bash, blitzbasic, c, c_mac, caddcl, cadlisp, cpp, csharp, css, d, delphi, diff, div, dos, eiffel, freebasic, gml, html4strict, ini, inno, java, javascript, lisp, lua, matlab, mpasm, mysql, nsis, objc, ocaml, ocaml-brief, oobas, oracle8, pascal, perl, php, php-brief, python, qbasic, ruby, scheme, sdlbasic, smarty, sql, vb, vbnet, versata, vhdl, visualfoxpro, xml
