Highlight Macro
Last modified by H D on 2024/09/09 00:25
Provides code highlighting using Highlight.JS |
Type | XAR |
Category | |
Developed by | |
Active Installs | 74 |
Rating | |
License | GNU Lesser General Public License 2.1 |
Table of contents
Description
Uses Highlight.JS to highlight code snippets.
Usage
{{highlight language="language id" style="style id"}}
... code snippet here...
{{/highlight}}
... code snippet here...
{{/highlight}}
where:
Parameter Name | Mandatory? | Description |
---|---|---|
language id | No | The language of your code snippet (see available languages). If not specified, it's auto-discovered. |
style id | No | The style to use (see available styles). Default style is default. |
Example
Example with default style:
Example with zenburn style:
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:
- Log in the wiki with a user having Administration rights
- Go to the Administration page and select the Import category
- Follow the on-screen instructions to upload the downloaded XAR
- Click on the uploaded XAR and follow the instructions
- You'll also need to install all dependent Extensions that are not already installed in your wiki
Release Notes
v1.3
- Bugfix: HTML needs to be escaped
v1.2
- Fixed bug with default style
- Uses monospace font now
v1.1
- Improved performance by only loading the JS/CSS for pages using the macro
- Added support for styles
v1.0
First version