Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/pngwn/prism-svelte
Svelte language extension for prismjs
https://github.com/pngwn/prism-svelte
Last synced: 6 days ago
JSON representation
Svelte language extension for prismjs
- Host: GitHub
- URL: https://github.com/pngwn/prism-svelte
- Owner: pngwn
- Created: 2019-11-23T20:45:51.000Z (about 5 years ago)
- Default Branch: master
- Last Pushed: 2023-07-18T20:15:18.000Z (over 1 year ago)
- Last Synced: 2024-10-14T13:03:16.769Z (2 months ago)
- Language: JavaScript
- Size: 240 KB
- Stars: 65
- Watchers: 2
- Forks: 6
- Open Issues: 9
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
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 = `
let count = 0;
count++ }>Hello
{ count }
- count = i}>Set count to {i}
{#each Array(10).map((_, i) => i) as }
{/each}
`;
const highlighted = Prism.highlight(source, Prism.languages.svelte, 'svelte');
```
[prismjs]: https://prismjs.com/