Quicklook: Syntax highlighter for Drupal files (module, profile, theme, install, inc)

Updated version now on github! QLColorCode-extra

Note: added support for drupal make files!

For some time now I've been using the QLColorCode plugin for Quicklook, but it wasn't highlighting all drupal filetypes, so today I did some hacking and enabled highlighting for the following previously unsupported filetypes:

  • .make (requested by Decipher)
  • .module
  • .install
  • .profile
  • .install
  • .inc

The QLColorCode (orginial source) provides much better syntax highlighting than the inbuilt Source Highlighter, this is thanks to WebKit, Highlight, and the foresight of the Quick Look API designers.

Just drop my modified version of the plugin into /Library/QuickLook or ~/Library/QuickLook and bask in the glow of the beautiful syntax highlighting in all of the supported filetypes.. including all your Drupal files!

If you have Xcode installed

Xcode 3.2 (the version shipped with Snow Leopard) includes a Quick Look plugin that highlights source code. It only highlights a few languages, so you probably still want to use QLColorCode. However, the Quick Look server tends to pick the Xcode plugin over QLCC. This means that for any source code file aside from .c, .m, and the other languages that Xcode understands you'll see a plain text preview with no highlighting. To get QLCC to work properly you'll need to disable the Xcode plugin.

The XCode plugin is installed at:
/Developer/Applications/Xcode.app/Contents/Library/QuickLook/SourceCode.qlgenerator

The simplest way to disable it is to open Terminal.app and run these commands:
f=/Developer/Applications/Xcode.app/Contents/Library/QuickLook/SourceCode.qlgenerator
sudo mv $f $f.disabled

This will rename the plugin to SourceCode.qlgenerator.disabled, which will prevent it from being loaded by quicklookd.

Comments

No workee for me. I've disabled the XCode installed highlighter as instructed in the readme and I've copied the new plugin into both /Library/QuickLook and also tried ~/Library/QuickLook. Hitting space on a .module file doesn't open a highlighted box, just the usual file information.

Hi Tanc,
I've made an update and confirmed with 3 other people that it now works..

...the now-working download contains only three text files, nothing else.

Only 3 files:
ChangeLog.txt
LICENSE.txt
ReadMe.txt

Yeah. Just to repeat what the others have already said. The 'fixedv1.1' download does not actually contain the plugin file which is very confusing.

Sorry about that.. download updated again, should be fixed now..

this rocks, Brian… thanks!

I was curious to see exactly what changed, so I grabbed the original source QLColorCode-2.0.2.tgz and compared it to the modified version here. I created a gist that has the changes stored as a patch file:

https://gist.github.com/2667198

Thanks for this!

So if I just move QLColorCode to ~/Libraries/QuickLook and then do qlmanage -r, it previews my Drupal files (doesn't highlight them) but .txt files stop being previewed.

When I disable Xcode's SourceCode.qlgenerator, my Drupal files stop being previewed, but I do see code highlighting in the big generic file icon instead (which includes actual code as OSx does).

Not sure what I could try next.