Syntax Highlighting Application

Last modified by Admin on 2024/01/29 16:49

page_white_codeProvides Syntax Highlighting
TypeXAR
Category
Developed by

Vincent Massol, Eduard Moraru

Rating
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

Release Notes

All release notes

4.7.1

The following translations have been updated with this release:

4.7

4.6.1

The following translations have been updated with this release:

4.6

4.5.2

4.5.1

4.5

4.4

4.3.1

4.3

4.2

4.1

4.0

3.4

3.3

3.2

3.1.1

3.1

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

2.2

2.1

2.0

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

Dependencies

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

Tags:
    

Get Connected