// The one highlight.js instance the client uses.
//
// The package's default entry pulls ~190 language grammars (2.6 MB of sources,
// roughly half the entry chunk). The common bundle carries 37; the extras
// below are the ones this app's agents and file previews actually produce, and
// everything else falls back to plaintext — the code and its copy button are
// unaffected, only the colours are.
import hljs from 'highlight.js/lib/common'
import dockerfile from 'highlight.js/lib/languages/dockerfile'
import nginx from 'highlight.js/lib/languages/nginx'
import powershell from 'highlight.js/lib/languages/powershell'
import dart from 'highlight.js/lib/languages/dart'
import scala from 'highlight.js/lib/languages/scala'
import elixir from 'highlight.js/lib/languages/elixir'
import erlang from 'highlight.js/lib/languages/erlang'
import haskell from 'highlight.js/lib/languages/haskell'
import julia from 'highlight.js/lib/languages/julia'
import groovy from 'highlight.js/lib/languages/groovy'
import cmake from 'highlight.js/lib/languages/cmake'
import protobuf from 'highlight.js/lib/languages/protobuf'
// scad previews (sourceHighlight maps .scad → openscad) would otherwise lose
// their highlighting, since the grammar is not in the common bundle.
import openscad from 'highlight.js/lib/languages/openscad'
const EXTRA_LANGUAGES = {
dockerfile, nginx, powershell, dart, scala, elixir, erlang, haskell,
julia, groovy, cmake, protobuf, openscad,
}
for (const [name, language] of Object.entries(EXTRA_LANGUAGES)) {
if (!hljs.getLanguage(name)) hljs.registerLanguage(name, language)
}
export default hljs