A component to show highlighted code using
Prism.js
. The component highlights the supplied code reactively, but doesn't load any
languages by default. You can decide which languages you would like to load,
as well as external libraries and the theme.
It is recommended to wrap the Highlighter component in another component which
imports the necessary languages and themes to avoid duplicated logic.
If you have a large code sample you would like to keep separate,
vite allows you to import files as a string.
For example:
import code from './code.svelte?raw';