v3.4.0
Features
- add
data-language
attribute topre
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;
}