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

Category: 
Announcements
Tags: 
drupal planet, drupal

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:
  1. f=/Developer/Applications/Xcode.app/Contents/Library/QuickLook/SourceCode.qlgenerator
  2. sudo mv $f $f.disabled
This will rename the plugin to SourceCode.qlgenerator.disabled, which will prevent it from being loaded by quicklookd.
File/s: 
QLColorCode-2.0.2-drupal-highlighting(fixedv1.2).zip

Feedback

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.

Submitted by Tanc on April 26, 2011 - 5:25pm

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

Submitted by Brian Gilbert on April 27, 2011 - 7:12am

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

Submitted by Roderik Muit on May 22, 2011 - 8:26am

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

Submitted by Jason on May 24, 2011 - 12:53am

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.

Submitted by Zach Harkey on May 25, 2011 - 1:17pm

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

Submitted by Brian Gilbert on June 26, 2011 - 4:53pm

this rocks, Brian… thanks!

Submitted by Scott Rigby on August 20, 2011 - 12:34am

I was curious to see exactly what changed, so I grabbed the original source <a href="https://code.google.com/p/qlcolorcode/downloads/detail?name=QLColorCode-... 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!

Submitted by James Wilson on May 13, 2012 - 1:49am

So if I just move QLColorCode to <code>~/Libraries/QuickLook</code> and then do <code>qlmanage -r</code>, 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.

Submitted by Danny on April 4, 2013 - 1:20pm

Add new comment