# Replacing highlight.js with microlighter and CSS Custom Highlights

DevFeed: [Replacing highlight.js with microlighter and CSS Custom Highlights](<https://devfeed.tech/articles/have-you-heard-the-good-news-about-microlighter-49239.md>)

Original publisher: [Read original article](<https://blog.jim-nielsen.com/2026/shipping-microlighter/>)

Author: Jim Nielsen

Published: 2026-08-25T19:00:00Z

Content type: article

Language: en

Sources: [Jim Nielsen's Blog](<https://devfeed.tech/sources/jim-nielsen-s-blog.md>)

Topics: [Syntax Highlighting](<https://devfeed.tech/topics/syntax-highlighting.md>), [CSS](<https://devfeed.tech/topics/css.md>), [Highlight.js](<https://devfeed.tech/topics/highlightjs.md>), [Web Development](<https://devfeed.tech/topics/web-development.md>), [web-standards](<https://devfeed.tech/topics/web-standards.md>)

Tags: [browsers](<https://devfeed.tech/tags/browsers.md>), [css](<https://devfeed.tech/tags/css.md>), [dependency](<https://devfeed.tech/tags/dependency.md>), [highlighting](<https://devfeed.tech/tags/highlighting.md>), [implementation](<https://devfeed.tech/tags/implementation.md>), [syntax-highlighting](<https://devfeed.tech/tags/syntax-highlighting.md>), [website](<https://devfeed.tech/tags/website.md>)

## AI overview

The author describes replacing highlight.js on their blog with microlighter, which uses the CSS Custom Highlights API for syntax highlighting without DOM manipulation. The change removes a dependency and loads microlighter only on relevant post pages containing code.

## Source excerpt

Dave Rupert wrote about shipping microlighter: a tool for handling syntax highlighting using the CSS Custom Highlights API. I saw his post the day he released it, and I had an implementation PR up for my blog by end of day. Then, like I do with so many things, I let it sit there. This is the period where my subconscious takes over. It does the work of, "How do I actually feel about that? Do I want to merge it? Do I have any regrets about what I did?" If I still want to merge it after a few days, that's usually a good sign that I'll be happy with the work. (Sometimes after a few days I say, "What the hell was I thinking?" and then it's easy to simply close the PR with zero regrets.) Well it's a few days later and I still feel good about it, so time to ship! My PR for this is pretty straightforward: Remove highlight.js dependency (and related plumbing) On paths that 1) match my post pages (i.e. /YYYY/:slug), and 2) have code on them, pull microlighter deps from a CDN and run it. Done. Granted, there are trade-offs to this approach. I get it. Dave's explainer for this tool on The ShopTalk Show vibed with me because I've been in his shoes many times: "Whoops, somehow syntax highlighting on my blog is broken again. Guess I need to fix it. Ugh. I've done prism, I've done highlight.js, I've done shiki. What should I do this time? Could I do this in a way that's just less?" He clarifies: I'm not coming at this like, "Everyone is doing it wrong!" I was just kind of like, "Could I do this in a way that suited me?" Well, this approach suites me. There's a kind of conceptual elegance to it where syntax highlighting lives in the realm of a styling operation rather than a content transformation plus styling. In short: syntax highlighting, i.e. styling text, is a styling concern so solve it with CSS -- no DOM manipulation required! Plus, I mean, how cool is it that the code on the website is the same as the code in the DOM?!? I guess this is how I know I still like working on the w