Skip to content

Releases: metonym/svelte-preprocess-highlight

v0.1.0

26 Jun 18:18
Compare
Choose a tag to compare

Initial release.


Install and include the preprocessor in your config file.

// svelte.config.js
import { highlight } from "svelte-preprocess-highlight";

const config = {
  preprocess: [highlight()],
};

export default config;

Use the pre element with a data-language attribute. Place the text inside of the pre element.

<pre data-language="typescript">
{`
  const sum = (a: number, b: number) => a + b;

  const difference = (a: number, b: number) => a - b;
`}
</pre>