» Birthday Bundle - Over $400 worth of Envato files for just $20

Code Editor with Realtime Syntax Highlighting: JS-CodeEdit

Posted on January 5, 2010, Filled under JavaScript,  Bookmark it

JS-CodeEdit is a JavaScript editor that converts your HTML textareas into a code editor with realtime syntax highlighting. If added into a form, the content can be submitted e.g. to be written to a file. A nice thing is that you can add as many editors as you want within a HTML page.

Currently the code editor supports the following languages: PHP, JavaScript, HTML, CSS.

Generally, this code editor should work on Windows with IE 5+ and with browser using the Mozilla 1.3+ engine (browsers that support “designMode”).

How to use it?

1) Include the codeedit.js library in the HTML page
2) Edit any textarea that contains code in it:
<textarea name="myEditor1" class="codeedit php linenumbers" wrap="off" cols="80" rows="20">[php code here]</textarea>

Note: For the class name the first values should be ‘codeedit’ followed by the language you want to highlight: (either php, javascript, html or css).

Do you wish to receive the latest updates as soon as they are posted? Get our RSS Feed or Subscribe to the Newsletter!

Get our RSS Feed!

2 Replies to "Code Editor with Realtime Syntax Highlighting: JS-CodeEdit"

  1. I just wanted to say awesome job! I really like this.

    I have some future suggestions:
    Create a customizable way to add in key words of a language and be able to format individual key words i.e. whether you would like an individual key word to be blue, green, bold or italicized etc.

    It would be nice to have these customized key word’s formats stored in CSS files.

    Speed up the approach to your algorithm so that even large files don’t take so much time in processing key words. Maybe cache already highlighted key words or chunk out areas of code which are to be processed by your highlighting search algorithm.

    1. O also extend the code so that more languages are available for highlighting… which it sounds like you might already be working on.

      Great JOB! I can’t wait to see this grow :D !!!!

Leave a Reply


* = required fields

  (will not be published)


XHTML: You can use these tags: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>

Note: If you want to post CODE Snippets, please make them postable first!
(e.g. <br /> should be converted to &lt;br /&gt;)