metonym / svelte-highlight

Syntax Highlighting for Svelte using highlight.js
https://svhe.onrender.com
MIT License
251 stars 13 forks source link

Add Svelte language support #298

Closed rscheuer closed 9 months ago

rscheuer commented 9 months ago

highlightjs-svelte (confusing, I know) supports Svelte syntax highlighting.

Would be great if this library included this as well. Thanks for all the great work on this!

metonym commented 9 months ago

Funnily enough, this library used to use that plugin.

To keep dependencies to a minimum, however, this library ships its own HighlightSvelte component which combines the existing XML/CSS/JS grammars.

<script>
  import { HighlightSvelte } from "svelte-highlight";
  import atomOneDark from "svelte-highlight/styles/atom-one-dark";

  const code = `<button on:click={() => { console.log(0); }}>Click me</button>`;
</script>

<svelte:head>
  {@html atomOneDark}
</svelte:head>

<HighlightSvelte {code} />