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

Calendar

Sun Mon Tue Wed Thu Fri Sat
   1234
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 funny stuff javascript misc model-glue off topic personal project learn slidesix sql

Recent Comments

Chinese Birth Calendar Accuracy Test
mama to be said: ok so i will be 2 months shy of 18 when i have my baby. this calendar does not technically work for ... [More]

Fixing 'User Profile Service Failed The Logon' on Vista
Mike said: That fix worked although all i did was remove .bak and reset state to 0. User was able to log in to... [More]

Chinese Birth Calendar Accuracy Test
Melissa said: Wrong for my daughter, which it predicted to be a boy... we'll see for #2. Predicts a girl (maybe, f... [More]

Adding Auto Generated Code Downloads to BlogCFC
fweerw said: http://www.ibiblio.org/st... http://www.cambodia.ait.a...... [More]

Check Out The New SlideSix
Todd Sharp said: Thanks for the feedback Ben & Rachel! I'll keep it all in mind as I tweak things over the next ... [More]

RSS


adobe community experts

coldfusionbloggers

FullAsAGoog MXNA

Consumed By Feed-Squirrel.com