Unify:Syntax Highlighting

From Unify Community Wiki
Revision as of 17:32, 8 December 2008 by NCarter (Talk | contribs)

Jump to: navigation, search

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!

I have been working on the wiki's syntax highlighting and have finally fixed some problems 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.

There is at least one outstanding problem. For some reason, a C-style comment closure */ which appears at the beginning of a line gets turned into a ul bullet, and in some cases the italic comment style leaks onto the following lines. I can't see how to fix this, so for now the solutions are to either put something before the asterisk (a space is fine) or to use // comments.

Note to self - if you need to flush the page cache for the entire wiki, resaving LocalSettings.php does the trick.

--NCarter 09:22, 8 December 2008 (PST)

Personal tools