1. 5
CodeMirror (Source) Syntax Highlighting
55 (7 votes)
85596 downloads codemirror
  • Add to my editor
  • Download


    The recommended way to install all CKEditor add-ons is to create a custom build by using CKBuilder. To do that, click the Add to my editor button on the plugin page. When you are done, click the Build my editor button on the right side of the page to go to CKBuilder.

    Add-on Installation Instructions

    If you want to add the plugin manually, you will need to:

    1. Extract the downloaded plugin .zip into the plugins folder of your CKEditor installation. Example:
    2. Enable the plugin by using the extraPlugins configuration setting. Example:
      config.extraPlugins = 'codemirror';
    3. Download and configure all its dependencies, too.

    Add-on Dependencies

    No additional dependencies.

    Note: The plugin may have additional requirements. Check the add-on page and documentation for more details.

CodeMirror (Source) Syntax Highlighting


Syntax Highlighting for the CKEditor (Source View and Source Dialog) with the CodeMirror Plugin

The Full Theme List can be found here: http://codemirror.net/demo/theme.html

Download latest Version

Available Shortcuts

  • 'Ctrl-K' to comment the currently selected text
  • 'Ctrl-Shift-K' to uncomment currently selected text
  • 'Ctrl-Alt-K' to auto format currently selected text
  • 'Ctrl-Q' Expand/Collapse Code Block
  • 'Ctrl-F' to perform a search
  • 'Ctrl-G' to find next
  • 'Ctrl-Shift-G' to find previous
  • 'Ctrl-Shift-F' to find and replace
  • 'Ctrl-Shift-R' to find and replace all



  1. Extract the contents of the file into the "plugins" folder of CKEditor.
  2. In the CKEditor configuration file (config.js) add the following code:
config.extraPlugins = 'codemirror';

If you are using CKEditor in inline mode you also need to add the sourcedialog to the extra Plugins list

config.extraPlugins = 'sourcedialog,codemirror';

To Configure the Plugin the following options are available...

config.codemirror = {

    // Set this to the theme you wish to use (codemirror themes)
    theme: 'default',

    // Whether or not you want to show line numbers
    lineNumbers: true,

    // Whether or not you want to use line wrapping
    lineWrapping: true,

    // Whether or not you want to highlight matching braces
    matchBrackets: true,

    // Whether or not you want tags to automatically close themselves
    autoCloseTags: true,

    // Whether or not you want Brackets to automatically close themselves
    autoCloseBrackets: true,

    // Whether or not to enable search tools, CTRL+F (Find), CTRL+SHIFT+F (Replace), CTRL+SHIFT+R (Replace All), CTRL+G (Find Next), CTRL+SHIFT+G (Find Previous)
    enableSearchTools: true,

    // Whether or not you wish to enable code folding (requires 'lineNumbers' to be set to 'true')
    enableCodeFolding: true,

    // Whether or not to enable code formatting
    enableCodeFormatting: true,

    // Whether or not to automatically format code should be done when the editor is loaded
    autoFormatOnStart: true,

    // Whether or not to automatically format code should be done every time the source view is opened
    autoFormatOnModeChange: true,

    // Whether or not to automatically format code which has just been uncommented
    autoFormatOnUncomment: true,

    // Define the language specific mode 'htmlmixed' for html including (css, xml, javascript), 'application/x-httpd-php' for php mode including html, or 'text/javascript' for using java script only
    mode: 'htmlmixed',

    // Whether or not to show the search Code button on the toolbar
    showSearchButton: true,

    // Whether or not to show Trailing Spaces
    showTrailingSpace: true,

    // Whether or not to highlight all matches of current word/selection
    highlightMatches: true,

    // Whether or not to show the format button on the toolbar
    showFormatButton: true,

    // Whether or not to show the comment button on the toolbar
    showCommentButton: true,

    // Whether or not to show the uncomment button on the toolbar
    showUncommentButton: true,

    // Whether or not to show the showAutoCompleteButton button on the toolbar
    showAutoCompleteButton: true,
    // Whether or not to highlight the currently active line
    styleActiveLine: true


Plugin versions CKEditor versions
4.5 4.4 4.3 4.2 4.1 4.0

Version: 1.14 - Download

Show notes
  • Upgraded to latest CodeMirro
  • Bug fixes

Version: 1.12 - Download

Show notes
  • Bug fixes
unknown compatibilitycompatibleincompatibleincompatibleincompatibleincompatible

Version: 1.10 - Download

Show notes

- upgraded to codemirror 3.20
- added support for the textselection plugin


unknown compatibilityunknown compatibilitycompatiblecompatibleincompatibleincompatible

Version: 1.06 - Download

Show notes

Upgraded to CodeMirror 3.13

Added Support for the Inline Source Dialog

Bug fixes


unknown compatibilityunknown compatibilityunknown compatibilityunknown compatibilitycompatiblecompatible

Version: 1.04 - Download

Show notes


  • Upgraded to CodeMirror 3.1
  • Moved all codemirror customizations to additional files
  • Using combined and minfied js and css files
  • Tiny fixes
unknown compatibilityunknown compatibilityunknown compatibilityunknown compatibilityunknown compatibilitycompatible


  • carousel
  • carousel
Log in to rate this plugin


Post a comment
  1. The content of this field is kept private and will not be shown publicly.
  2. *  Required fields
  1. Great plug-in!  Thank you for building it!

  2. Grea plugin, I love syntax highlighting

  3. There's an error in codemirror/plugin.js. Line 92 needs comma removed after "codeMirrorTheme".

  4. I have a bug when including this plugin

    We use CK in an Ajax enviroment, and we use the create and destroy function.... after 29 times, IE crashes 

    When we removed this plugin form a fresh CK 4.1 or 4.03 we had no more memory leak

    I contact the CKteam and the have confirmed the problem with your Plugin ~

    can you please provide a fix:


    here a sample code to replicate a user opening and closeing ck 40 times note plenty of time is given for create and destrpy to run


    <!DOCTYPE html>
        <meta charset="utf-8">
    <body><a onclick="createEditor()">Reload editor in inf loop</a><br>
        reloaded: <span id="number">30</span> times<br>
        <textarea id="textarea"></textarea><script src="ckeditor/ckeditor.js"></script><script>var count = 0; function createEditor() { CKEDITOR.replace('textarea', { on: { instanceReady: function (evt) { count++; document.getElementById('number').innerHTML = count; setTimeout(function () { evt.editor.destroy(); setTimeout(function () { createEditor(); }, 500); }, 500); } } }) }</script></body></html>

    • should be fixed now, new version is online.

      • Thank you the new version fixed the problem !


        That was so quick Tks !

  5. I have a minor issue that I hope can be solved easily.  I am using this plugin on a WordPress site and I believe I have found a small bug.  The HTML formatter is adding a new line before and after inline tags.

    I can't post the pictures here.  You can see the original post on the CKEditor site (Your plugin page)


    The pictures show what is going on.  I am using 4.1.1 with the latest version of your plugin.

    Edit:  Just a quick question, is code mirror doing the reformatting or is ckeditor?  When I get a chance, I will fire it up in NetBeans and see if I can find the issue with the debugger.

    Any ideas?

    • Turn off autoformatting in the codemirror settings in the editor config

      config.codemirror : {
      autoFormatOnStart: false,
      autoFormatOnModeChange: false} 

  6. It is possible to release a version for CKEditor 4.2?

    In CKEditor 4.2 I can't see Icons, if I download a package with the builder.

    A PHP highlighting would be greatful

    Thank you!

    • Download the plugin manually from the Github page.

      The CKBuilder doesnt work it doesnt include all files. And i also can not upload new versions here because that is also broken.

  7. 1 2 3 4 5 > >>