Skip to main content

tree-sitter-highlight

Language bindings for tree-sitter-highlight.

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

config.ld:

pretty = 'lxsh'
luarocks install ldoc
luarocks install texcat
luarocks install tree-sitter-XXX
ldoc .

An example.

texlua

See texcat.

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"],
)

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

tree_sitter_highlight-0.0.0.tar.gz (43.8 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

tree_sitter_highlight-0.0.0-cp38-abi3-manylinux_2_31_x86_64.whl (1.3 MB view details)

Uploaded CPython 3.8+manylinux: glibc 2.31+ x86-64

File details

Details for the file tree_sitter_highlight-0.0.0.tar.gz.

File metadata

  • Download URL: tree_sitter_highlight-0.0.0.tar.gz
  • Upload date:
  • Size: 43.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.11.28 {"installer":{"name":"uv","version":"0.11.28","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"NixOS","version":"26.11","id":"zokor","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}

File hashes

Hashes for tree_sitter_highlight-0.0.0.tar.gz
Algorithm Hash digest
SHA256 5228060eef3d27c6795b9870c4b0eea6af77b0b65980199fd08923d62cc7ee34
MD5 ec760fc4cd3c7b0927cb9baf4319f8e0
BLAKE2b-256 693298191b2d894ae85ffcde88faaad4b4db60d597792fb639b7c9e81ba4c245

See more details on using hashes here.

File details

Details for the file tree_sitter_highlight-0.0.0-cp38-abi3-manylinux_2_31_x86_64.whl.

File metadata

  • Download URL: tree_sitter_highlight-0.0.0-cp38-abi3-manylinux_2_31_x86_64.whl
  • Upload date:
  • Size: 1.3 MB
  • Tags: CPython 3.8+, manylinux: glibc 2.31+ x86-64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.11.28 {"installer":{"name":"uv","version":"0.11.28","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"NixOS","version":"26.11","id":"zokor","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}

File hashes

Hashes for tree_sitter_highlight-0.0.0-cp38-abi3-manylinux_2_31_x86_64.whl
Algorithm Hash digest
SHA256 d37199c31a4e9c8fd07b67b5e405da1695698b848d77f09b7a659f4bb704cc60
MD5 8565f76f21aae7078de802bf2ba4489b
BLAKE2b-256 16901a9de5fd411f71c2349e309498e75b3afdd65e473949db6b6f10f3e473a9

See more details on using hashes here.

Release history Release notifications | RSS feed

0.0.1

19 files

This release

0.0.0 This release

2 files

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page