I’m making a CodeMirror editor that needs to support both HTML & JS, but not at once — it’s an either-or situation.
The problem is that it seems CodeMirror sets the data-language
attribute depending on which language has higher priority in the extension list, i.e.,
extensions: [html(), javascript()]
gets data-language="html"
and so only HTML will be correctly highlighted, or
extensions: [javascript(), html()]
gets me data-language="javascript"
and broken HTML highlighting.
I don’t need multi-language support (well, beyond what HTML already offers), I just need CodeMirror to be smart enough to figure out what it’s looking at and toggle accordingly.