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





 

Installation

  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
};

Screenshots

codemirror

524,856 downloads (view stats)

Releases

Plugin versions CKEditor versions
4.24 4.23 4.22

Version: 1.18.7

DownloadRelease notes

  • Upgraded to CodeMirror 5.65.12
  • added support for textselection plugin in the sourcedialog

Insert Symbol

This is a modified version of Frederico Knabben's specialCharacter plugin. It gives the user the possibility to insert most unicode symbols. All characters have been divided into groups (sort of the way word does it). I am still working on the tooltip texts for all characters - and so far it is only (partly) done in english.

The dialog can be modified to only list groups that you want. Sorting of the groups can be done in two different ways. Default group can be changed.

In order to add the plugin to your CKEditor add the following line:

config.extraPlugins = 'symbol';

Let me know what you think... If you have any suggestions then write to me (helmoe@gmail.com)

Screenshots

symbol

93,080 downloads (view stats)

Releases

Plugin versions CKEditor versions
4.24 4.23 4.22

Version: 1.07

DownloadRelease notes

Changelog:

1.07 - 24 may 2013

  • changed widths: ['100%'] to width: '100%' for better chrome support (on MAC?)
  • a little more cleanup in en.js
  • UniCode combobox list now remembers range when reopened

1.06 - 1 february 2013

  • updated symbol plugin to work with CKEditor 4.0
  • - en.js file cleanup (not finished yet...)

1.05 - 25 november 2011

  • added sortSymbolRangesAlphabetically which allows sorting the symbol ranges alphabetically
  • added defaultSymbolRange which specifies the symbol range to startdisplaying

1.04 - ? ? 2011

  • always turn symbol action on in toolbar

1.03 - 5 september 2011

  • fixed tooltip error not showing correct text

1.02 - 5 september 2011

  • fixed the removeSymbolRanges list so when defined in the config (config.removeSymbolRanges = [1,2,3];) it removes range 1, 2 and 3
  • updated symbol names in en.js 

1.01 - 12 may 2011

  • fixed startup problem in IE 9.0
  • updated symbol names in en.js

1.00 - 24 March 2011

  • Initial release

 

Setup:

/**
  * The list of special characters to remove from the Symbol dialog.
  * NB: THEY HAVE TO BE IN ASCENDING ORDER (ORELSE OFFSETS WILL BE WRONG)!!!
  * @type Array
  * @example
  * config.removeSymbolRanges = [ 1, 9, 11 ]; //In order to remove 'Basic Latin', Cyrillic' and 'Armenian' ranges
  */
//CKEDITOR.config.removeSymbolRanges = [1,9,11];

/**
  * Sort the symbol names in the combobox alphabetically.
  * @type Boolean
  * @example
  * config.sortSymbolRangesAlphabetically = true; //In order to sort symbolRange-names alphabetically in the dropdown list
  */
//CKEDITOR.config.sortSymbolRangesAlphabetically = true;

/**
  * The default symbolRange to display when the dialog is opened. If defaultSymbolRange is not defined 'Basic Latin' will be used.
  * If defined but not present in the symbolRanges then index 0 in the symbolRanges will be used as default.
  * @type String
  * @example
  * config.defaultSymbolRange = 'Latin Extended-B'; //The 'Latin Extended-B' symbol range will be displayed in the symbol dialog upon opening
  */
//CKEDITOR.config.defaultSymbolRange = 'Latin Extended-B';

/**
  * The list of special characters visible in the Symbol dialog. This is an array of pairs where the first entry is
  * the the name of the range and the second is the range specification in hex.
  * Ranges can be devided into smaller ranges in order to easily specify the characters to display.
  * It can be defined by a range: 0020-007E
  * Here the range runs from hex 0020 to 007E (both inclusive). Or it can be a single hex (indicating a single character
  * If a range is followed by an asterix '*' an extra   will be inserted before the character - this is used to
  * display diacritical characters (the extra   will not be inserted in the document).
  *
  * @type Array
  * @example
  * config.symbolRanges = [ ['Basic Latin', '0020-007F], ['Latin-1 Supplement', '00A0-00B0,00B1,00B2-00FF'], ['Combining Diacritical Marks', '0300-036F*'] ];
  */
CKEDITOR.config.symbolRanges =
        [
                ['Basic Latin', '0020-007E'],
                ['Latin-1 Supplement', '00A0-00B0,00B1,00B2-00FF'],
                ['Latin Extended-A', '0100-017F'],
                ['Latin Extended-B', '0180-024F'],
                ['IPA Extensions', '0250-02AF'],
                ['Spacing Modifier Letters', '02B0-02FF'],
                ['Combining Diacritical Marks', '0300-036F*'],
                ['Greek and Coptic', '0370-03FF'],
                ['Cyrillic', '0400-04FF'],
                ['Cyrillic Supplementary', '0500-052F'],
                ['Armenian', '0530-058F'],
                ['Hebrew', '0590-05FF'],
                ['Arabic', '0600-06FF'],
                ['Syriac', '0700-074F'],
                ['Thaana', '0780-07BF'],
                ['Devanagari', '0900-097F'],
                ['Bengali', '0980-09FF'],
                ['Gurmukhi', '0A00-0A7F'],
                ['Gujarati', '0A80-0AFF'],
                ['Oriya', '0B00-0B7F'],
                ['Tamil', '0B80-0BFF'],
                ['Telugu', '0C00-0C7F'],
                ['Kannada', '0C80-0CFF'],
                ['Malayalam', '0D00-0D7F'],
                ['Sinhala', '0D80-0DFF'],
                ['Thai', '0E00-0E7F'],
                ['Lao', '0E80-0EFF'],
                ['Tibetan', '0F00-0FFF'],
                ['Myanmar', '1000-109F'],
                ['Georgian', '10A0-10FF'],
                ['Hangul Jamo', '1100-11FF'],
                ['Ethiopic', '1200-137F'],
                ['Cherokee', '13A0-13FF'],
                ['Unified Canadian Aboriginal Syllabics', '1400-167F'],
                ['Ogham', '1680-169F'],
                ['Runic', '16A0-16FF'],
                ['Tagalog', '1700-171F'],
                ['Hanunoo', '1720-173F'],
                ['Buhid', '1740-175F'],
                ['Tagbanwa', '1760-177F'],
                ['Khmer', '1780-17FF'],
                ['Mongolian', '1800-18AF'],
                ['Limbu', '1900-194F'],
                ['Tai Le', '1950-197F'],
                ['Khmer Symbols', '19E0-19FF'],
                ['Phonetic Extensions', '1D00-1D7F'],
                ['Latin Extended Additional', '1E00-1EFF'],
                ['Greek Extended', '1F00-1FFF'],
                ['General Punctuation', '2000-206F'],
                ['Superscripts and Subscripts', '2070-209F'],
                ['Currency Symbols', '20A0-20CF'],
                ['Combining Diacritical Marks for Symbols', '20D0-20FF'],
                ['Letterlike Symbols', '2100-214F'],
                ['Number Forms', '2150-218F'],
                ['Arrows', '2190-21FF'],
                ['Mathematical Operators', '2200-22FF'],
                ['Miscellaneous Technical', '2300-23FF'],
                ['Control Pictures', '2400-243F'],
                ['Optical Character Recognition', '2440-245F'],
                ['Enclosed Alphanumerics', '2460-24FF'],
                ['Box Drawing', '2500-257F'],
                ['Block Elements', '2580-259F'],
                ['Geometric Shapes', '25A0-25FF'],
                ['Miscellaneous Symbols', '2600-26FF'],
                ['Dingbats', '2700-27BF'],
                ['Miscellaneous Mathematical Symbols-A', '27C0-27EF'],
                ['Supplemental Arrows-A', '27F0-27FF'],
                ['Braille Patterns', '2800-28FF'],
                ['Supplemental Arrows-B', '2900-297F'],
                ['Miscellaneous Mathematical Symbols-B', '2980-29FF'],
                ['Supplemental Mathematical Operators', '2A00-2AFF'],
                ['Miscellaneous Symbols and Arrows', '2B00-2BFF'],
                ['CJK Radicals Supplement', '2E80-2EFF'],
                ['Kangxi Radicals', '2F00-2FDF'],
                ['Ideographic Description Characters', '2FF0-2FFF'],
                ['CJK Symbols and Punctuation', '3000-303F'],
                ['Hiragana', '3040-309F'],
                ['Katakana', '30A0-30FF'],
                ['Bopomofo', '3100-312F'],
                ['Hangul Compatibility Jamo', '3130-318F'],
                ['Kanbun', '3190-319F'],
                ['Bopomofo Extended', '31A0-31BF'],
                ['Katakana Phonetic Extensions', '31F0-31FF'],
                ['Enclosed CJK Letters and Months', '3200-32FF'],
                ['CJK Compatibility', '3300-33FF'],
                ['CJK Unified Ideographs Extension A', '3400-4DBF'],
                ['Yijing Hexagram Symbols', '4DC0-4DFF'],
                ['CJK Unified Ideographs', '4E00-9FFF'],
                ['Yi Syllables', 'A000-A48F'],
                ['Yi Radicals', 'A490-A4CF'],
                ['Hangul Syllables', 'AC00-D7AF'],
                ['High Surrogates', 'D800-DB7F'],
                ['High Private Use Surrogates', 'DB80-DBFF'],
                ['Low Surrogates', 'DC00-DFFF'],
                ['Private Use Area', 'E000-F8FF'],
                ['CJK Compatibility Ideographs', 'F900-FAFF'],
                ['Alphabetic Presentation Forms', 'FB00-FB4F'],
                ['Arabic Presentation Forms-A', 'FB50-FDFF'],
                ['Variation Selectors', 'FE00-FE0F'],
                ['Combining Half Marks', 'FE20-FE2F'],
                ['CJK Compatibility Forms', 'FE30-FE4F'],
                ['Small Form Variants', 'FE50-FE6F'],
                ['Arabic Presentation Forms-B', 'FE70-FEFF'],
                ['Halfwidth and Fullwidth Forms', 'FF00-FFEF'],
                ['Specials', 'FFF0-FFFF']
        ];

StrInsert - Custom Dropdown for CKEditor4

Allows you to create a custom dropdown added to the ckeditor4 toolbar, which outputs a text string (or whatever needed) to the editor.

I'm using it to output strings that will be replaced to embed other types of content (like loading partials into views), but it can be used for many things! I will be extending it to pull data from a database.

Screenshots

strinsert

33,054 downloads (view stats)

Releases

Plugin versions CKEditor versions
4.24 4.23 4.22

Version: 0.01

DownloadRelease notes

First release of custom dropdown plugin for ckeditor 4

Syntaxhighlighter Interface

ckeditor-syntaxhighlight

A plugin originally written for CKEditor 3+ that enables code syntax highlighting. Interface for Alex Gorbatchev's syntaxhighlighter.

Updated to work with CKEditor 4+; some features added.

Supported languages: English, German and French. Feel free to contribute further translations.

 

Installation:

First method: simply use the ckbuilder to add syntaxhighlighter to your editor

Second method: download the plugin here, add the syntaxhighlighter-folder to your ckeditor's subfolder "plugins" and add syntaxhighlighter to the extraPlugins-entry in your config.js. If the plugin doesn't appear try adding an item called 'Syntaxhighlight' to your toolbar

Caution: this plugin simply adds some special markup-tags to your input. For the highlighting-process itself you will need to run Alex Gorbatchev's library on your website too.

 

Settings:

you can define all default values by yourself, i.e. by setting the correspondent values in your config.js

Configurable values are:

CKEDITOR.config.syntaxhighlight_hideGutter = [true|false];

CKEDITOR.config.syntaxhighlight_hideControls = [true|false];

CKEDITOR.config.syntaxhighlight_collapse = [true|false];

CKEDITOR.config.syntaxhighlight_codeTitle = any title; // default ''

CKEDITOR.config.syntaxhighlight_showColumns = [true|false];

CKEDITOR.config.syntaxhighlight_noWrap = [true|false];

CKEDITOR.config.syntaxhighlight_firstLine = any numeric value; // default 0

CKEDITOR.config.syntaxhighlight_highlight = i.e. [1,3,9]; // default null

CKEDITOR.config.syntaxhighlight_lang = 'applescript', 'actionscript3', 'as3', 'bash', 'shell', 'sh', 'coldfusion', 'cf', 'cpp', 'c', 'c#', 'c-sharp', 'csharp', 'css', 'delphi', 'pascal', 'pas', 'diff', 'patch', 'erl', 'erlang', 'groovy', 'haxe', 'hx', 'java', 'jfx', 'javafx', 'js', 'jscript', 'javascript', 'perl', 'Perl', 'pl', 'php', 'text', 'plain', 'powershell', 'ps', 'posh', 'py', 'python', 'ruby', 'rails', 'ror', 'rb', 'sass', 'scss', 'scala', 'sql', 'tap', 'Tap', 'TAP', 'ts', 'typescript', 'vb', 'vbnet', 'xml', 'xhtml', 'xslt', 'html'; // default null

CKEDITOR.config.syntaxhighlight_code = any source code; // default ''

 

Alex Gorbatchev's syntaxhighlighter:

https://github.com/alexgorbatchev/SyntaxHighlighter

Find us at github:

https://github.com/dbrain/ckeditor-syntaxhighlight/tree/ckeditor-4

View our demo:

http://cke4sh.funpic.de/

syntaxhighlight

54,284 downloads (view stats)

Releases

Plugin versions CKEditor versions
4.24 4.23 4.22

Version: 1.7.0

DownloadRelease notes

added translation to Chinese-Simplified by @Gnodiah

Floating-Tools

Floating-Tools is a smart addition to CKEditor that gives your users a floating toolbar whenever they select some text!

Description

A very effective and intuitive way to make text-formating tasks (and a lot of other things) easier!
Every time you select some text there is a toolbar displayed. Right there, at your mouse-cursor. The toolbar is smart enough to always keep your selected text visible. Yes, it loves to help you and never wants to distract you. If it still does not behave in some situation, then please let me know. I will have a word with it...

Screenshots

floating-tools

49,352 downloads (view stats)

Releases

Plugin versions CKEditor versions
4.24 4.23 4.22

Version: 1.2

DownloadRelease notes

Bugfix:

  • The toolbar was positioned outside the editor on some pages, the position calculation was improved and now is much more stable.
  • Now the toolbar is hidden, when the editor looses focus

jQuery Spellchecker

A jQuery Spellchecker plugin integration for CKEditor 4.

Screenshots

Releases

Code Editor

PBCKCode helps you to write code blocks to your articles in an easy way. It adds the ACE Code Editor to improves the behaviour of a textarea element. It creates a pre tag into your ckeditor so that you can include your prefered syntax highlighter.

PBCKCode works with more than 40 languages and is fully compatible with several syntax highlighters like Google Code Prettify or SyntaxHighlighter.

Writing code into your articles has never be so easy !

Documentation : http://prbaron.github.io/pbckcode/.

The plugin is released under the Apache 2 license.

From the v1.2.1, ACE Editor is now loaded from the [jsDelivr CDN](http://www.jsdelivr.com/). The loading will be faster and the plugin size will be smaller.

Complete changelog : https://github.com/prbaron/pbckcode/blob/master/CHANGELOG.md

Screenshots

pbckcode

537,895 downloads (view stats)

Releases

Plugin versions CKEditor versions
4.24 4.23 4.22

Version: 1.2.5

DownloadRelease notes

This new version is compatible with CKEditor 4.6.1.

Be careful, the zip file contains the source (in src) and the examples (in docs). You only need the src folder to make the plugin works.

Foundeo Spell Checker

This plugin allows you to add a spell checker button to the toolbar utilizing the Foundeo Server Side Spell Checker for ColdFusion, CFML, JSP, or Java Server Side Applications. 

All spell checking is done on your server without sending content to a third party for checking.

Screenshots

Releases

HTML Buttons

This plugin allows to easily create as many buttons as desired that each one can insert into the editor the HTML snippet that you want.

Version 1.5 includes changes proposed by Eric Arnol-Martin to wrap the existing selection with the HTML snippet (instead of only inserting and overwritting the selection).
It includes also the proposal by Julian Ivancsuk to use a menu-button dropdown instead of individual buttons so you don't clutter the toolbar if you have a lot of buttons.

htmlbuttons

77,699 downloads (view stats)

Releases

Plugin versions CKEditor versions
4.24 4.23 4.22

Version: 1.5.2

DownloadRelease notes

avoid breaking the toolbar configurator

Twitter Facebook Facebook Instagram Medium Linkedin GitHub Arrow down Phone Menu Close icon Check