Metadata-Version: 2.4
Name: tree-sitter-highlight
Version: 0.0.0
Requires-Dist: pytest-cov>=7 ; extra == 'dev'
Requires-Dist: tree-sitter-python>=0.25.0 ; extra == 'dev'
Requires-Dist: myst-parser>=4 ; extra == 'docs'
Requires-Dist: tree-sitter-bash>=0.25 ; extra == 'docs'
Requires-Dist: tree-sitter-comment>=0.3.0 ; extra == 'docs'
Requires-Dist: tree-sitter-lua>=0.5.0 ; extra == 'docs'
Requires-Dist: tree-sitter-python>=0.25.0 ; extra == 'docs'
Requires-Dist: tree-sitter-toml>=0.7.0 ; extra == 'docs'
Provides-Extra: dev
Provides-Extra: docs
Summary: python binding for tree-sitter-highlight
Author-email: "Wu, Zhenyu" <wuzhenyu@ustc.edu>
License-Expression: GPL-3.0-only
Requires-Python: >=3.10
Description-Content-Type: text/markdown; charset=UTF-8; variant=GFM
Project-URL: homepage, https://github.com/sphinx-contrib/tree-sitter-highlight

# tree-sitter-highlight

Language bindings for [tree-sitter-highlight](https://crates.io/crates/tree-sitter-highlight).

## Lua

```lua
local highlight = require "tree_sitter_highlight".highlight
local search_parsers = require "tree_sitter_highlight".search_parsers
local parsers = search_parsers {
    "/usr/lib/nvim",
    "/usr/share/nvim/runtime",
}
local code = highlight {
    file = "/home/user/.config/nvim/init.vim",
    source = nil,
    language = "vim",
    parsers = parsers,
    theme = { variable = { color = "#F8F8F2" } },
    format = "terminal",
    layout = "document",
    style = "classes",
    prefix = "TS",
    math_escape = {"comment", "string"},
}
```

### [ldoc](https://github.com/lunarmodules/ldoc/)

`config.ld`:

```lua
pretty = 'lxsh'
```

```sh
luarocks install ldoc
luarocks install texcat
luarocks install tree-sitter-XXX
ldoc .
```

[An example](https://texrocks.readthedocs.io/).

### [texlua](https://www.luatex.org/)

See [texcat](https://texrocks.readthedocs.io/en/latest/topics/texcat.md.html).

## Python

```python
import tree_sitter_bash
import tree_sitter_python
from tree_sitter_highlight import highlight, search_parsers


parsers = search_parsers(
    tree_sitter_python,
    # same as:
    # python=tree_sitter_python,
    sh = tree_sitter_bash,
)
code = highlight(
    file = "/home/user/.bashrc",
    source = nil,
    language = "sh",
    parsers = parsers,
    theme = {"variable": {"color": "#F8F8F2"}},
    format = "terminal",
    layout = "document",
    style = "classes",
    prefix = "TS",
    math_escape = ["comment", "string"],
)
```

