Recipes
Auto-detect language
Let Lumis infer the language from content, filename, or shebang.
const html = await highlight('#!/usr/bin/env bash\necho "hello"', htmlInline({theme: frappe}))
Resolving the id without highlighting
Highlighting detects the language for you. To ask what a snippet is before
deciding what to do with it, call the detector directly. It returns the same id
highlighting would have used, falling back to plaintext.
import {guessLanguage} from '@lumis-sh/lumis'
guessLanguage('lib/app.ex') // "elixir"
guessLanguage(undefined, '#!/usr/bin/env bash') // "bash"