
Security News
Django Joins curl in Pushing Back on AI Slop Security Reports
Django has updated its security policies to reject AI-generated vulnerability reports that include fabricated or unverifiable content.
svelte-highlight
Advanced tools
Syntax Highlighting for Svelte using highlight.js.
This component wraps highlight.js to provide syntax highlighting in Svelte 3.
yarn add svelte-highlight
<script>
import Highlight from 'svelte-highlight';
import { typescript } from 'svelte-highlight/languages';
import 'svelte-highlight/styles/github.css';
</script>
<Highlight language={typescript}>
{`function add(a: number, b: number) {
return a + b;
}
const sum = add(1, 2);`}
</Highlight>
Note: Importing a CSS file in a Svelte file requires the appropriate CSS loader. Refer to the rollup and webpack examples for sample set-ups.
In case you do not want to include a CSS loader, this component exports highlight.js themes in JavaScript. You can import the theme as JavaScript and inject it using the svelte:head API.
<script>
import Highlight from 'svelte-highlight';
import { typescript } from 'svelte-highlight/languages';
import { github } from 'svelte-highlight/styles';
</script>
<svelte:head>
{@html github}
</svelte:head>
<Highlight language={typescript}>
{`function add(a: number, b: number) {
return a + b;
}
const sum = add(1, 2);`}
</Highlight>
0.2.0 - 2019-11-10
FAQs
Svelte component library for highlighting code using highlight.js
The npm package svelte-highlight receives a total of 9,586 weekly downloads. As such, svelte-highlight popularity was classified as popular.
We found that svelte-highlight demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
Django has updated its security policies to reject AI-generated vulnerability reports that include fabricated or unverifiable content.
Security News
ECMAScript 2025 introduces Iterator Helpers, Set methods, JSON modules, and more in its latest spec update approved by Ecma in June 2025.
Security News
A new Node.js homepage button linking to paid support for EOL versions has sparked a heated discussion among contributors and the wider community.