Unify:Syntax Highlighting

''This page was created to keep track of changes to the wiki's syntax highlighting software. If I don't keep a log, I'll end up redoing it differently every time!'' --NCarter 16:30, 8 December 2008 (PST)

Improvements
I have been working on the wiki's syntax highlighting and have fixed several problems, some of which have been annoying me for a long time:


 * Tabs are now automatically rendered as four spaces instead of eight. To do this, I changed $header_type to GESHI_HEADER_DIV in extensions/geshi.php and set $tab_width to 4.  This means that syntax highlighted source code is now output in a div instead of a pre element.
 * The font is a little bigger, which means that it gets antialiased properly. This is controlled by the CSS for .csharp, .javascript, .boo and .shaderlab in the MediaWiki:Common.css page.
 * The syntax highlighter no longer tries to highlight other random divs that it finds in the page source. This was caused by the presence of "div" in the list of 'languages' in wiki/extensions/GeshiHighlight.php.  Removing it from the list fixed the problem.
 * Pragmas in Javascript appeared as ordered lists due to the above changes. This was caused by the same problem as the C-style comment problem below.  I fixed this by adding # as a comment type.  At some point, it would be better to add #pragma as a member of a new keyword group instead.

Outstanding problems
C-style comment closures */ which appear at the beginning of a line get turned into a ul bullet, and in some cases the italic comment style leaks onto the following lines. This is due to MediaWiki trying to interpret the asterisk as list formatting in its usual way. A bit of experimentation suggests the following:


 * Turning on line numbers fixes it but looks awful and messes up the style for the rest of the line. Might be OK with better styling for line numbers.
 * It might be possible to fix it by editing geshi.php to insert an empty element at the beginning of every line.

Until I come up with a solution, contributors will have to either put something before the asterisk (a space is fine) or to use // comments.

Fun stuff for future consideration
You can add  to $header_content in geshi.php to have it automatically display the language used for each code block. Given some nice styling that sets it apart from the rest of the block, this could be quite useful.