JSyntaxPaneTTx is a fork of JSyntaxPane, a syntax highlighting library built in Java.
Additional features in this fork include:
- Support extended from Java 6 through 14
- Customizable font size
- Additional language support (just the basics so far): Perl, Nasal
- Initially forked for use in the Text Trix editor but can be used independently in Java-based text editors for syntax highlighting
- JDK 6+ (mostly tested on 8-14)
- Maven
Download this library and output a .jar file to the target folder:
git clone https://github.com/yoda-vid/jsyntaxpanettx.git
cd jsyntaxpanettx
mvn package
Alternatively, build from within Text Trix. Assuming that texttrix has been cloned already to a directory next to jsyntaxpanettx:
texttrix/build.sh --jsyn
Support for additional languages can be added by creating new lexers and syntax kits for them. The simplest way to add this support is to copy an existing related language with a few updates:
- Copy a JFlex file from
src/main/jflex/jsyntaxpane/lexersand name it with the language you're adding (eg copyc.flextonas.flex) - Update any reference to the language name in the
.flexfile - Similarly, copy and update the corresponding Java file in
src/main/java/jsyntaxpane/syntaxkits - In
src/main/resources/META-INF/services/jsyntaxpane:- Add a line in
kitsfortypes.propertiesto include the new language lexer - Copy and update the corresponding
syntaxkits/[lang]syntaxkitfolder
- Add a line in
- Rebuild JSyntaxPaneTTx
- Load your new syntax kit by specifying it with
setContentType("text/[ext]");, whereextmatches the extension name you gave inkitsfortypes.properties