# { } CodeMirror

    /* In-browser code editing
       made bearable */

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 mode has been written for the language you are editing, the code will be coloured, and the editor will optionally help you with indentation.

This is the project page for CodeMirror 2, the currently more actively developed, and recommended version. CodeMirror 1 is still available from here.

## Supported modes:

- JavaScript
- XML/HTML
- CSS
- HTML mixed-mode
- Python
- PHP
- diff
- C, Java, and similar
- sTeX, LaTeX
- Haskell
- Smalltalk
- reStructuredText
- PL/SQL

## Usage demos:

- Autocompletion
- Mode overlays
- Search/replace
- Auto-resizing editor
- Setting breakpoints
- Highlighting the current line

## Getting the code

All of CodeMirror is released under a MIT-style license. To get it, you can download the latest release or the current development snapshot as zip files. To create a custom minified script file, you can use the compression API.

We use git for version control. The main repository can be fetched in this way:

    git clone http://marijnhaverbeke.nl/git/codemirror2

CodeMirror can also be found on GitHub at marijnh/CodeMirror2. If you plan to hack on the code and contribute patches, the best way to do it is to create a GitHub fork, and send pull requests.

## Documentation

The manual is your first stop for learning how to use this library. It starts with a quick explanation of how to use the editor, and then describes all of the (many) options and methods that CodeMirror exposes.

For those who want to learn more about the code, there is an overview of the internals available. The source code itself is, for the most part, also well commented.

## Support and bug reports

There is a Google group (a sort of mailing list/newsgroup thing) for discussion and news related to CodeMirror. Reporting bugs is best done on github. You can also e-mail me directly: Marijn Haverbeke.

## Supported browsers

The following browsers are able to run CodeMirror:

- Firefox 2 or higher
- Chrome, any version
- Safari 3 or higher
- Internet Explorer 6 or higher
- Opera 9 or higher (with some key-handling problems on OS X)

I am not actively testing against every new browser release, and vendors have a habit of introducing bugs all the time, so I am relying on the community to tell me when something breaks. See here for information on how to contact me.

Download the latest release

## Make a donation

- Paypal
- Bank

Bank: Rabobank
Country: Netherlands
SWIFT: RABONL2U
Account: 147850770
Name: Marijn Haverbeke
IBAN: NL26 RABO 0147 8507 70

## Releases:

28-03-2011: Version 2.0:

CodeMirror 2 is a complete rewrite that's faster, smaller, simpler to use, and less dependent on browser quirks. See this and this for more information.

28-03-2011: Version 1.0:

- Fix error when debug history overflows.
- Refine handling of C# verbatim strings.
- Fix some issues with JavaScript indentation.

22-02-2011: Version 2.0 beta 2:

Somewhate more mature API, lots of bugs shaken out.

17-02-2011: Version 0.94:

- `tabMode: "spaces"` was modified slightly (now indents when something is selected).
- Fixes a bug that would cause the selection code to break on some IE versions.
- Disabling spell-check on WebKit browsers now works.

08-02-2011: Version 2.0 beta 1:

CodeMirror 2 is a complete rewrite of CodeMirror, no longer depending on an editable frame.

19-01-2011: Version 0.93:

- Added a Regular Expression parser.
- Fixes to the PHP parser.
- Support for regular expression in search/replace.
- Add `save` method to instances created with `fromTextArea`.
- Add support for MS T-SQL in the SQL parser.
- Support use of CSS classes for highlighting brackets.
- Fix yet another hang with line-numbering in hidden editors.

17-12-2010: Version 0.92:

- Make CodeMirror work in XHTML documents.
- Fix bug in handling of backslashes in Python strings.
- The `styleNumbers` option is now officially supported and documented.
- `onLineNumberClick` option added.
- More consistent names `onLoad` and `onCursorActivity` callbacks. Old names still work, but are deprecated.
- Add a Freemarker mode.

11-11-2010: Version 0.91:

- Adds support for Java.
- Small additions to the PHP and SQL parsers.
- Work around various Webkit issues.
- Fix `toTextArea` to update the code in the textarea.
- Add a `noScriptCaching` option (hack to ease development).
- Make sub-modes of HTML mixed mode configurable.

Older releases...