Skip to content

v7.9.0

Latest

Choose a tag to compare

@metonym metonym released this 22 Oct 02:56
· 1 commit to master since this release

Features

  • add languageNames prop to HighlightAuto to allow a subset of languages (d2dd1fa, #384)
  • update languageName in LangTag to use LanguageName utility type (a24cd3e, #388)
  • export LanguageName utility 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";