README.md 1.84 KB
Newer Older
1
# Syntax Highlighting
Volker Krause's avatar
Volker Krause committed
2

3 4 5
Syntax highlighting engine for Kate syntax definitions

## Introduction
Volker Krause's avatar
Volker Krause committed
6

7 8 9 10
This is a stand-alone implementation of the Kate syntax highlighting engine.
It's meant as a building block for text editors as well as for simple highlighted
text rendering (e.g. as HTML), supporting both integration with a custom editor
as well as a ready-to-use QSyntaxHighlighter sub-class.
Volker Krause's avatar
Volker Krause committed
11

12
## Syntax Definition Files
Volker Krause's avatar
Volker Krause committed
13

14
This library uses Kate syntax definition files for the actual highlighting,
Amit Kumar Jaiswal's avatar
Amit Kumar Jaiswal committed
15
the file format is documented [here](https://docs.kde.org/stable5/en/applications/katepart/highlight.html).
Volker Krause's avatar
Volker Krause committed
16

17 18 19
More than 250 syntax definition files are included, additional ones are
picked up from the file system if present, so you can easily extend this
by application-specific syntax definitions for example.
Volker Krause's avatar
Volker Krause committed
20

21
## Out of scope
Volker Krause's avatar
Volker Krause committed
22

23 24
To not turn this into yet another text editor, the following things are considered
out of scope:
Volker Krause's avatar
Volker Krause committed
25

26 27 28
* code folding, beyond providing folding range information
* auto completion
* spell checking
Volker Krause's avatar
Volker Krause committed
29
* user interface for configuration
Nicolás Alvarez's avatar
Nicolás Alvarez committed
30
* management of text buffers or documents
31

Amit Kumar Jaiswal's avatar
Amit Kumar Jaiswal committed
32
If you need any of this, check out [KTextEditor](https://api.kde.org/frameworks/ktexteditor/html/).
33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49

## Adding unit tests for a syntax definition

* add an input file into the autotests/input/ folder, lets call it test.<language-extension>

* if the file extension is not sufficient to trigger the right syntax definition, you can add an
  second file testname.<language-extension>.syntax that contains the syntax definition name
  to enforce the use of the right extension

* do "make && make test"

* inspect the outputs found in your binary directory autotests/folding.out, autotests/html.output and autotests/output

* if ok, run in the binary folder "./autotests/update-reference-data.sh" to copy the results to the right location

* add the result references after the copying to the git