page_white_codeProvides Syntax Highlighting
Recommended
TypeXAR
Developed by

Vincent Massol, Eduard Moraru

Active Installs3754
Rating
Rate!
2 Votes
LicenseGNU Lesser General Public License 2.1
Bundled With

XWiki Standard

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')
    • 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.

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

     wikiEditor-ambrient-theme.png

  • Since 3.0 Administration section

     syntaxHighlightingAdministration.png

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

     syntaxHighlighting-lineWrapping.png

Other Screenshots

syntax-highlighting-screenshot.png

TODO

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

v4.4

v4.3.1

v4.3

v4.2

v4.1

v4.0

v3.4

v3.3

v3.2

v3.1.1

v3.1

v3.0

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

v2.2

v2.1

v2.0

Dependencies

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

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

Get Connected