26 November 2011

Introducing TWiki Markup Syntax Highlighting in gedit

I spend a lot of time at work editing wiki pages in a TWiki wiki. TWiki has you editing pages in a HTML textarea or a web based WYSIWYG editor, so I long ago started using the It's All Text! Firefox Add-on to edit wiki pages using gedit, the official GNOME text editor (Note that I run Ubuntu 10.04 as my work desktop). That was good, but I found myself wishing for syntax highlighting, and there wasn't anything suitable available. I decided to write a GtkSourceView Language Definition to enable syntax highlighting of TWiki markup in gedit, and I am pleased to announce that it is now ready for use.

The code (just a single file, twiki.lang) is open source (GPL, like gedit) and is hosted in a GitHub repository: https://github.com/darryllawson/gedit-twiki. The README available at that link has installation instructions and information on configuring the It's All Text! Firefox Add-on for use with gedit.

You might be wondering why TWiki syntax highlighting is useful? Here are a few reasons:
  • By highlighting headings, document navigation is easier.
  • By highlighting markup elements, it's easier to visualise formatting and detect syntax errors. For example, you'll know when you accidentally typed four spaces instead of the requisite three.
  • By highlighting wiki words, you'll know straight away if you have typed a valid one, and it'll also be obvious when you need to escape one.
Hopefully someone else finds this useful!