Installation
Pick the runtime you want to use first. The highlighting concepts stay the same across all of them.
- JavaScript
- Rust
- Elixir
- Java
- CLI
- Browsers / CDN
npm install @lumis-sh/lumis @lumis-sh/themes
Use @lumis-sh/lumis for the per-language WASM runtime and
@lumis-sh/themes for bundled themes. Node.js, Bun, Deno, and browsers use the
same runtime model.
cargo add lumis
def deps do
[
{:lumis, "~> 0.7"}
]
end
<dependency>
<groupId>io.roastedroot</groupId>
<artifactId>lumis4j</artifactId>
<version>0.0.7</version>
</dependency>
npx @lumis-sh/cli --help
For a global install:
npm install -g @lumis-sh/cli
The installed binary is lumis. npm resolves it from a platform package, so the install runs no scripts and downloads nothing beyond the registry. Alpine and other musl hosts are covered, and the binary there is statically linked. Rust users can also install from crates.io with cargo install lumis-cli.
<script type="module">
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 frappe from 'https://esm.sh/@lumis-sh/themes/catppuccin_frappe';
const html = await highlight(
'const x = 1',
htmlInline({language: javascript, theme: frappe})
);
document.getElementById('output').innerHTML = html;
</script>
Notes
- Highlighting loads the parsers a document needs, including languages injected inside it, and caches the verified bytes. See WASM and CDN.
- Warm up parsers at startup without blocking it, or use the CLI when a build or operations step owns the cache.
- For local JavaScript parser assets from npm, install per-language packages such as
@lumis-sh/wasm-rustor bundle packages such as@lumis-sh/wasm-bundle-web. - The CLI stores verified, content-addressed parsers and custom themes in a local data directory.