Using CodeMirror's parser

Is it possible to just use CodeMirror’s parser to generate HTML once? Basically our use case is that we are showing readonly code (and want to use the same CodeMirror theme as our editable code on a different part of the site). As such, we don’t really need ALL the mechanics of CodeMirror, and in fact would even like to just generate the HTML on the backend in case the user doesn’t have JavaScript. Something like:

html = CodeMirrorStringToHTML(“string”, themeName);

See the runmode addon

I’m using the marked library to convert markdown to HTML. I don’t know if this is sufficient for you.