A CodeMirror "simple mode" allows you to define a bunch of regex rules that capture chunks of text and apply styles to them. A regex rule can also be used to transition to another mode that has been defined. Here's a really simple example of that:
CodeMirror.defineSimpleMode("simplemode", {
start: [
{regex: /\[/, token: "meta", mode: {spec: "javascript", end: /\]/}}
]
});
This just grabs chunks of text that are surrounded by square brackets and applies the JavaScript mode stylings to it. Here's a working example of that on jsbin.
It produces text stylings like this:
But what if I wanted to make it so it looked something like this:
In other words, I want to apply a background "highlight" to the whole captured JavaScript group. Is there a simple way to do that, or is this beyond the scope of simple modes?

