Skip to main content

Documentation Index

Fetch the complete documentation index at: https://mintlify.com/letstri/druk/llms.txt

Use this file to discover all available pages before exploring further.

Druk uses tree-sitter to parse and highlight code in real time. Each language either uses a grammar bundled with OpenTUI (no extra files needed), a vendored WebAssembly grammar with a matching highlight query, or — for formats where tree-sitter is impractical — a set of regex patterns. This page lists every language Druk recognizes, its internal filetype ID, the status bar label it displays, and how its highlighting works.

Language table

LanguageFiletype IDStatus bar labelGrammar sourceNotes
JavaScriptjavascriptjsOpenTUI bundled
TypeScripttypescripttsOpenTUI bundled
MarkdownmarkdownmdOpenTUI bundledRendered view available via Ctrl+Opt+M
ZigzigzigOpenTUI bundled
JSONjsonjsonVendored wasm
HTMLhtmlhtmlVendored wasm
TSXtypescriptreacttsxVendored wasm
JSXjavascriptreactjsxVendored wasmReuses the tsx grammar
TSRxtsrxtsrxVendored wasm + regex overlayOctane template directives (@if, @for, key, etc.) via regex overlay on top of the tsx grammar
VuevuevueVendored wasm
CSScsscssVendored wasm
SCSSscssscssVendored wasmReuses the css grammar
SASSsasssassVendored wasmReuses the css grammar
LESSlesslessVendored wasmReuses the css grammar
PythonpythonpythonVendored wasm
RustrustrustVendored wasm
GogogoVendored wasm
JavajavajavaVendored wasm
KotlinkotlinkotlinVendored wasm
ScalascalascalaVendored wasm
CccVendored wasm
C++cppcppVendored wasm
C#csharpcsharpVendored wasm
PHPphpphpVendored wasm
RubyrubyrubyVendored wasm
ElixirelixirelixirVendored wasm
SwiftswiftswiftVendored wasm
DartdartdartVendored wasm
LualualuaVendored wasm
BashbashbashVendored wasm
TOMLtomltomlVendored wasm
YAMLyamlyamlRegex patternstree-sitter-yaml hangs the query engine; regex patterns are used instead
.env filesdotenvenvRegex patternsMatches .env, .env.local, .env.production, staging.env, etc.
SveltesveltesvelteRegex patterns
SQLsqlsqlRegex patterns
INIiniiniRegex patterns
YAML uses regex patterns instead of a tree-sitter grammar because tree-sitter-yaml hangs the query engine. The regex patterns cover keys, values, comments, anchors, aliases, and block scalars well enough for everyday use.

How file extension mapping works

OpenTUI’s pathToFiletype handles the common cases — .tstypescript, .pypython, and so on. Druk extends this with its own filetypeForPath function in src/languages/highlight.ts for filenames where the extension alone is not the answer:
  • .env files — matched by the pattern /^\\.env(?:\\.[\\w.-]+)?$|\\.env$/, so .env, .env.local, .env.production.sample, and staging.env all map to dotenv.
  • bun.lock — mapped explicitly to json by name. The file is JSON with comments and trailing commas; the json grammar highlights it correctly even without a dedicated grammar.
  • .tsrx files — matched by suffix and mapped to tsrx for the tsx + directive overlay.

Grammar sources explained

SourceWhat it means
OpenTUI bundledThe grammar ships inside the OpenTUI library itself. No wasm or query file is needed from Druk’s side.
Vendored wasmDruk vendors a .wasm file from the tree-sitter-wasms package and a matching .scm highlight query from src/languages/queries/. Both are embedded into the standalone binary at build time via bun build --compile.
Regex patternsA list of { group, re } pairs applied in order. Later patterns win any characters they overlap. Used where no usable tree-sitter grammar exists or where an overlay is needed on top of an existing grammar (TSRx directives).

Adding a language

To add a new language to Druk, four steps are needed:
1

Get a tree-sitter wasm

Most languages are available in the tree-sitter-wasms npm package. If yours is not, you can compile one with the tree-sitter CLI.
2

Write a highlight query

Drop a .scm highlight query in src/languages/queries/<id>.scm. You can often adapt queries from the tree-sitter repository for the language.
3

Register in grammars.ts

Add a static import for both the wasm and the query to src/languages/grammars.ts and add an entry to the GRAMMARS object.
4

Add a LANGUAGES entry

Add an entry to the LANGUAGES array in src/languages/index.ts. The id must match OpenTUI’s pathToFiletype output for the file extension you want to support.
No other changes are needed — the language will be automatically registered with tree-sitter at runtime, available for LSP server association, and shown in the status bar. For a full walkthrough, see Adding a language.

Build docs developers (and LLMs) love