Glow: Syntax Highlighting for Clojure Source Code

Today I'm happy to announce the release of Glow, a very small library for syntax highlighting strings of Clojure source code.

Motivation

You may be thinking to yourself: why did you write this? After all, Ultra and Whidbey already provide syntax highlighting at the REPL, and you can pretty-print most EDN and Clojure objects using the underlying pretty-printing engines, Fipp and Puget.

The short answer is that I really, really wanted a way to get a syntax-highlighted drop-in solution for clojure.repl/source which I could inject into Ultra. The current functionality (in ultra.repl) relies on the (somewhat questionable) use of read-string to accomplish syntax highlighting via Puget, which unfortunately also does macro expansion and hides metadata.

Most of the time, macro expansion isn't a problem, but if I want to quickly look at the source code for something (e.g., a macro), I don't want to be looking at what could potentially be an extremely large macro-expanded form.

Similarly, I don't want any attached metadata to be hidden from me either. I want to look at the code as it was written.