diff --git a/mode/css/css.js b/mode/css/css.js index 77ca0c10e2..240c270a90 100644 --- a/mode/css/css.js +++ b/mode/css/css.js @@ -29,7 +29,8 @@ CodeMirror.defineMode("css", function(config, parserConfig) { valueKeywords = parserConfig.valueKeywords || {}, allowNested = parserConfig.allowNested, lineComment = parserConfig.lineComment, - supportsAtComponent = parserConfig.supportsAtComponent === true; + supportsAtComponent = parserConfig.supportsAtComponent === true, + highlightNonStandardPropertyKeywords = config.highlightNonStandardPropertyKeywords !== false; var type, override; function ret(style, tp) { type = tp; return style; } @@ -197,7 +198,7 @@ CodeMirror.defineMode("css", function(config, parserConfig) { override = "property"; return "maybeprop"; } else if (nonStandardPropertyKeywords.hasOwnProperty(word)) { - override = "string-2"; + override = highlightNonStandardPropertyKeywords ? "string-2" : "property"; return "maybeprop"; } else if (allowNested) { override = stream.match(/^\s*:(?:\s|$)/, false) ? "property" : "tag"; @@ -291,7 +292,7 @@ CodeMirror.defineMode("css", function(config, parserConfig) { else if (propertyKeywords.hasOwnProperty(word)) override = "property"; else if (nonStandardPropertyKeywords.hasOwnProperty(word)) - override = "string-2"; + override = highlightNonStandardPropertyKeywords ? "string-2" : "property"; else if (valueKeywords.hasOwnProperty(word)) override = "atom"; else if (colorKeywords.hasOwnProperty(word)) diff --git a/mode/css/index.html b/mode/css/index.html index 6588c408ac..42b327ca66 100644 --- a/mode/css/index.html +++ b/mode/css/index.html @@ -68,6 +68,12 @@

CSS mode

}); +

CSS mode supports this option:

+ +
highlightNonStandardPropertyKeywords: boolean
+
Whether to highlight non-standard CSS property keywords such as margin-inline or zoom (default: true).
+
+

MIME types defined: text/css, text/x-scss (demo), text/x-less (demo).

Parsing/Highlighting Tests: normal, verbose.