CodeMirror is a JavaScript library that can be used to create a relatively pleasant editor interface for code-like content ― computer programs, HTML markup, and similar. If a parser has been written for the language you are editing (see below for a list of supported languages), the code will be coloured, and the editor will help you with indentation.
To get a look at CodeMirror, see the test pages for the various parsers...
Or take a look at some real-world uses of the system...
12-11-2009: Version
0.65: Add support for having both line-wrapping and line-numbers
turned on, make paren-highlighting style customisable
(markParen
and unmarkParen
config options),
work around a selection bug that Opera reintroduced in
version 10.
23-10-2009: Version
0.64: Solves some issues introduced by the paste-handling changes
from the previous release. Adds setSpellcheck
,
setTextWrapping
, setIndentUnit
,
setUndoDepth
, setTabMode
, and
setLineNumbers
to customise a running editor. Introduces
an SQL parser. Fixes a few small
problems in the Python parser.
And, as usual, add workarounds for various newly discovered browser
incompatibilities.
31-08-2009: Version 0.63: Overhaul of paste-handling (less fragile), fixes for several serious IE8 issues (cursor jumping, end-of-document bugs) and a number of small problems.
30-05-2009: Version
0.62: Introduces Python
and Lua parsers. Add
setParser
(on-the-fly mode changing) and
clearHistory
methods. Make parsing passes time-based
instead of lines-based (see the passTime
option).
04-03-2009: Version
0.61: Add line numbers support (see lineNumbers
option in manual). Support a mode where tab
'shifts' indentation instead of resetting it (see
tabMode="shift"
). Add indentUnit
option to
configure indentation depths. Make it possible to grab the editor's
keyboard input, which is useful when popping up dialogs (see
grabKeys
/ungrabKeys
). Fix a lot of small
bugs, among which the various issues related to pasting in Internet
Explorer.
At this time, the following browsers are supported:
Making it work on other browsers that have decent support for the W3C DOM model should not be too hard, but I am not actively testing against those.
All of CodeMirror is released under a zlib-style license. To get it, you can download the latest release or the current development snapshot as zip files, or use git to get the repository:
git clone http://marijn.haverbeke.nl/codemirror/.git
This second method is recommended if you are planning to hack on CodeMirror ― it makes it easy to record your patches and share them with me. CodeMirror can also be found on GitHub: http://github.com/marijnh/CodeMirror.
There is a Google group (a sort of mailing list/newsgroup thingy) for discussion and news related to CodeMirror. You can also e-mail me directly: Marijn Haverbeke.