npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

@ryanatkn/fuz_code

v0.36.0

Published

syntax styling utilities and components for TypeScript, Svelte, and Markdown

Readme

@ryanatkn/fuz_code

syntax styling utilities and components for TypeScript, Svelte, and Markdown 🎨

code.fuz.dev

fuz_code is a rework of Prism (prismjs.com). The main changes:

  • has a minimal and explicit API to generate stylized HTML, and knows nothing about the DOM
  • uses stateless ES modules, instead of globals with side effects and pseudo-module behaviors
  • has various incompatible changes, so using Prism grammars requires some tweaks
  • smaller (by 7kB minified and 3kB gzipped, ~1/3 less)
  • written in TypeScript
  • is a fork, see the MIT license

Like Prism, there are zero dependencies (unless you count Prism's @types/prismjs), but there are two optional dependencies:

Compared to Shiki, this library is much lighter (with its faster shiki/engine/javascript, 503kB minified to 16kB, 63kb gzipped to 5.6kB), and vastly faster for runtime usage because it uses JS regexps instead of the Onigurama regexp engine used by TextMate grammars. Shiki also has 38 dependencies instead of 0. However this is not a fair comparison because Prism grammars are much simpler and less powerful than TextMate's, and Shiki is designed mainly for buildtime usage.

Usage

npm i -D @ryanatkn/fuz_code
<script lang="ts">
	import Code from '@ryanatkn/fuz_code/Code.svelte';
</script>

<!-- defaults to Svelte -->
<Code content={svelte_code} />
<!-- select a lang -->
<Code content={ts_code} lang="ts" />
import {syntax_styler_global} from '@ryanatkn/fuz_code/syntax_styler_global.js';

// Generate HTML with syntax highlighting
const html = syntax_styler_global.stylize(code, 'ts');

// Get raw tokens for custom processing
import {tokenize_syntax} from '@ryanatkn/fuz_code/tokenize_syntax.js';
const tokens = tokenize_syntax(code, syntax_styler_global.get_lang('ts'));

Themes are just CSS files, so they work with any JS framework.

With SvelteKit:

// +layout.svelte
import '@ryanatkn/fuz_code/theme.css';

The primary themes (currently just one) have a dependency on my CSS library Moss for color-scheme awareness. See the Moss docs for its usage.

If you're not using Moss, import theme_variables.css alongside theme.css:

// Without Moss:
import '@ryanatkn/fuz_code/theme.css';
import '@ryanatkn/fuz_code/theme_variables.css';

Modules

I encourage you to poke around src/lib if you're interested in using fuz_code.

Grammars

Enabled by default in syntax_styler_global:

More

Docs are a work in progress:

Please open issues if you need any help.

Experimental highlight support

For browsers that support the CSS Custom Highlight API, fuz_code provides an experimental component that can use native browser highlighting as an alternative to HTML generation.

This feature is experimental, browser support is limited, and there can be subtle differences because some CSS like bold/italics are not supported. (nor are font sizes and other layout-affecting styles, in case your theme uses those) The standard Code.svelte component using HTML generation is recommended for most use cases.

<script lang="ts">
	import CodeHighlight from '@ryanatkn/fuz_code/CodeHighlight.svelte';
</script>

<!-- auto-detect and use CSS Highlight API when available -->
<CodeHighlight content={code} mode="auto" />
<!-- force HTML mode -->
<CodeHighlight content={code} mode="html" />
<!-- force ranges mode (requires browser support) -->
<CodeHighlight content={code} mode="ranges" />

When using the experimental highlight component, import the corresponding theme:

// instead of theme.css, import theme_highlight.css in +layout.svelte:
import '@ryanatkn/fuz_code/theme_highlight.css';

Experimental modules:

License 🐦

based on Prism by Lea Verou

the Svelte grammar is based on prism-svelte by @pngwn

MIT