Syntax Highlighting Application

Last modified by Admin on 2020/05/25 00:10

page_white_codeProvides Syntax Highlighting
Developed by

Vincent Massol, Eduard Moraru

Active Installs3767
2 Votes
LicenseGNU Lesser General Public License 2.1
Bundled With

XWiki Standard

Installable with the Extension Manager


CodeMirror based syntax highlighting for:

  • JavaScript
  • CSS
  • Velocity
  • Groovy
  • Python
  • HTML
  • XWiki Macros (Experimental)

Syntax highlighting is automatically activated for:

  • wiki editor
  • object editor, for code properties of the following classes:
    • XWiki.StyleSheetExtension
    • XWiki.JavaScriptExtension
    • XWiki.XWikiSkins (properties with the name ending in '.css' and '.js')
    • Since 3.0 XWiki.WikiMacroClass
    • Since 4.4 Panels.PanelClass (also exposed in the panel's sheet)
    • Since 4.4 XWiki.UIExtensionClass
    • Since 4.4 XWiki.SchedulerJobClass (also exposed in the job's sheet)
    • Since 4.4 XWiki.ComponentMethodClass

Since 4.4 Syntax highlighting is disabled on mobile devices, as support for mobile devides in CodeMirror 5.x and lower is experimental and, in practice, a bit of a hit-or-miss (when it comes to the interaction with the editor). For practical purposes, we have decided to focus on the desktop for now, until CodeMirror 6 is out.

You need to be an advanced user to use the Wiki and Object editors.


  • Syntax highlighting


  • Line numbers
  • Active line highlighting
  • Tab line indentation
  • 2 spaces on tab
  • Matching and auto-closing brackets, parentheses and quotes
  • Matching selection highlighting
  • Scroll to undo/redo position
  • Trailing whitespace highlighting
  • Multiline comment auto indentation on newline
  • Search/Replace with regex support


    • Press Ctrl+F / Ctrl+Shift+F (while the editor is focused) to search inside the editor 
    • Press Ctrl+Shift+R (while the editor is focused) for search and replace
    • Press F3 after searching for something (with the editor focused) in order to scroll to the next result
      • Note: CTRL+G is already taken by the Go To popup.
    • More keyboard shortcuts at
    • Since 3.0 Matches are also displayed on the scrollbar


  • Fullscreen editing support
    • Press F11 (while the editor is focused) to enter full screen
    • Press Esc to exit full screen
  • Autocompletion (by installing the AutoCompletion Application)
  • Since 3.0 Theme support (33 themes provided by codeMirror)


  • Since 3.0 Administration section


  • Since 4.3 Line wrapping for long lines (configurable in Administration)


Other Screenshots



  • Improvement Open WIKIEDITOR-58 Extra indentation when typing a rendering macro
  • New Feature Open WIKIEDITOR-61 Extension point for pages wanting syntax highlighting
  • Bug Open WIKIEDITOR-47 Velocity bindings defined in the skin are not available in autocomplete
  • Improvement Open WIKIEDITOR-34 Ability to enable/disable the CodeMirror editor
  • Bug Open WIKIEDITOR-45 Only a few (one?) signature of a function is displayed
  • New Feature Open WIKIEDITOR-28 Integrate Realtime Collaborative Editing in syntax highlighting editor.
  • Improvement Open WIKIEDITOR-26 Enable highlighting for the new skin edit UI
  • Improvement Open WIKIEDITOR-15 Handle nested XWiki (script) macros in the "xwiki" syntax highlighting mode
  • Improvement Open WIKIEDITOR-11 Handle newly added objects in the object editor
  • Improvement Open WIKIEDITOR-10 AutoComplete and Highlighting for inner/nested modes (mixed by the "xwiki" mode)
  • Improvement Open WIKIEDITOR-53 Be able to "Find" multiple occurrences of the word in one go
  • Improvement Open WIKIEDITOR-23 If there is no custom autocomplete page for the current mode, use showHint's fallbacks
  • Bug Open WIKIEDITOR-41 AutoCompletion in chained Velocity methods is wrongly triggered in parameters
  • Bug Open WIKIEDITOR-67 Syntax Highlighting related error in JS console when editing a page in wiki mode
  • Bug Open WIKIEDITOR-55 Smart indent (shift+tab) for python code results in bad indentation
  • Improvement Open WIKIEDITOR-51 Load SyntaxHighlighting also for pages in "Plain" syntax
  • Improvement Open WIKIEDITOR-52 User level election of syntax scheme
  • Improvement Open WIKIEDITOR-9 Ability to resize the Syntax Highlighting editor (by dragging bottom-right corner)

New bugs and suggestions go to the dedicated JIRA project (you need to create an account there). Don't use comments on this page for that. Thank you.

Tested on

This extension has been tested with the following configurations.

Extension VersionXWiki FlavorNotes
2.0XWiki Enterprise 3.0+

Possibly compatible with lower versions too

2.2XWiki Enterprise 6.0.1
3.1.1XWiki Enterprise 7.1.2
4.0XWiki Enterprise 8.4+

Prerequisites & Installation Instructions

We recommend using the Extension Manager to install this extension (Make sure that the text "Installable with the Extension Manager" is displayed at the top right location on this page to know if this extension can be installed with the Extension Manager). Note that installing Extensions when being offline is currently not supported and you'd need to use some complex manual method.

You can also use the following manual method, which is useful if this extension cannot be installed with the Extension Manager or if you're using an old version of XWiki that doesn't have the Extension Manager:

  1. Log in the wiki with a user having Administration rights
  2. Go to the Administration page and select the Import category
  3. Follow the on-screen instructions to upload the downloaded XAR
  4. Click on the uploaded XAR and follow the instructions
  5. You'll also need to install all dependent Extensions that are not already installed in your wiki

Release Notes


  • Bug Closed WIKIEDITOR-64 Disable completely on mobile devices
  • Bug Closed WIKIEDITOR-63 Potential null reference leads to NullPointerException
  • Improvement Closed WIKIEDITOR-59 Move 'Syntax Highlighting' administration section from 'Other' to 'Editing' category
  • Improvement Closed WIKIEDITOR-65 Add more activation locations
  • Improvement Closed WIKIEDITOR-60 Enable highlighting also for Panels.PanelClass's "Content" textarea in editor=object


  • Bug Closed WIKIEDITOR-57 JavaScript and CSS highlighting modes fail to load


  • Improvement Closed WIKIEDITOR-56 Allow configuring whether to use line wrapping or not
  • Bug Closed WIKIEDITOR-46 URLs to load codemirror contains double slashes which fail the load


  • Bug Closed WIKIEDITOR-50 Syntax Highlighting breaks the wiki editor in Space Delimited code (python macro)



  • Bug Closed WIKIEDITOR-48 Disabling Syntax Highlighting from Administration requires a clear of the browser cache
  • Task Closed WIKIEDITOR-49 Upgrade the minimum XWiki version to 8.4
  • Bug Closed WIKIEDITOR-43 When autocompletion fails for XWiki syntax no error is displayed.


  • Bug Closed WIKIEDITOR-40 Editor not saving the correct content but only after the second save
  • Bug Closed WIKIEDITOR-42 Unable to debug the non-minified javascript code


  • Bug Closed WIKIEDITOR-29 Syntax highlighting does not work with some apache frontends
  • Bug Closed WIKIEDITOR-31 Autocompletion on $doc is targetting XWikiDocument instead of Document
  • Improvement Closed WIKIEDITOR-38 Split the autocompletion into two extensions following the Syntax Highlighting model
  • Bug Closed WIKIEDITOR-39 Webjars are not loaded in XWiki before 6.3


  • Bug Closed WIKIEDITOR-27 Search is not working on textareas enhanced by the Syntax Highlighting Application
  • Improvement Closed WIKIEDITOR-36 Update CodeMirror dependency to version 5.8
  • Task Closed WIKIEDITOR-37 Split the Syntax Highlighting extension in two extensions


  • Improvement Closed WIKIEDITOR-33 Being able to run Wiki editor (syntax highlighting and automcomplete) on XWiki 6.0


  • Improvement Closed WIKIEDITOR-21 Improve the slow loading of the required modules by using the new webjar URL
  • Bug Closed WIKIEDITOR-25 Hide technical documents


This version improved the overall stability of the application but unfortunatey also introduced a serious performance issue that can lead to the syntax highlighting being activated 10+ seconds after the page is loaded. An improvement of this problem will come with the new version that will be released once XWiki 7.1M1 is released and an even better solution will hopefully come after that. To stay up to date with the problem, please watch the assigned WIKIEDITOR-21 Jira issue

  • Task Closed WIKIEDITOR-22 Upgrade to CodeMirror 5.1
  • Bug Closed WIKIEDITOR-18 NPE when the velocity context variable on which we want methods autocompletions does not exist
  • Improvement Closed WIKIEDITOR-19 Trigger autocomplete while typing, without having to press Ctrl+Space
  • Improvement Closed WIKIEDITOR-20 Display search results overview on the scrollbar
  • Improvement Closed WIKIEDITOR-17 Add support for Syntax Highlighting also when editing a document Inline
  • Improvement Closed WIKIEDITOR-12 Enable highlighting also for XWiki.WikiMacroClass's "Macro Code" textarea in editor=object
  • Improvement Closed WIKIEDITOR-14 Use webjars instead of adding the code mirror zip to a XWiki page
  • Bug Closed WIKIEDITOR-8 Autocomplete does not remove first character typed
  • Improvement Closed WIKIEDITOR-13 Create an Administration UI for the SyntaxHighlighting Application
  • Improvement Closed WIKIEDITOR-16 Use JSRX and SSRX instead of the deprecated ZipExplorer plugin to get packed/zipped resources
  • Bug Closed WIKIEDITOR-7 Avoid Syntax Highlighting fullscreen augmentation on regular textareas


  • Bug Closed WIKIEDITOR-1 Macro closing adds indentation
  • Bug Closed WIKIEDITOR-2 Wiki syntax editor's toolbar buttons don't work with Syntax Highlighting


  • Bug Closed WIKIEDITOR-3 Add highlighting and completions for velocity for the XWikiSkin object editor.
  • Improvement Closed WIKIEDITOR-4 Add support for autocompleting chained method calls


  • New Feature Closed WIKIEDITOR-5 Publish a Wiki Editor tools version installable with the Extension Manager


Dependencies for this extension (org.xwiki.contrib.editortool:editor-tool-highlighting-ui 4.4):

Created by Eduard Moraru on 2011/10/17 17:04

Get Connected