glimra
Zero runtime syntax highlighter for lustre/ssg
.
In Swedish,
glimra
describes the brilliant gleam or lustre that comes from a polished, reflective surface, capturing the essence of light shining off something smooth and glossy.
Platform support
glimra
uses NIFs to extract syntax highlighting events provided by the tree-sitter
and tree-sitter-highlight
crates. This allows glimra
to provide syntax highlighting for a wide range of languages with minimal effort.
Unfortunately, this also means that glimra
only works with the Erlang target. Furthermore, you either need to have access to the Rust toolchain or you can use the provided precompiled binaries.
Currently, the following operating systems and architectures are supported:
OS | Architecture(s) |
---|---|
Linux | x86_64 |
macOS | aarch64, x86_64 |
Windows | x86_64 |
Installation
gleam add glimra
Usage
import glimra
pub fn main() {
let source = "let greeting = \"Hello, Joe!\""
let highlighted_snippet =
glimra.syntax_highlighter(language: "gleam")
|> glimra.syntax_highlight(source: source)
}
Further documentation can be found at https://hexdocs.pm/glimra.
Development
gleam test # run the tests