# prism-svelte

> Svelte language extension for prismjs

Latest version **0.5.0** (published 2022-02-19) · MIT license · 0 weekly downloads

## Install

```sh
npm install prism-svelte
pnpm add prism-svelte
yarn add prism-svelte
bun add prism-svelte
```

## Health

**Score 20/100 (F)** — status: abandoned.

Positive: esm support; no vulnerabilities.

Warnings: low downloads; no types; pre 1.0.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 0.5.0 |
| Published | 2022-02-19 |
| First published | 2019-11-23 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | ESM + CommonJS |
| Dependencies | 0 |
| Unpacked size | 6 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 65 |
| Author | pngwn |
| Maintainers | evilpingwin |
| Keywords | svelte, prism, highlight, syntax |

## Links

- npm: https://www.npmjs.com/package/prism-svelte
- Repository: https://github.com/pngwn/prism-svelte
- Homepage: https://github.com/pngwn/prism-svelte#readme
- Issues: https://github.com/pngwn/prism-svelte/issues
- npm.io page: https://npm.io/package/prism-svelte

## Alternatives

- [@oh-my-pi/pi-natives](https://npm.io/package/@oh-my-pi/pi-natives.md) — 51.8K weekly downloads
- [@capgo/capacitor-light-sensor](https://npm.io/package/@capgo/capacitor-light-sensor.md) — 3.0K weekly downloads
- [@heyhuynhgiabuu/pi-diff](https://npm.io/package/@heyhuynhgiabuu/pi-diff.md) — 492 weekly downloads
- [@lotsa/verdant-lang-asm](https://npm.io/package/@lotsa/verdant-lang-asm.md) — 38 weekly downloads
- [new-era-syntax](https://npm.io/package/new-era-syntax.md) — 20 weekly downloads

## Recent versions

- 0.5.0 (latest) — 2022-02-19
- 0.4.7 — 2020-08-09
- 0.4.6 — 2019-11-26
- 0.4.5 — 2019-11-26
- 0.4.4 — 2019-11-26
- 0.4.3 — 2019-11-24
- 0.4.2 — 2019-11-24
- 0.4.1 — 2019-11-24
- 0.4.0 — 2019-11-24
- 0.3.0 — 2019-11-24
- 0.2.0 — 2019-11-23
- 0.1.0 — 2019-11-23

## README

# prism-svelte

Syntax highlighting for svelte code with [prismjs].

## install

```bash
npm i prism-svelte # or yarn add prism-svelte
```

## Usage

Import `prismjs` then import `prism-svelte` (the order is very important) and it should work:

```js
import Prism from 'prismjs';
import 'prism-svelte';

const source = `
<script>
  let count = 0;
</script>

<button on:click={ () => count++ }>Hello</button>

<h1>{ count }</h1>

<ul>
  {#each Array(10).map((_, i) => i) as }
    <li on:click={() => count = i}>Set count to {i}</li>
  {/each}
</ul>
`;

const highlighted = Prism.highlight(source, Prism.languages.svelte, 'svelte');
```

[prismjs]: https://prismjs.com/

---
_Source: https://npm.io/package/prism-svelte · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
