cfCodePress - Custom Tag For Real Time Code Coloring

Over the past few days I've thrown together a custom tag implementation of CodePress.

Here's an abbreviated description of CodePress taken from their site:

CodePress is web-based source code editor with syntax highlighting written in JavaScript that colors text in real time while it's being typed in the browser.

Features

  • Real-time syntax highlighting » just write some code
  • Code snippets » on PHP example type "if" and press [tab]
  • Auto completion » simple type " or ( or ' or [ or { on any example below (except Plain Text)

What makes this tag cool is that you can now drop a nicely formatted block of code or a real time syntax highlighting code editor into your application with a single line of code.

Check this out (go ahead, type some code):

Update: Arg...Demo appears to not work here after the first time I hit the page...

Check this demo instead...

Update 2: OK...it works intermittently here in the blog post...weird...


There are a few bugs with it - which is why I'm just previewing and not releasing the tag just yet. First and most obviously you see that when I drop my demo page as an include in BlogCFC the editor does not seem to be obeying the line breaks in the code I load initially into the editor. Check out the demo outside of my stylesheet to see a properly formatted block (anyone see anything in my stylesheet that could be goofing it?).

Secondly - I've integrated the CodePress SQL, HTML and CSS templates into the CF version - and it tends to get a little goofy. For example type a comment with an SQL keyword in it and it will highlight the SQL keyword. Anyone really good with RegEx that wants to take a look at overcoming these issues?

There is also an API to toggle line numbers, etc that I plan on exposing with the final release of the code.

Comments
Pretty neat...or at least on the way there, he he. You should talk to Ben Nadel about the RegEx - he is pretty damn good at it.
# Posted By Boyan | 7/5/07 3:50 PM
My ears are burning... did some mention my name???
# Posted By Ben Nadel | 7/5/07 4:38 PM
Hey Ben - did you get my email on this last night?
# Posted By todd sharp | 7/6/07 8:14 AM
You probably didn't get the email about this comment since it threw an SMTP error....

sheesh..
# Posted By todd sharp | 7/6/07 8:17 AM
I sent you a response... did you get that one? My GMail hosted email is funny sometimes I think.
# Posted By Ben Nadel | 7/6/07 9:45 AM
Yeah I got it - cool - thanks!
# Posted By todd sharp | 7/6/07 12:22 PM
very cool

thanks
# Posted By ivan | 7/6/07 2:42 PM

cfunited08

cfunited08

Calendar

Sun Mon Tue Wed Thu Fri Sat
    123
4 5 6 7 8 9 10
11 12 13 14 15 16 17
18 19 20 21 22 23 24
25 26 27 28 29 30 31

Subscribe

Enter your email address to subscribe to this blog.

Tags

actionscript ajax blogging cfsnippets coldfusion flash forms flex misc model-glue off topic personal project learn sql

Recent Comments

Hosting Advice Needed
todd sharp said: Must have been on a box that I'm not on. Thank goodness too, because all of my sites (this blog, cf... [More]

Hosting Advice Needed
Oğuz Demirkapı said: No. And the tickets are still open in support system. :) I think they had a big outage and still ... [More]

Hosting Advice Needed
todd sharp said: Did they say what caused such a long outage? [More]

Hosting Advice Needed
Oğuz Demirkapı said: VPS is back after 13 hours. :) [More]

Hosting Advice Needed
Oğuz Demirkapı said: 12 hours now since the server is down. :( [More]

RSS


coldfusionbloggers

FullAsAGoog MXNA

Consumed By Feed-Squirrel.com