highlight.js: Problem with background-blend-mode in CSS

For some reason -blend-mode is out of hljs-attribute scope:

background-image: url(images/sample.png);
background-color: red;
background-blend-mode: multiply;
<span class="hljs-attribute">background</span>-blend-mode<span class="hljs-value">: multiply;</span>

screen shot 2014-08-16 at 20 14 25

About this issue

  • Original URL
  • State: closed
  • Created 10 years ago
  • Comments: 17 (11 by maintainers)

Commits related to this issue

Most upvoted comments

Yes, we could just add background-blend-mode to fix this particular case. I’ll gladly merge the pull request for that, as it won’t break anything.

This doesn’t really solve the problem though: new properties appear constantly and nobody wants to maintain it. And if you add SVG and potentially every XML application that could be styled this simply looks unfeasible.

What we could do is similar to what @tonyganch is describing: we could define “css-properties” as a separate language and use it inside CSS as well as on its own. But it’ll have to wait some time as it must be done carefully and we have a release planned for tomorrow 😃.

BTW, the approach “try everything and stick with what worked” isn’t really that slow. In fact, it’s how we do language detection: we literally try to highlight code with every language we known and stick with the one that successfully highlighted most stuff. The secret of being fast is to bail out early on obvious erros, which is why CSS defined strictly.