Difference between revisions of "MediaWiki/Syntax highlighting"

From Freephile Wiki
Jump to navigation Jump to search
(inital draft)
(No difference)

Revision as of 21:17, 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 a GeSHi Mediawiki 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:

  1. Simple Tag Format: <'language'>source code here</'language'>
  2. 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.