Help:Syntax Highlighting: Difference between revisions
(Removed xfeeds tag) |
(Updated) |
||
Line 1: | Line 1: | ||
This wiki supports syntax highlighting in code examples using the [http://sourceforge.net/projects/geshi/ GeSHi] project |
This wiki supports syntax highlighting in code examples using the [http://sourceforge.net/projects/geshi/ GeSHi] project (version number shown below). |
||
(''FIXME'': How can one find out which version is currently really installed? [[Special:Version]] doesn't seem to list it). |
|||
At the moment, the wiki is in transition from old style to new style highlighting; old style highlighting will still be valid for some time. |
At the moment, the wiki is in transition from old style to new style highlighting; old style highlighting will still be valid for some time. |
||
Line 10: | Line 8: | ||
<pre> |
<pre> |
||
< |
<lang c> |
||
int main (int argc, char* argv[]) |
int main (int argc, char* argv[]) |
||
{ |
{ |
||
return 0; |
return 0; |
||
} |
} |
||
</ |
</lang> |
||
</pre> |
</pre> |
||
looks like |
looks like |
||
< |
<lang c> |
||
int main (int argc, char* argv[]) |
int main (int argc, char* argv[]) |
||
{ |
{ |
||
return 0; |
return 0; |
||
} |
} |
||
</ |
</lang> |
||
A list of supported languages, and their corresponding PHP files for GeSHi, can be found here: |
A list of supported languages, and their corresponding PHP files for GeSHi, can be found here: |
||
http://geshi.svn.sourceforge.net/viewvc/geshi/tags/RELEASE_1_0_7_22/geshi-1.0.X/src/geshi/ |
http://geshi.svn.sourceforge.net/viewvc/geshi/tags/RELEASE_1_0_7_22/geshi-1.0.X/src/geshi/ (change version number to match the one below). |
||
Ideally, one should also use the |
Ideally, one should also use the lang tags for languages that are not yet supported, because that will avoid additional editing if these languages will become supported in a future release of GeSHi. |
||
It's in principle possible to write additional PHP files for unsupported languages and include them. Please contact one of the administrators for details. |
It's in principle possible to write additional PHP files for unsupported languages and include them. Please contact one of the administrators for details. |
||
Line 56: | Line 54: | ||
</c> |
</c> |
||
<lang list></lang> |
|||
The available tags are (from [[Special:Version]]): |
|||
<nowiki> |
|||
<actionscript-french>, <actionscript>, <ada>, <apache>, <applescript>, <asm>, <asp>, <bash>, <blitzbasic>, <caddcl>, <cadlisp>, <c_mac>, <c>, <cpp>, <csharp>, <css>, <delphi>, <diff>, <dos>, <d>, <eiffel>, <freebasic>, <gml>, <html4strict>, <ini>, <inno>, <java>, <javascript>, <lisp>, <lua>, <matlab>, <mpasm>, <mysql>, <nsis>, <objc>, <ocaml-brief>, <ocaml>, <oobas>, <oracle8>, <pascal>, <perl>, <php-brief>, <php>, <python>, <qbasic>, <ruby>, <scheme>, <sdlbasic>, <smarty>, <sql>, <vbnet>, <vb>, <vhdl>, <visualfoxpro>, <xml> |
|||
</nowiki> |
Revision as of 17:10, 11 June 2009
This wiki supports syntax highlighting in code examples using the GeSHi project (version number shown below).
At the moment, the wiki is in transition from old style to new style highlighting; old style highlighting will still be valid for some time.
New style
Code examples are enclosed by <code> tags. The lang argument selects the language used for highlighting. Example:
<lang c> int main (int argc, char* argv[]) { return 0; } </lang>
looks like
<lang c>
int main (int argc, char* argv[]) { return 0; }
</lang>
A list of supported languages, and their corresponding PHP files for GeSHi, can be found here: http://geshi.svn.sourceforge.net/viewvc/geshi/tags/RELEASE_1_0_7_22/geshi-1.0.X/src/geshi/ (change version number to match the one below).
Ideally, one should also use the lang tags for languages that are not yet supported, because that will avoid additional editing if these languages will become supported in a future release of GeSHi.
It's in principle possible to write additional PHP files for unsupported languages and include them. Please contact one of the administrators for details.
Old style
Code examples are enclosed in tags named after the language, as in
<c> int main (int argc, char* argv[]) { return 0; } </c>
That renders as
<c> int main (int argc, char* argv[]) {
return 0;
} </c>
<lang list></lang>