aboutsummaryrefslogtreecommitdiffstats
path: root/src/libs/3rdparty/syntax-highlighting/README.md
blob: c1b82c63d132b3d7c8c692f496020e09706d1b4d (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
# Syntax Highlighting

Syntax highlighting engine for Kate syntax definitions

## Introduction

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.

## Syntax Definition Files

This library uses Kate syntax definition files for the actual highlighting,
the file format is documented [here](https://docs.kde.org/stable5/en/applications/katepart/highlight.html).

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.

## Out of scope

To not turn this into yet another text editor, the following things are considered
out of scope:

* code folding, beyond providing folding range information
* auto completion
* spell checking
* user interface for configuration
* management of text buffers or documents

If you need any of this, check out [KTextEditor](https://api.kde.org/frameworks/ktexteditor/html/).

## 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