Features
- add
languageNamesprop toHighlightAutoto allow a subset of languages (d2dd1fa, #384) - update
languageNameinLangTagto useLanguageNameutility type (a24cd3e, #388) - export
LanguageNameutility type (e0e42a6, #386)
HighlightAuto supports languageNames
You can restrict language auto-detection to a subset using the languageNames prop. This can improve performance and accuracy.
<script>
import { HighlightAuto } from "svelte-highlight";
const code = "const x = 42;";
</script>
<HighlightAuto {code} languageNames={["javascript", "typescript"]} />LanguageName utility type
Use the LanguageName to strongly type the language names included by highlight.js.
import type { LanguageName } from "svelte-highlight";