I’m building a web app using CodeMirror which helps to remove redundant CSS from email templates and I want to add additional highlighting to all CSS selectors within inline HEAD styles and class names within the BODY of HTML, in inline CSS styles.
It’s easy to identify the CSS selectors in HTML HEAD style blocks — they have
But how can I add an additional class name to all classes on HTML tags within BODY?
I want to achieve this highlighting in yellow (but in CodeMirror instead of Photoshop):
Currently, in CodeMirror, all attributes on HTML tags have the same class, “cm-string”.
I saw there is
doc.markText but looks like it only adds class to manually targeted range of string, not certain attributes from HTML.