ColdFISH - the ColdFusion Integrated Syntax Highlighter Released!

The other day, Todd Sharp forwarded me a blog posting about a little known utility in ColdFusion for syntax highglighting. http://www.anujgakhar.com/2008/02/14/colored-code-with-coldfusion/

The fact is, that this internal utility was made for highlighting MXML not CFML. It seemed to me that there are a lot of syntax highlighters out there, but most of them are in JavaScript or extraordinarily heavy and difficult to implement. And even when they do highlight CF, they do it with color coding that is strange to me.

I didn't think it would be that hard to make a syntax highlighter... so, over the weekend I made one. :)

ColdFISH handles highlighting CFML, CFSCRIPT, HTML, Javascript, and Comments in each of those. It's not yet smart enough to do the highlighting of keywords, but I think it will do the trick for most of you. It's very fast (~50 ms for my 58 line test file), the color coding is easy to customize, and it generates simple HTML so you shouldn't have to worry about how it renders in various browsers.

Check out the ColdFISH project on RIAFORGE and let me know what you think!

Cheers, Jason

Comments
Mark Drew's Gravatar Code highlighting? What next? a full blown editor?
# Posted By Mark Drew | 2/27/08 1:23 PM
Jason's Gravatar Oh, believe me, I've thought about it! :)

I just had a coding itch I had to scratch, we'll see if anyone uses it. It sounded like it may make it into the next version of BlogCFC... :)

Jason
# Posted By Jason | 2/27/08 2:05 PM
joshua Cyr's Gravatar Funny I was just thinking how easy it would be to add to blogcfc when I read your comment.
# Posted By joshua Cyr | 2/27/08 2:07 PM
Luis Majano's Gravatar Nice Jason, on line 244, you have a bug on the character being a character class instead of a string.

I did the following to make it work:
newLine.append(character.tostring());
# Posted By Luis Majano | 2/27/08 4:42 PM
Todd Rafferty's Gravatar Thank you thank you thank you. One less scratch to itch for me. :)
# Posted By Todd Rafferty | 2/27/08 5:04 PM
Jason's Gravatar I'll probably have more than one bug along the way. :) But, like anything, if people use it and give feedback, it will get better. The code is updated on RIAForge.

Cheers, :)
Jason
# Posted By Jason | 2/27/08 6:36 PM
Luis Majano's Gravatar Thanks Jason!! really great little utility!!
Thanks again!!
# Posted By Luis Majano | 2/27/08 8:56 PM
jax's Gravatar Hi Jason,

I am not running CF 8 so I have modified coldfish in order to make it downwards compatible to CF 7.x
If you are interested, just send me an email.
# Posted By jax | 3/14/08 10:12 AM
BlogCFC was created by Raymond Camden. This blog is running version 5.9. Contact Blog Owner