Syntax Highlighter powered by Tree-sitter and Neovim themes.
See the code![]() | ![]() |
curl -LsSf https://lumis.sh/install.sh | sh
lumis highlight app.js
For a global install:
npm install -g @lumis-sh/cli
lumis highlight app.js
use lumis::{highlight, HtmlInlineBuilder, languages::Language, themes};
let theme = themes::get("dracula").unwrap();
let formatter = HtmlInlineBuilder::new()
.language(Language::Javascript)
.theme(Some(theme))
.build()
.unwrap();
let html = highlight("const x = 1", formatter);
Use the same package in JavaScript and TypeScript apps on Node.js, Bun, and Deno. TypeScript declarations are included.
import { highlight } from '@lumis-sh/lumis'
import { htmlInline } from '@lumis-sh/lumis/formatters'
import javascript from '@lumis-sh/lumis/langs/javascript'
import dracula from '@lumis-sh/themes/dracula'
const html = await highlight('const x = 1', htmlInline({ language: javascript, theme: dracula }))
Parsers download on demand, including languages injected inside a document. Browsers are the exception: loading is asynchronous there, so an injected language has to be loaded first. See WASM and CDN.
Works in Browsers through bundlers or CDN imports.
import { highlight } from 'https://esm.sh/@lumis-sh/lumis'
import { htmlInline } from 'https://esm.sh/@lumis-sh/lumis/formatters'
import javascript from 'https://esm.sh/@lumis-sh/lumis/langs/javascript'
import dracula from 'https://esm.sh/@lumis-sh/themes/dracula'
const html = await highlight('const x = 1', htmlInline({ language: javascript, theme: dracula }))
Lumis.highlight!("const x = 1", formatter: {:html_inline, language: "javascript", theme: "dracula"})
Parsers download on demand and load once per VM. Call
Lumis.Languages.async_load/1 from your application's start/2 to move the
download and compile off the first request without holding up the boot.
See Elixir integration.
By @andreaTP. More details at https://chicory.dev/blog/syntax-highlight
import io.roastedroot.lumis4j.core.Lumis;
import io.roastedroot.lumis4j.core.Lang;
import io.roastedroot.lumis4j.core.Theme;
var lumis = Lumis.builder().build();
var highlighter = lumis.highlighter()
.withLang(Lang.JAVASCRIPT)
.withTheme(Theme.DRACULA)
.build();
var result = highlighter.highlight("const x = 1");
System.out.println(result.string());
| Runtime | Install | Package | Docs |
|---|---|---|---|
| CLI | curl -LsSf https://lumis.sh/install.sh | sh | GitHub Releases | Install |
| Rust | cargo add lumis | crates.io/lumis | README.md • docs.rs |
| Elixir | {:lumis, "~> 0.7"} | hex.pm/lumis | README.md • hexdocs |
| JavaScript / TypeScript | npm install @lumis-sh/lumis | npmjs.com/@lumis-sh/lumis | README.md |
| Browsers / CDN | npm install @lumis-sh/lumis | npmjs.com/@lumis-sh/lumis | README.md |
| Java | io.roastedroot:lumis4j:0.0.7 | io.roastedroot/lumis4j | README.md |
Every Lumis package is built around the same three pieces:
Given some source code, Lumis parses it with the selected Tree-sitter language, resolves styles from the chosen theme, and then formats the highlighted result into HTML, ANSI, or any custom output.
The npm WASM package versions follow the pattern <tree-sitter-version>.<seq> where:
tree-sitter-version is the major-minor version of the compatible Tree-sitter releaseseq is a patch number for Lumis own updatesFor example, @lumis-sh/wasm-rust@0.26.0 is the first published version compatible with Tree-sitter 0.26,
while @lumis-sh/wasm-javascript@0.26.1 is a patch update compatible with Tree-sitter 0.26 (usually containing upstream parser updates).
Contributions are welcome. Feel free to open issues or PRs for bugs, features, new themes, or languages.
See CONTRIBUTING.md
MIT
(top 30 of 171)
Rust
45.1%
TypeScript
29.4%
Elixir
11.6%
JavaScript
4.8%
HTML
4.5%
Lua
2.6%
Tree-sitter Query
1.0%
Syntax Highlighter powered by Tree-sitter and Neovim themes.
See the code![]() | ![]() |
curl -LsSf https://lumis.sh/install.sh | sh
lumis highlight app.js
For a global install:
npm install -g @lumis-sh/cli
lumis highlight app.js
use lumis::{highlight, HtmlInlineBuilder, languages::Language, themes};
let theme = themes::get("dracula").unwrap();
let formatter = HtmlInlineBuilder::new()
.language(Language::Javascript)
.theme(Some(theme))
.build()
.unwrap();
let html = highlight("const x = 1", formatter);
Use the same package in JavaScript and TypeScript apps on Node.js, Bun, and Deno. TypeScript declarations are included.
import { highlight } from '@lumis-sh/lumis'
import { htmlInline } from '@lumis-sh/lumis/formatters'
import javascript from '@lumis-sh/lumis/langs/javascript'
import dracula from '@lumis-sh/themes/dracula'
const html = await highlight('const x = 1', htmlInline({ language: javascript, theme: dracula }))
Parsers download on demand, including languages injected inside a document. Browsers are the exception: loading is asynchronous there, so an injected language has to be loaded first. See WASM and CDN.
Works in Browsers through bundlers or CDN imports.
import { highlight } from 'https://esm.sh/@lumis-sh/lumis'
import { htmlInline } from 'https://esm.sh/@lumis-sh/lumis/formatters'
import javascript from 'https://esm.sh/@lumis-sh/lumis/langs/javascript'
import dracula from 'https://esm.sh/@lumis-sh/themes/dracula'
const html = await highlight('const x = 1', htmlInline({ language: javascript, theme: dracula }))
Lumis.highlight!("const x = 1", formatter: {:html_inline, language: "javascript", theme: "dracula"})
Parsers download on demand and load once per VM. Call
Lumis.Languages.async_load/1 from your application's start/2 to move the
download and compile off the first request without holding up the boot.
See Elixir integration.
By @andreaTP. More details at https://chicory.dev/blog/syntax-highlight
import io.roastedroot.lumis4j.core.Lumis;
import io.roastedroot.lumis4j.core.Lang;
import io.roastedroot.lumis4j.core.Theme;
var lumis = Lumis.builder().build();
var highlighter = lumis.highlighter()
.withLang(Lang.JAVASCRIPT)
.withTheme(Theme.DRACULA)
.build();
var result = highlighter.highlight("const x = 1");
System.out.println(result.string());
| Runtime | Install | Package | Docs |
|---|---|---|---|
| CLI | curl -LsSf https://lumis.sh/install.sh | sh | GitHub Releases | Install |
| Rust | cargo add lumis | crates.io/lumis | README.md • docs.rs |
| Elixir | {:lumis, "~> 0.7"} | hex.pm/lumis | README.md • hexdocs |
| JavaScript / TypeScript | npm install @lumis-sh/lumis | npmjs.com/@lumis-sh/lumis | README.md |
| Browsers / CDN | npm install @lumis-sh/lumis | npmjs.com/@lumis-sh/lumis | README.md |
| Java | io.roastedroot:lumis4j:0.0.7 | io.roastedroot/lumis4j | README.md |
Every Lumis package is built around the same three pieces:
Given some source code, Lumis parses it with the selected Tree-sitter language, resolves styles from the chosen theme, and then formats the highlighted result into HTML, ANSI, or any custom output.
The npm WASM package versions follow the pattern <tree-sitter-version>.<seq> where:
tree-sitter-version is the major-minor version of the compatible Tree-sitter releaseseq is a patch number for Lumis own updatesFor example, @lumis-sh/wasm-rust@0.26.0 is the first published version compatible with Tree-sitter 0.26,
while @lumis-sh/wasm-javascript@0.26.1 is a patch update compatible with Tree-sitter 0.26 (usually containing upstream parser updates).
Contributions are welcome. Feel free to open issues or PRs for bugs, features, new themes, or languages.
See CONTRIBUTING.md
MIT
(top 30 of 171)
Rust
45.1%
TypeScript
29.4%
Elixir
11.6%
JavaScript
4.8%
HTML
4.5%
Lua
2.6%
Tree-sitter Query
1.0%