Skip to main content

Repeated highlighting (JavaScript)

import {createHighlighter} from '@lumis-sh/lumis'
import {htmlInline} from '@lumis-sh/lumis/formatters'
import {bundledLanguages} from '@lumis-sh/lumis/bundles/web'
import dracula from '@lumis-sh/themes/dracula'
const hl = await createHighlighter({languages: [bundledLanguages]})
await hl.loadLanguage('javascript')
const html = hl.highlight('const x = 1', htmlInline({language: 'javascript', theme: dracula}))

See JavaScript for the reusable highlighter workflow.