observablehq / feedback

Customer submitted bugs and feature requests
42 stars 3 forks source link

HTML mode: CSS var with leading dash incorrectly marked as property #385

Open mootari opened 2 years ago

mootari commented 2 years ago

Describe the bug

In Codemirror's HTML mode a custom CSS property inside a style tag will be incorrectly marked as .cmt-propertyName instead of .cmt-variableName if it starts with more than two dashes:

image

Test snippet:

<style>
body {
  -foo: 1; /* correct */
  --foo: 1; /* correct */
  ---foo: 1; /* incorrect */
}
</style>
mootari commented 2 years ago

When passed as function arguments they are marked as .cmt-atom:

image

Test snippet:

<style>
body {
  bar: var(--foo); /* correct */
  bar: var(---foo); /* incorrect */
}
</style>