Textarea that can do syntax highlighting on the fly?
I am storing a number of HTML blocks inside a CMS for reasons of easier maintenance. They are represented by
It’s not possible to achieve the required level of control over presentation in a regular textarea.
First, you can take a look to this article:
For more, here is some tools that seem to fit with your request:
I would recommend EditArea for live editing of a syntax hightlighted textarea.
Update: Bespin is now ACE, which is mentioned by the highest rated answer here. Use ACE instead.
Gotta go with Bespin by Mozilla. It’s built using HTML5 features (so it’s quick and fast, but doesn’t support legacy browsers though), but definitely amazing to use and beats everything I’ve come across – probably beacause it’s Mozilla backing it, and they develop Firefox so yeah… There’s also a jQuery Plugin which contains a extension for it to make it a bit easier to use with jQuery.
The only editor I know of that has syntax highlighting and a fallback to a textarea is Mozilla Bespin. Google around for embedding Bespin to see how to embed the editor. The only site I know of that uses this right now is the very alpha Mozilla Jetpack Gallery (in the submit a Jetpack page) and you may want to see how they include it.
There’s also a blog post on embedding and reusing the Bespin editor that may help you.