SyntaxHighlighterFX is capable of styling code in a StyleClassedTextArea
from RichTextFX.
The computation of the styles can be done asynchronously to ensure a smooth rendering of your application.
The latest releases of Java Prettify are:
- Latest Java 10 release: v3.0.0
- Latest Java 8 release: v2.0.1
- Latest Java 6 release: v1.2.2
Java Prettify is available on Maven Central. To include it in your project, use:
<dependency>
<groupId>com.github.twalcari</groupId>
<artifactId>syntaxhighlighterfx</artifactId>
<version>3.0.0</version>
</dependency>
CodeArea codeArea = new CodeArea("<example>data</example> <!-- ... --->");
RTSyntaxHighlighter xmlCodeHighlighter = new RTSyntaxHighlighter(codeArea, "xml");
Please refer to RTSyntaxHighlighterTest.java for more information.
The syntax parser is based on Java Prettify, which is a Java port of Google Prettify, the current version ported is 4-Mar-2013. The copyright holder of the Google Prettify is Mike Samuel ([email protected]). It is licensed under the Apache license Version 2.
The original work on this port was done by Chan Wai Shing ([email protected]), and was published on https://code.google.com/p/java-prettify/. This was then moved to GitHub, and made into a Maven-project by Thijs Walcarius.
Version 2.0.0 still used the name 'java-prettify', and added support for the RichTextFX-controls, which require Java 8. Version 3.0.0 upgraded was renamed to 'SyntaxHighlighterFX' to better represent the goal of this library. It was modularized and edited to support Java 10.
This port is distributed under Apache license Version 2.