Real-Time Syntax highlighting for HTML…


Bah… I’ve been digging around the web for a couple of days now, and I’m getting frustrated, so I thought I would share my pain with you

Here’s the scenario (and see if you can spot my key mistake here, it will be pretty obvious to most developers who have worked with customers before);
In a system I’ve written, the user’s have the ability to enter HTML formatted text into various areas of the application. People liked that… they could bold pieces of text, insert hyperlinks etc… but it was just plain-text entry (just multi-line textboxes, baby!)…. well, eventually (as you might have expected) people wanted a ‘richer’ HTML editing experience. First pass, I gave them (through the coding genius of Kent Sharkey) the ability to launch their HTML editor of choice (whatever is registered on their machine to edit HTML), giving them all the features of Front Page or VS.NET to edit their HTML snippets. Still, the users wanted richer edting right in the application… fine, second pass I gave them Nikhil’s HTML design time editor… but they want HTML editing, not design-time…. so here I am…. heading down the path of writing Front Page’s HTML editor…

I’m hoping to just give them basic syntax highlighting (real-time) like w.bloggar does would be enough to me… and I’m currently investigating an article I found on Code Project (which is available here)… and a really full-featured 3rd party control from Actipro… but I’m leaning to the Code Project sample more, because I get to play with the code and I don’t have to ask my boss for $$ for a new control 🙂

Comments (3)

  1. Sascha says:

    Did you have a look at RichTextBox (http://sourceforge.net/projects/freetextbox/)? You get a complete, fully customizable HTML editor with image upload functionality – all for free and with full source code… I love this control, it’s really simple to insert into existing projects. dasBlog uses it for standard text input and I added it to my BlogX solution.

  2. Sascha, thanks for the comment but freetextbox is a web control and it doesn’t do HTML syntax highlighting, but it certainly looks polished 🙂

  3. Grant says:

    Tell me about it! I’ve been there. Have you had a look at http://www.icsharpcode.net/OpenSource/SD/? The project SharpDevelop is a C# IDE. It’s a lot like VS.NET but it is open source and the Text control is easy to use as a stand alone assembly. I used it for SQL syntax highlighting in a recent project and it worked very well. It’s a .NET Framework project written in C# so I don’t know if it will help at all.

    Cheers,

    Grant