fuz_code
syntax styling utilities and components for TypeScript, Svelte, and Markdown 🎨
npm i -D @fuzdev/fuz_code
🎨
docs
fuz_code is a library for syntax highlighting. It can output strings of HTML and Svelte components, and it has a preprocessor for static compilation. It's based on Prism (prismjs.com) by Lea Verou. More at the docs.
To use fuz_css with Svelte, import the theme CSS file and Code component:
import '@fuzdev/fuz_code/theme.css';
import Code from '@fuzdev/fuz_code/Code.svelte'; Svelte highlights by default:
<Code content={'<h1>hello {name}</h1>'} /> <h1>hello {name}</h1> Set lang for other languages:
<Code lang="ts" content="const x: number = 42;" /> const x: number = 42; <Code lang="css" content={".card { color: var(--color_a); }"} /> .card { color: var(--color_a); } See the docs for more.