Difference between revisions of "MediaWiki/Syntax highlighting"
(inital draft) |
|||
Line 1: | Line 1: | ||
Writing good code follows good coding standards. On top of coding standards, syntax highlighting reveals the code making it easier to read (and learn). | Writing good code follows good coding standards. On top of coding standards, syntax highlighting reveals the code making it easier to read (and learn). | ||
− | There is a [http://qbnz.com/highlighter/faq.php Generic Syntax Highlighter] or GeSHi for short which is available as a Debian package (sudo apt-get install php-geshi). Adding | + | There is a [http://qbnz.com/highlighter/faq.php Generic Syntax Highlighter] or GeSHi for short which is available as a Debian package (sudo apt-get install php-geshi). Adding [http://www.mediawiki.org/wiki/Extension:SyntaxHighlight_GeSHi Brion Vibber's extension] (is better than this alternate [http://meta.wikimedia.org/wiki/GeSHiCodeTag_Extension GeSHi Code Tag] extension because Brion's just registers one new tag: 'source' and uses the extension parameter passing available since MW 1.5) extension to allows it to be used in this wiki. |
Incorporating it into Mediawiki is just a matter of creating/configuring the extension and including it in LocalSettings. | Incorporating it into Mediawiki is just a matter of creating/configuring the extension and including it in LocalSettings. |
Revision as of 20:57, 3 June 2007
Writing good code follows good coding standards. On top of coding standards, syntax highlighting reveals the code making it easier to read (and learn).
There is a Generic Syntax Highlighter or GeSHi for short which is available as a Debian package (sudo apt-get install php-geshi). Adding Brion Vibber's extension (is better than this alternate GeSHi Code Tag extension because Brion's just registers one new tag: 'source' and uses the extension parameter passing available since MW 1.5) extension to allows it to be used in this wiki.
Incorporating it into Mediawiki is just a matter of creating/configuring the extension and including it in LocalSettings.
Usage[edit | edit source]
There are two code tags that you can use:
- Simple Tag Format: <'language'>source code here</'language'>
- Advanced Tag Format: <code ['language'|list] [n] >source code here</code>
Tag Examples
- simple code tag
<php> echo "Hello World"; </php>
- advanced code tag
<code php>
echo "Hello World";
</code>
- advanced code tag with line numbers
<code php n>
echo "Hello World";
</code>
- default code tag
<code>
echo "Hello World";
</code>
- display a list of supported languages
<code list></code>
Supported Languages[edit | edit source]
Documentation[edit | edit source]
See http://qbnz.com/highlighter/geshi-doc.html for the extensive documentation. GeSHi is used in a number of other software projects like
- Dokuwiki - An advanced wiki engine
- gtk.php.net - Their manual uses GeSHi for syntax highlighting
- WordPress - A powerful blogging system*
- PHP-Fusion - A constantly evovling CMS
- SQL Manager - A Postgres DBAL
- Mambo - A popular open source CMS
- MediaWiki - A leader in Wikis*
- TikiWiki - A megapowerful Wiki/CMS
- TikiPro - Another powerful Wiki based on Tikiwiki
- RWeb - A site-building tool
If you want to use it in OASIS projects besides this wiki, then start with the documentation.