Oh, and it’s free (just a Creative Commons license).
And it works in both IE and Firefox*.
All it takes is a linked stylesheet and a CSS class on the target code section (specifying the language of the code), and Star-Light dynamically formats and colors it in the browser.
For example, this code:
<pre class="vbscript"> ' this is a "comment" '' so is 'this' DIM string string = "' string '" call msgbox("Hello ""Dean""!") FUNCTION getText(a, b, c) getText = a + b & cstr(c) END FUNCTION </pre>
' this is a "comment" '' so is 'this' DIM string string = "' string '" call msgbox("Hello ""Dean""!") FUNCTION getText(a, b, c) getText = a + b & cstr(c) END FUNCTION
Coolest of all, though, it’s highly extensible via language modules. I glanced through the code to see if I could make it support VBScript. The engine is pretty complicated, but each module is a simple HTC file.
From there, it was easy to create a new module for VBScript and plugin the appropriate keywords straight from Microsoft’s Windows Script 5.6 Documentation. I sent my VBScript module (working above) to Dean — he made a couple improvements, and said he’ll include it with the rest soon. (I may also create modules for VB6 or VB.Net, but there’s a lot stuff to those languages…)
I don’t mean to gush, but: Very Cool.
Unfortunately, Dean hasn’t yet documented how to do write your own module (I figured it out on my own), but it’s pretty easy for someone who knows HTCs and has a language reference to copy/paste.
* Another gee-whiz bit: despite the coolness of DHTML Behaviors, they are normally only supported by Internet Explorer. But Dean’s done a wonder, and written a Mozilla XBL wrapper which makes Mozilla/Firefox support DHTML Behaviors too! (which is of course wrapped into Star-Light). This situation should be the poster child for the de-facto standards camp -vs- the slow academic W3C types, but more on that another day. Meanwhile, I’ll sit back and regret my rationale “DHTML Behaviors are IE-only anyway, so I’ll go ahead and use all this other IE-specific code.” Like, uh, VBScript….. (dough!)