1. 5
CodeMirror (Source) Syntax Highlighting
55 (7 votes)

39331 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.4 4.3 4.2 4.1 4.0

Version: 1.12 - Download

Show notes
  • Bug fixes

Version: 1.10 - Download

Show notes

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


unknown compatibilitycompatiblecompatibleincompatibleincompatible

Version: 1.06 - Download

Show notes

Upgraded to CodeMirror 3.13

Added Support for the Inline Source Dialog

Bug fixes


unknown 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 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.
  1. THANK you very much for your excellent work!

  2. Hans-Jürgen Petrich's picture

    Hans-Jürgen Petrich


    Great Plugin, Thx!
    But it seems to get in trouble when loading with 2 or more editors at the same time and switching between them from wysiwyg to source-code-view. Can you fix this?

    • Fixed Version 1.01 is online

  3. This might just be a Drupal issue, but when I install this plugin into my CKEditor I'm finding that if I edit the source of a page and click Drupal's save button none of the changes are saved.  I have to exit the source view and then click save in order for the changes made to the source to be applied to the page.

    • New Version 1.02 is online should be fixed now

      • Works now.  Thanks so much for the quick update.

  4. nonintanon's picture



    This is cool. Thank you :)

  5. dadou76's picture



    Il n'y a pas de doc pour l'installation ?

    • Appui sur le bouton "Add to my editor", "Build my editor" (à droite), ensuite "Download" sur la page suivante. Press the "Add to my editor" button, "Build my editor" (to the right), then "Download" on the following page.

  6. Shane Yu's picture

    Shane Yu



    Thank you very much for this briliant plugin...I was just thinking about how I would integrate codemirror with the editor when I came across this editor.

    I have been looking in depth at your plugin code trying to determine how to modify it to add different features such as autoformatting. I've added the 'formatting.js' file like the other ones at the top of the file. However I've not had any luck with the actual formatting of it.

    I've been attempting two things...

    1. I want the editor to autoformat the code everytime the user switches into source mode.
    2. I want to setup a shortcut, say 'Ctrl-K' to comment the currently selected text
    3. 'Ctrl-Shift-K' to uncomment currently selected text
    4. 'Ctrl-Shift-F' to autoformat currely selected text


    Sadly I've not had much luck because the commands don't appear to work, in chrome pressing ctrl-k just focuses on the addressbar and enters a '?' symbol. Something doesn't seam right.

    Another thing is that I've placed alerts where the mode changes between source and wysiwyg but they are never fired, therefore I am unsure where to perform the auto formatting.

    Any help would be greatly appriciated...


    Shane Yu

  7. 1 2 3 4 5 6 7 8 9 > >>