Colorize only server side

I’d like to use the standalone colorize method on the server to generate static previews of code that are colorized the same way the dynamic version is. Has anyone done this, or come up with a way?

I very quickly came across this project, which seems to fit the bill:
https://www.npmjs.com/package/codemirror-highlight

The bin/source-highlight file is a node script that does exactly this. You can use it as-is or look at its source to pick out the relevant pieces.

Perfect, thanks.