3 hours ago · Tech · 0 comments

I made a new major mode for emacs: mixed-html-mode. Or, really, Claude Code made one at my direction. It does syntax highlighting in HTML files with inline CSS and JS. I had two goals, which weren't met by any mode I could find: Does not freeze, flash, or stutter, even on huge files on slow machines. Does not get confused about whether a portion of a file is HTML vs CSS vs JS. The initial insight was that how browsers decide what text is HTML vs CSS vs JS is super simple: scanning for literal <script> and <style> tags. I pulled some tricky examples, described what I wanted, and then iterated for about an hour until I had something that worked well. Then I tried to use it to write something for real, ran into a few other irritations, had Claude fix those, and now I have something I'm enjoying a lot. It's mildly faster than web-mode (and much simpler, and easier to install), and far faster than html-ts-mode. And unlike mhtml-mode it doesn't get confused by quotes. The biggest drawback…

No comments yet. Log in to reply on the Fediverse. Comments will appear here.