fractalsvelte mascot fractalsvelte fractalsvelte

Syntax highlighting

fractalpop

Lightweight, Svelte-first syntax highlighting with first-class indented Sass. Returns an HTML string without a DOM, with adapters for Svelte, mdsvex and remark.

v0.1.0 MIT Published 5 Oct 2026

Install

pnpm add @fractaldesign/pop

@fractaldesign/pop — The engine: code in, HTML string out.

Quick start

Anywhere
import { highlight } from '@fractaldesign/pop';

const html = highlight('const ready = true', { lang: 'ts' });
In Svelte
<script lang="ts">
	import { Code } from '@fractaldesign/pop-svelte';
</script>

<Code code={source} lang="ts" title="example.ts" lineNumbers />
svelte.config.js
import { mdsvex } from 'mdsvex';
import { fractalpopHighlighter } from '@fractaldesign/pop-mdsvex';

export default {
	extensions: ['.svelte', '.svx', '.md'],
	preprocess: [mdsvex({ extensions: ['.svx', '.md'], highlight: { highlighter: fractalpopHighlighter } })]
};
[ At a glance ]
32 Languages
5.3 KiB Gzipped
0 Runtime deps
9 Token types

Features

No DOM required

highlight() returns an HTML string, so it runs on the server, at build time, in a worker or on the edge.

Indented Sass, properly

First-class sass with no braces or semicolons, and a composite svelte grammar for script, markup and style.

Bring your own colours

Nine stable token types, each a CSS variable. A theme is one block of --fp-* custom properties.

Tree-shakeable languages

The default entry registers TypeScript and plaintext. Register more, or import /full for all 32.

A fast path by default

With no customization hooks, rendering concatenates strings with no per-token allocation.

Every pipeline covered

Svelte components and an action, an mdsvex highlighter, and a remark plugin for Markdown and MDX.

Packages

README

@fractaldesign/pop@0.1.0 README, from npm.