How to copy text with markup from codemirror editor to other application

Let’s be more specific… Top right the user enters his SQL query which get syntax highlighted. When they select this query with CTRL-A and do CTRL-C only the plain text gets copied to clipboard. When they paste into Word you will only get plain text.

In Notepad++ there’s a plugin called NppExport with the option copy RTF/HTML to clipboard. Then when you paste also the markup gets pasted.

Is there a way to accomplish the same thing in CodeMirror?