- Install the application through the Applications-app in Enonic XP 7.x.
- Add the "Code Highlighting Macro"-application to your site.
- You can optionally configure which code highlighting style you want to use in the site config. It should be the
name of one of the included css-files in highlight.js (e.g
github.css
).
- Enter an HTML-editor in Content Studio
- Select Insert Macro on the toolbar
- Select Code Highlighting, and pick a language.
- Your code will now contain the following macro:
[highlight language="javascript"/]
- Code now can be written between
[highlight]
and[/highlight]
:[highlight language="javascript"] <pre> function demo() { return "This is a demo"; } </pre> [/highlight]
- The resulting web page will have box containing a highlighted code:
To build he project run the following code
./gradlew build
Deploy locally for testing purposes:
./gradlew publishToMavenLocal
Go to the Jitpack page for xp-highlight to deploy from Github.