Skip to content

v3.4.0

Compare
Choose a tag to compare
@metonym metonym released this 12 Sep 22:35
· 477 commits to master since this release

Features

  • add data-language attribute to pre element to allow targeted styling (b3dbb26, #171 contributed by @willster277)
  • add langtag prop that displays the highlighted language if enabled (b3dbb26, #171 contributed by @willster277)

Set langtag to true to display the highlighted language.

<script>
  import { HighlightAuto } from "svelte-highlight";

  $: code = `.body { padding: 0; margin: 0; }`;
</script>

<HighlightAuto {code} langtag="{true}" />

Style the language tag by targeting the data-language attribute:

pre.hljs[data-language="css"] {
  --hljs-background: linear-gradient(135deg, #2996cf, 80%, white);
  --hljs-foreground: #fff;
  --hljs-radius: 8px;
}