Dave Rupert introduces Microlighter, a tiny (~2KB) client-side syntax highlighter leveraging the CSS Custom Highlights API to avoid DOM mutation by using ::highlight() pseudo-elements instead of injecting spans. It relies on Textmate language grammars for multi-language support and loads grammars on-demand, addressing his need to frequently switch between languages like HTML, CSS, JS, bash, and Ruby in blog posts.
Background
Dave Rupert has used multiple syntax highlighters over the years including Highlight.js, PrismJS, Shiki, and others, finding trade-offs between client-side and server-side approaches for his Jekyll blog.
- Source
- Lobsters
- Published
- Aug 20, 2026 at 12:32 AM
- Score
- 5.0 / 10