Ensolabs just dropped codimg, a delightfully minimal tool that converts code into syntax-highlighted SVG output you can embed anywhere an image goes. The project solves a painfully specific problem: getting code snippets to render correctly in WYSIWYG editors like Webflow's, without losing formatting or dealing with broken paste operations.
Why This Exists
The project's README gets straight to the point—this was built out of necessity when Ensolabs' consultancy blog ran on Webflow and they needed a way to display code examples that actually worked. Rather than fighting with rich text editors or wrestling with third-party embeds, they went stateless: code in via query parameter, SVG out. No storage, no backend complexity, just pure transformation. The architecture is refreshingly simple. Send your code as the input query parameter to /code.svg, optionally specify a language with the lang param, and get back a crisp SVG render. The live demo at codimg.alwaysdata.net shows it handling Go snippets cleanly, but the system accepts any Chroma lexer you can throw at it—Python, JavaScript, Elm, Rust, whatever your stack demands.
Handling Larger Code Blocks
URLs can get unwieldy when you're embedding substantial snippets. Codimg addresses this by accepting base64-encoded, deflate-compressed code in the input parameter. The service auto-detects this format transparently, keeping those embed URLs short and sane. You can leave the lang parameter off entirely for auto-detection, though explicitly setting it ensures consistent rendering across contexts. The usage pattern is dead simple: drop an tag with the codimg URL as the source, or use standard markdown image syntax. Since it's just a GET request returning valid SVG, it works in newsletters, static sites, documentation platforms—anywhere images render but code blocks might not cooperate.
Key Takeaways
- Stateless design means no database to maintain or data to lose
- Chroma lexer support covers virtually any language you need
- Base64/deflate compression keeps URLs manageable for larger snippets
- Drop-in
compatibility makes integration frictionless
The Bottom Line
This is the kind of focused utility that hacker culture loves—solve one problem, do it well, ship it. Codimg won't win awards for complexity, but it'll save you hours wrestling with code embedding on platforms that weren't built for developers. Bookmark that demo URL.