marijnh/CodeMirror — pull request #2107 by mcavalletto (2014-01-05 22:42:23+00:00)
Title: In HTML Mixed mode, include mode names among classes.

When using CodeMirror's standard HTML Mixed mode, the stylesheet provided by a theme is not able to differentiate between tokens parsed by the HTML, CSS, or JavaScript modes, so it can not provide separate styles for types that occur in multiple modes, like CSS strings versus JavaScript strings, and it can not highlight all occurrences of CSS or JavaScript by giving them a distinctive typeface or background color.

These changes cause the HTML Mixed parser to mark each output token with an additional class name reflecting the mode which parsed it: cm-html, cm-css, or cm-javascript.

With that in place, themes can define styles based on the mode -- .cm-javascript { background: yellow } -- or combining the mode and token type -- .cm-javascript.cm-string { color: green }.

Includes a test script with a few basic tests.