Syntax Highlighting Application

Last modified by Admin on 2026/08/19 00:07

page_white_codeProvides Syntax Highlighting
Project Editor Tools
TypeXAR
Category
Developed by

Vincent Massol, Eduard Moraru

Support
XWiki Development Team: Community
Rating
0 Votes
LicenseGNU Lesser General Public License 2.1
Bundled With

XWiki Standard

Success

Installable with the Extension Manager

Description

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')
    • InformationSince 3.0 XWiki.WikiMacroClass
    • InformationSince 4.4 Panels.PanelClass (also exposed in the panel's sheet)
    • InformationSince 4.4 XWiki.UIExtensionClass
    • InformationSince 4.4 XWiki.SchedulerJobClass (also exposed in the job's sheet)
    • InformationSince 4.4 XWiki.ComponentMethodClass
    • InformationSince 4.4 XWiki.ConfigurableClass
    • InformationSince 4.8 XWiki.Mail

InformationSince 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.

Information

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

Features

  • Syntax highlighting

      wikiEditor-default-theme.png

  • 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

      searchSupport.png

    • 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 https://codemirror.net/demo/search.html
    • InformationSince 3.0 Matches are also displayed on the scrollbar

        matchesOnScrollbar.png

  • 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)
  • InformationSince 3.0 Theme support (33 themes provided by codeMirror)

      wikiEditor-ambrient-theme.png

  • InformationSince 3.0 Administration section

      syntaxHighlightingAdministration.png

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

      syntaxHighlighting-lineWrapping.png

Other Screenshots

syntax-highlighting-screenshot.png

Failed to execute the [include] macro. Cause: [Cannot find section [HReleaseNotes] in document [extensions:Extension.EditorTools.WebHome]]. Click on this message for details.

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

Versions

See project page

Dependencies

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

Get Connected