ELSEIF
Your brief EB
368 stories from 111 feeds 418 clusters Refreshed 6 minutes ago next pull 18:52

TECH Signal 398

MicroLighter ships a 2kb client-side syntax highlighter built on the CSS Custom Highlights API

Illustration only Photo by Tim Simon on Unsplash

MicroLighter is a new zero-dependency client-side syntax highlighter that uses the CSS Custom Highlights API and Textmate grammars, with on-demand language loading and light-dark themes.

WHY IT MATTERS

For engineers who embed code in static sites, MicroLighter offers a way to highlight syntax without DOM mutation or span injection, using the browser's native Highlight API. It keeps the bundle small by loading grammars on demand and moves extra UI features into a custom element. The trade-off is that the CSS ::highlight() pseudo-element does not support italics, bold, or font swapping, so styling is limited to color and background.

Written by elseif from the cluster below · every claim links back to a source

The three things worth knowing

01

MicroLighter uses the CSS Custom Highlights API to avoid DOM mutation and span injection.

02

It loads Textmate language grammars on demand, keeping the core library around 2kb minified and gzipped.

03

Extra features like line numbers and copy controls are moved to a <micro-lighter> custom element.

THE CLUSTER

Same story, 1 feed.

ORDERED BY FIRST SEEN
daverupert.com via Lobsters Introducing Microlighter Open ↗