I looked at the example a few times and I am at a loss on how to proceed. Maybe I can try again in a couple weeks with a fresh set of eyes.
I did find from Codemirror 1 (!) a freemarker parser
I also found someone wrote a parser for codemirror 5 that looks like it is what I would want, but alas, it is for version 5.