highlight.svelte
v0.1.2
Published
Svelte Language Definition for highlight.js with Typescript support.
Downloads
172
Maintainers
Readme
highlight.svelte
Svelte Language Definition for highlight.js with Typescript support.
Updated fork of highlightjs-svelte
Installation
npm i highlight.js highlight.svelte
Usage
Node.js / require
const hljs = require('highlight.js');
hljs.registerLanguage('svelte', require('highlight.svelte'));
const highlightedCode = hljs.highlight(code, { language: 'svelte' }).value;
ES6 Modules / import
import hljs from 'highlight.js';
import svelte from 'highlight.svelte';
hljs.registerLanguage('svelte', svelte);
const highlightedCode = hljs.highlight(code, { language: 'svelte' }).value;
Browser / cdn
<script src="https://unpkg.com/@highlightjs/[email protected]/highlight.min.js"></script>
<script src="https://unpkg.com/highlight.svelte@latest/dist/svelte.min.js"></script>
<script>
hljs.highlightAll();
</script>
<pre><code class="language-svelte">{code}</code></pre>