Extensible Code Editor
CodeMirror is a code editor component for the web. It can be used in websites to implement a text input field with support for many editing features, and has a rich programming interface to allow further extension.
This is a CodeMirror field, configured for editing JavaScript code.
Features
-
Accessibility
Works well with screen readers and keyboard-only users.
-
Mobile Support
Use the platform's native selection and editing features on phones.
-
Bidirectional Text
Support mixing of right-to-left and left-to-right text.
-
Syntax Highlighting
Color code to reflect syntactic structure.
-
Line Numbers
Display gutters with line numbers or other information next to the code.
-
Autocompletion
Provide language-specific completion hints in the editor.
-
Code Folding
Temporarily hide parts of the document.
-
Search/Replace
Editor-specific search, regexp search, and replace functionality.
-
Full Parsing
Detailed parse trees allow many types of language integration.
-
Extension Interface
Robustly implement demanding editor extensions.
-
Modularity
Most features are implemented on top of a generic public API.
-
Speed
Remains responsive even on huge documents and long lines.
-
Bracket Closing
Automatically insert matching brackets during typing.
-
Linting
Show error and warning messages in the editor.
-
Flexible Styling
Mix font styles and sizes, add widgets in the content.
-
Theming
Import or create custom visual editor styles.
-
Collaborative Editing
Allow multiple users to edit the same document.
-
Undo History
Undo and redo functionality with collab editing support.
-
Multiple Selections
Select and edit multiple ranges of the document at once.
-
Internationalization
Provide custom text to display or announce to the user.
-
...and more
Find a full description of the library's features in the docs.
About
CodeMirror is open source under a permissive license (MIT). It is being developed on GitHub. Contributions are welcome.
If you are using CodeMirror commercially, there is a social (but no legal) expectation that you help fund its maintenance. Start here.
The library supports browsers up from Internet Explorer 11 (with some polyfills).
Discussing the project, or asking questions, is best done on the forum. Bugs should be reported through the issue tracker. We aim to be an inclusive, welcoming community. To make that explicit, we have a code of conduct that applies to communication around the project.
Language Support
A full parser package, often with language-specific integration and extension code, exists for the following languages:
There is also a collection of CodeMirror 5 modes that can be used, and a list of community-maintained language packages. If your language is not listed above, you may still find a solution there.
Sponsors
These wonderful companies and organizations help fund development and maintenance of CodeMirror.