Lumis
Lumis is a Tree-sitter syntax highlighter with Neovim themes across 7 runtimes, including community-maintained Java and Python packages.
Lumis is a syntax highlighter built on Tree-sitter and Neovim themes.
Lumis supports 7 runtimes: CLI, Rust, Elixir, JavaScript / TypeScript, Browsers / CDN, and community-maintained Java and Python. The community packages have their own APIs and release schedules.
The examples below cover the first-party runtimes and Lumis4J. See the fastpylight guide for Python examples.
To highlight code:
1. Install Lumis
npm install @lumis-sh/lumis @lumis-sh/themes2. Pick a language
A parser is an npm package:
npm install @lumis-sh/wasm-javascriptimport javascript from '@lumis-sh/wasm-javascript';3. Pick a theme
import frappe from '@lumis-sh/themes/catppuccin_frappe';4. Pick a formatter
import {htmlInline} from '@lumis-sh/lumis/formatters';
const formatter = htmlInline({language: javascript, theme: frappe});5. Render
import {highlight} from '@lumis-sh/lumis';
import {htmlInline} from '@lumis-sh/lumis/formatters';
import frappe from '@lumis-sh/themes/catppuccin_frappe';
import javascript from '@lumis-sh/wasm-javascript';
const html = await highlight(
'const x = 1',
htmlInline({language: javascript, theme: frappe})
);Why Lumis
- Tree-sitter parsing instead of regex-based tokenization
- 110+ languages that load on demand or preload, with injected languages highlighted in the same pass
- 250+ themes sourced from Neovim colorschemes, or one you generate
- 5 formatters: HTML Inline, HTML Linked, HTML Multi-Themes, Terminal, and BBCode Scoped, or one you write
- handles incomplete code, useful for streaming
- 7 runtimes: CLI, Rust, Elixir, JavaScript / TypeScript, Browsers / CDN, community-maintained Java and Python
Community
Lumis highlights package source on Hex.pm and blog code on jacko.io. Python tools mdhtml and mdhtml2docx use it through fastpylight to highlight code in HTML and Word documents.
See the community runtimes, full project list, and articles and talks.
See the visual comparison for the same source files highlighted by Lumis and other highlighters.
Why not Lumis
Parser size is the main tradeoff, especially in the browser. Load only the languages you need, or highlight at build time or on the server so visitors don't download parsers. See the language catalog for parser sizes.
How it works
- Tree-sitter parses code into syntax trees
- Neovim colorschemes supply the color data
- highlight queries come from
nvim-treesitter
Architecture walks the whole pipeline, from source code to styled output.
Every code block on this site is highlighted by Lumis itself, using the multi-themes formatter with catppuccin_latte and catppuccin_frappe themes for automatic light/dark mode switching.