Get highlighted code


I open CodeMirror in a dialog where I write SourceCode with CM-functionality. When I hit the save button, I want to copy the hightlighted CM-text in a div outside of that dialog (highlighting should remain there).

I found the method getValue() where I get the string from CM without styling.
Is there a possibillity to get the highlighted html Code? Or maybe line by line with styling classes from CM?

I want to copy the codeblock exactly the way it looks in another html-element.

Every help is more than appreciated :slight_smile:

This isn’t possible, but you might get a similar effect by running runmode over the string you get.

Thanks for that quick reply!

Yes runmode could fix my problem in a good manner. I’ll try it.


EDIT: Runmode was a good tip. That worked great :slight_smile: