Commit

Author:

Hash:

Timestamp:

+33 -1 +/-3 browse

Kevin Schoon [me@kevinschoon.com]

f3e15e1c1a57ef8317b0b279de070c60019129cd

Mon, 27 May 2024 20:23:22 +0000 (1.1 years ago)

add documentation for using custom tree-sitter highlight queries
1diff --git a/www/content/docs/configuration.md b/www/content/docs/configuration.md
2index a12af34..8d52fe3 100644
3--- a/www/content/docs/configuration.md
4+++ b/www/content/docs/configuration.md
5 @@ -178,3 +178,25 @@ name = "go"
6 # Go is pink!
7 color = "#ff1493"
8 ```
9+
10+ # Adding Custom Tree Sitter Highlights
11+
12+ You can override system installed tree-sitter
13+ [highlights](https://tree-sitter.github.io/tree-sitter/syntax-highlighting#highlights)
14+ in the Ayllu configuration file. For example we can add two new highlight
15+ queries to the `diff` parser called `@addition` and `@removal`. With these
16+ enabled Ayllu will paint the relevant code sections with CSS classes
17+ `ts_addition` and `ts_removal` which you can style in theme configurations.
18+
19+ ```toml
20+ [tree-sitter.highlights]
21+ diff = """
22+ ; used to highlight diffs in the UI
23+ [(addition) (new_file)] @addition
24+ [(deletion) (old_file)] @removal
25+
26+ (commit) @constant
27+ (location) @attribute
28+ (command) @variable.builtin
29+ """
30+ ```
31 diff --git a/www/public/docs/configuration/index.html b/www/public/docs/configuration/index.html
32index af98fd8..d54754b 100644
33--- a/www/public/docs/configuration/index.html
34+++ b/www/public/docs/configuration/index.html
35 @@ -69,4 +69,14 @@ color = "#ff1493"
36 name = "go"
37 # Go is pink!
38 color = "#ff1493"
39+ </code></pre><h1 id=adding-custom-tree-sitter-highlights><a aria-label="Anchor link for: adding-custom-tree-sitter-highlights" class=zola-anchor href=#adding-custom-tree-sitter-highlights>Adding Custom Tree Sitter Highlights</a></h1><p>You can override system installed tree-sitter <a href=https://tree-sitter.github.io/tree-sitter/syntax-highlighting#highlights>highlights</a> in the Ayllu configuration file. For example we can add two new highlight queries to the <code>diff</code> parser called <code>@addition</code> and <code>@removal</code>. With these enabled Ayllu will paint the relevant code sections with CSS classes <code>ts_addition</code> and <code>ts_removal</code> which you can style in theme configurations.<pre class=language-toml data-lang=toml><code class=language-toml data-lang=toml>[tree-sitter.highlights]
40+ diff = """
41+ ; used to highlight diffs in the UI
42+ [(addition) (new_file)] @addition
43+ [(deletion) (old_file)] @removal
44+
45+ (commit) @constant
46+ (location) @attribute
47+ (command) @variable.builtin
48+ """
49 </code></pre></div></div></main><footer class=page-footer>2024, <a href=/projects/ayllu/blob/main/ATTRIBUTIONS.md>attributions</a></footer></div>
50\ No newline at end of file
51 diff --git a/www/public/index.html b/www/public/index.html
52index 8ce2b18..345303c 100644
53--- a/www/public/index.html
54+++ b/www/public/index.html
55 @@ -1 +1 @@
56- <!doctype html><html lang=en><head><meta charset=utf-8><link href=/main.css rel=stylesheet><link href=/assets/ayllu_logo.svg rel=icon type=image/svg+xml><link href=/assets/ayllu_logo.png rel=icon sizes=any type=image/png><title>Ayllu</title></head><nav><ul><li><a href=/> <img class=logo src=/assets/ayllu_logo.png> </a></ul><ul><li><a href=https://ayllu-forge.org/browse>browse</a><li><a href=/docs>docs</a></ul></nav><body class=container><div class=wrapper><main class=page-body><h1 id=hyper-performant-hackable-code-forge-built-on-open-standards>Hyper Performant & Hackable Code Forge Built on Open Standards</h1><p>Ayllu is a lightweight code forge designed to enable individuals and grassroots community software projects develop software in collaboration across open internet standards.<p>Check out the <a href=https://ayllu-forge.org/%22/docs%22>documentation</a> or <a href=/browse>browse</a> some of the projects hosted on this serve.</main><footer class=page-footer>2024, <a href=/projects/ayllu/blob/main/ATTRIBUTIONS.md>attributions</a></footer></div>
57\ No newline at end of file
58+ <!doctype html><html lang=en><head><meta charset=utf-8><link href=/main.css rel=stylesheet><link href=/assets/ayllu_logo.svg rel=icon type=image/svg+xml><link href=/assets/ayllu_logo.png rel=icon sizes=any type=image/png><title>Ayllu</title></head><nav><ul><li><a href=/> <img class=logo src=/assets/ayllu_logo.png> </a></ul><ul><li><a href=https://ayllu-forge.org/browse>browse</a><li><a href=/docs>docs</a></ul></nav><body class=container><div class=wrapper><main class=page-body><h1 id=hyper-performant-hackable-code-forge-built-on-open-standards>Hyper Performant & Hackable Code Forge Built on Open Standards</h1><p>Ayllu is a lightweight code forge designed to enable individuals and grassroots community software projects develop software in collaboration across open internet standards.<p>Check out the <a href=/docs>documentation</a> or <a href=/browse>browse</a> some of the projects hosted on this serve.</main><footer class=page-footer>2024, <a href=/projects/ayllu/blob/main/ATTRIBUTIONS.md>attributions</a></footer></div>
59\ No newline at end of file