n8blog
distraction in action

Like my work? Check out HexaLex, my game for iPhone & iPod Touch. It's a crossword game like Scrabble, but played with hexagonal tiles. http://www.hexalex.com

One of the features I’ve really liked in Leopard has been Quick Look. It’s a really nice way to browse files quickly, without opening up a bunch of random apps. However, the QL plugin that Apple provides for reading source code is, well, just plain boring. You just get the text, in black & white. We all know how nice syntax highlighting is, so why didn’t they give us some of that?

Well, it turns out to be trivially easy to do a QL plugin that renders HTML. Mix in Pygments, the very capable syntax highlighting engine that can output HTML, and you’ve got a syntax highlighting QL plugin in under 100 lines of code!

A Small Snapshot of QLColorCode

Rather than host this project myself I’ve decided to try making a Google Code project. You can find it here:

http://code.google.com/p/qlcolorcode/

Enjoy!

  • Share/Bookmark

  Comments:

1. Micke Lax replies:

So nice!

Was looking for something like this. Is it possible to get it ot work with .sml and .erl files as well?

2. n8 replies:

Is that Standard ML and Erlang? It looks like pygments supports Erlang, but not SML. I’ll try to remember to add a UTI for it for the next release, but it would help if you filed a bug to remind me.

3. Micke Lax replies:

Yes, Standard ML and Erlang.

4. Dev Brown replies:

Hi, fantastic plugin! Any plans to add SQL? Thanks

5. n8 replies:

Ok, I’ve *probably* added SML, Erlang, and SQL, but I’m not sure if they work. If you want me to add a language it would be helpful if you provided:

a) The name of the language (duh)
b) Any file extensions that the language uses
c) The name of the organization responsible for the language
d) Any major Mac application that registers a handler for the file type

I need this stuff so I can figure out how to make a UTI (Universal Type Identifier) that registers the file extension as being source code. If you can somehow find an *existing* UTI (that’s what (d) is for) then you can make my job *much* easier.

6. Dev Brown replies:

Hi and thanks, as for SQL and d), DbVisualizer will register .sql files. It is a popular commercial, java-based SQL Query tool.

7. Dev Brown replies:

Is the updated plugin posted btw or are you still testing? Thanks!

8. n8 replies:

Not yet. I’m hoping to get it out later today or tomorrow.

If you can e-mail me the Info.plist file from DbVisualizer it would be helpful. n8 /at/ n8gray [dot] org

9. Dev Brown replies:

Done!

[...] There’s a new QLColorCode out. Two actually! Soon after releasing 0.2 I found a few annoying problems so I went ahead and released 0.3. [...]

11. Dev Brown replies:

Sweet, thanks!

[...] of you have probably noticed that I’ve been neglecting some of my other projects and complaining about being busy a lot lately. Well here’s what I’ve [...]

XHTML: You can use these tags: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong> <pre lang="" line="" escaped="">

Please type this word with the letters reversed: live

Like my work? Check out HexaLex, my game for iPhone & iPod Touch. It's a crossword game like Scrabble, but played with hexagonal tiles. http://www.hexalex.com