[d24f17c] | 1 | const MODES = (hljs) => {
|
---|
| 2 | return {
|
---|
| 3 | IMPORTANT: {
|
---|
| 4 | className: 'meta',
|
---|
| 5 | begin: '!important'
|
---|
| 6 | },
|
---|
| 7 | HEXCOLOR: {
|
---|
| 8 | className: 'number',
|
---|
| 9 | begin: '#([a-fA-F0-9]{6}|[a-fA-F0-9]{3})'
|
---|
| 10 | },
|
---|
| 11 | ATTRIBUTE_SELECTOR_MODE: {
|
---|
| 12 | className: 'selector-attr',
|
---|
| 13 | begin: /\[/,
|
---|
| 14 | end: /\]/,
|
---|
| 15 | illegal: '$',
|
---|
| 16 | contains: [
|
---|
| 17 | hljs.APOS_STRING_MODE,
|
---|
| 18 | hljs.QUOTE_STRING_MODE
|
---|
| 19 | ]
|
---|
| 20 | }
|
---|
| 21 | };
|
---|
| 22 | };
|
---|
| 23 |
|
---|
| 24 | const TAGS = [
|
---|
| 25 | 'a',
|
---|
| 26 | 'abbr',
|
---|
| 27 | 'address',
|
---|
| 28 | 'article',
|
---|
| 29 | 'aside',
|
---|
| 30 | 'audio',
|
---|
| 31 | 'b',
|
---|
| 32 | 'blockquote',
|
---|
| 33 | 'body',
|
---|
| 34 | 'button',
|
---|
| 35 | 'canvas',
|
---|
| 36 | 'caption',
|
---|
| 37 | 'cite',
|
---|
| 38 | 'code',
|
---|
| 39 | 'dd',
|
---|
| 40 | 'del',
|
---|
| 41 | 'details',
|
---|
| 42 | 'dfn',
|
---|
| 43 | 'div',
|
---|
| 44 | 'dl',
|
---|
| 45 | 'dt',
|
---|
| 46 | 'em',
|
---|
| 47 | 'fieldset',
|
---|
| 48 | 'figcaption',
|
---|
| 49 | 'figure',
|
---|
| 50 | 'footer',
|
---|
| 51 | 'form',
|
---|
| 52 | 'h1',
|
---|
| 53 | 'h2',
|
---|
| 54 | 'h3',
|
---|
| 55 | 'h4',
|
---|
| 56 | 'h5',
|
---|
| 57 | 'h6',
|
---|
| 58 | 'header',
|
---|
| 59 | 'hgroup',
|
---|
| 60 | 'html',
|
---|
| 61 | 'i',
|
---|
| 62 | 'iframe',
|
---|
| 63 | 'img',
|
---|
| 64 | 'input',
|
---|
| 65 | 'ins',
|
---|
| 66 | 'kbd',
|
---|
| 67 | 'label',
|
---|
| 68 | 'legend',
|
---|
| 69 | 'li',
|
---|
| 70 | 'main',
|
---|
| 71 | 'mark',
|
---|
| 72 | 'menu',
|
---|
| 73 | 'nav',
|
---|
| 74 | 'object',
|
---|
| 75 | 'ol',
|
---|
| 76 | 'p',
|
---|
| 77 | 'q',
|
---|
| 78 | 'quote',
|
---|
| 79 | 'samp',
|
---|
| 80 | 'section',
|
---|
| 81 | 'span',
|
---|
| 82 | 'strong',
|
---|
| 83 | 'summary',
|
---|
| 84 | 'sup',
|
---|
| 85 | 'table',
|
---|
| 86 | 'tbody',
|
---|
| 87 | 'td',
|
---|
| 88 | 'textarea',
|
---|
| 89 | 'tfoot',
|
---|
| 90 | 'th',
|
---|
| 91 | 'thead',
|
---|
| 92 | 'time',
|
---|
| 93 | 'tr',
|
---|
| 94 | 'ul',
|
---|
| 95 | 'var',
|
---|
| 96 | 'video'
|
---|
| 97 | ];
|
---|
| 98 |
|
---|
| 99 | const MEDIA_FEATURES = [
|
---|
| 100 | 'any-hover',
|
---|
| 101 | 'any-pointer',
|
---|
| 102 | 'aspect-ratio',
|
---|
| 103 | 'color',
|
---|
| 104 | 'color-gamut',
|
---|
| 105 | 'color-index',
|
---|
| 106 | 'device-aspect-ratio',
|
---|
| 107 | 'device-height',
|
---|
| 108 | 'device-width',
|
---|
| 109 | 'display-mode',
|
---|
| 110 | 'forced-colors',
|
---|
| 111 | 'grid',
|
---|
| 112 | 'height',
|
---|
| 113 | 'hover',
|
---|
| 114 | 'inverted-colors',
|
---|
| 115 | 'monochrome',
|
---|
| 116 | 'orientation',
|
---|
| 117 | 'overflow-block',
|
---|
| 118 | 'overflow-inline',
|
---|
| 119 | 'pointer',
|
---|
| 120 | 'prefers-color-scheme',
|
---|
| 121 | 'prefers-contrast',
|
---|
| 122 | 'prefers-reduced-motion',
|
---|
| 123 | 'prefers-reduced-transparency',
|
---|
| 124 | 'resolution',
|
---|
| 125 | 'scan',
|
---|
| 126 | 'scripting',
|
---|
| 127 | 'update',
|
---|
| 128 | 'width',
|
---|
| 129 | // TODO: find a better solution?
|
---|
| 130 | 'min-width',
|
---|
| 131 | 'max-width',
|
---|
| 132 | 'min-height',
|
---|
| 133 | 'max-height'
|
---|
| 134 | ];
|
---|
| 135 |
|
---|
| 136 | // https://developer.mozilla.org/en-US/docs/Web/CSS/Pseudo-classes
|
---|
| 137 | const PSEUDO_CLASSES = [
|
---|
| 138 | 'active',
|
---|
| 139 | 'any-link',
|
---|
| 140 | 'blank',
|
---|
| 141 | 'checked',
|
---|
| 142 | 'current',
|
---|
| 143 | 'default',
|
---|
| 144 | 'defined',
|
---|
| 145 | 'dir', // dir()
|
---|
| 146 | 'disabled',
|
---|
| 147 | 'drop',
|
---|
| 148 | 'empty',
|
---|
| 149 | 'enabled',
|
---|
| 150 | 'first',
|
---|
| 151 | 'first-child',
|
---|
| 152 | 'first-of-type',
|
---|
| 153 | 'fullscreen',
|
---|
| 154 | 'future',
|
---|
| 155 | 'focus',
|
---|
| 156 | 'focus-visible',
|
---|
| 157 | 'focus-within',
|
---|
| 158 | 'has', // has()
|
---|
| 159 | 'host', // host or host()
|
---|
| 160 | 'host-context', // host-context()
|
---|
| 161 | 'hover',
|
---|
| 162 | 'indeterminate',
|
---|
| 163 | 'in-range',
|
---|
| 164 | 'invalid',
|
---|
| 165 | 'is', // is()
|
---|
| 166 | 'lang', // lang()
|
---|
| 167 | 'last-child',
|
---|
| 168 | 'last-of-type',
|
---|
| 169 | 'left',
|
---|
| 170 | 'link',
|
---|
| 171 | 'local-link',
|
---|
| 172 | 'not', // not()
|
---|
| 173 | 'nth-child', // nth-child()
|
---|
| 174 | 'nth-col', // nth-col()
|
---|
| 175 | 'nth-last-child', // nth-last-child()
|
---|
| 176 | 'nth-last-col', // nth-last-col()
|
---|
| 177 | 'nth-last-of-type', //nth-last-of-type()
|
---|
| 178 | 'nth-of-type', //nth-of-type()
|
---|
| 179 | 'only-child',
|
---|
| 180 | 'only-of-type',
|
---|
| 181 | 'optional',
|
---|
| 182 | 'out-of-range',
|
---|
| 183 | 'past',
|
---|
| 184 | 'placeholder-shown',
|
---|
| 185 | 'read-only',
|
---|
| 186 | 'read-write',
|
---|
| 187 | 'required',
|
---|
| 188 | 'right',
|
---|
| 189 | 'root',
|
---|
| 190 | 'scope',
|
---|
| 191 | 'target',
|
---|
| 192 | 'target-within',
|
---|
| 193 | 'user-invalid',
|
---|
| 194 | 'valid',
|
---|
| 195 | 'visited',
|
---|
| 196 | 'where' // where()
|
---|
| 197 | ];
|
---|
| 198 |
|
---|
| 199 | // https://developer.mozilla.org/en-US/docs/Web/CSS/Pseudo-elements
|
---|
| 200 | const PSEUDO_ELEMENTS = [
|
---|
| 201 | 'after',
|
---|
| 202 | 'backdrop',
|
---|
| 203 | 'before',
|
---|
| 204 | 'cue',
|
---|
| 205 | 'cue-region',
|
---|
| 206 | 'first-letter',
|
---|
| 207 | 'first-line',
|
---|
| 208 | 'grammar-error',
|
---|
| 209 | 'marker',
|
---|
| 210 | 'part',
|
---|
| 211 | 'placeholder',
|
---|
| 212 | 'selection',
|
---|
| 213 | 'slotted',
|
---|
| 214 | 'spelling-error'
|
---|
| 215 | ];
|
---|
| 216 |
|
---|
| 217 | const ATTRIBUTES = [
|
---|
| 218 | 'align-content',
|
---|
| 219 | 'align-items',
|
---|
| 220 | 'align-self',
|
---|
| 221 | 'animation',
|
---|
| 222 | 'animation-delay',
|
---|
| 223 | 'animation-direction',
|
---|
| 224 | 'animation-duration',
|
---|
| 225 | 'animation-fill-mode',
|
---|
| 226 | 'animation-iteration-count',
|
---|
| 227 | 'animation-name',
|
---|
| 228 | 'animation-play-state',
|
---|
| 229 | 'animation-timing-function',
|
---|
| 230 | 'auto',
|
---|
| 231 | 'backface-visibility',
|
---|
| 232 | 'background',
|
---|
| 233 | 'background-attachment',
|
---|
| 234 | 'background-clip',
|
---|
| 235 | 'background-color',
|
---|
| 236 | 'background-image',
|
---|
| 237 | 'background-origin',
|
---|
| 238 | 'background-position',
|
---|
| 239 | 'background-repeat',
|
---|
| 240 | 'background-size',
|
---|
| 241 | 'border',
|
---|
| 242 | 'border-bottom',
|
---|
| 243 | 'border-bottom-color',
|
---|
| 244 | 'border-bottom-left-radius',
|
---|
| 245 | 'border-bottom-right-radius',
|
---|
| 246 | 'border-bottom-style',
|
---|
| 247 | 'border-bottom-width',
|
---|
| 248 | 'border-collapse',
|
---|
| 249 | 'border-color',
|
---|
| 250 | 'border-image',
|
---|
| 251 | 'border-image-outset',
|
---|
| 252 | 'border-image-repeat',
|
---|
| 253 | 'border-image-slice',
|
---|
| 254 | 'border-image-source',
|
---|
| 255 | 'border-image-width',
|
---|
| 256 | 'border-left',
|
---|
| 257 | 'border-left-color',
|
---|
| 258 | 'border-left-style',
|
---|
| 259 | 'border-left-width',
|
---|
| 260 | 'border-radius',
|
---|
| 261 | 'border-right',
|
---|
| 262 | 'border-right-color',
|
---|
| 263 | 'border-right-style',
|
---|
| 264 | 'border-right-width',
|
---|
| 265 | 'border-spacing',
|
---|
| 266 | 'border-style',
|
---|
| 267 | 'border-top',
|
---|
| 268 | 'border-top-color',
|
---|
| 269 | 'border-top-left-radius',
|
---|
| 270 | 'border-top-right-radius',
|
---|
| 271 | 'border-top-style',
|
---|
| 272 | 'border-top-width',
|
---|
| 273 | 'border-width',
|
---|
| 274 | 'bottom',
|
---|
| 275 | 'box-decoration-break',
|
---|
| 276 | 'box-shadow',
|
---|
| 277 | 'box-sizing',
|
---|
| 278 | 'break-after',
|
---|
| 279 | 'break-before',
|
---|
| 280 | 'break-inside',
|
---|
| 281 | 'caption-side',
|
---|
| 282 | 'clear',
|
---|
| 283 | 'clip',
|
---|
| 284 | 'clip-path',
|
---|
| 285 | 'color',
|
---|
| 286 | 'column-count',
|
---|
| 287 | 'column-fill',
|
---|
| 288 | 'column-gap',
|
---|
| 289 | 'column-rule',
|
---|
| 290 | 'column-rule-color',
|
---|
| 291 | 'column-rule-style',
|
---|
| 292 | 'column-rule-width',
|
---|
| 293 | 'column-span',
|
---|
| 294 | 'column-width',
|
---|
| 295 | 'columns',
|
---|
| 296 | 'content',
|
---|
| 297 | 'counter-increment',
|
---|
| 298 | 'counter-reset',
|
---|
| 299 | 'cursor',
|
---|
| 300 | 'direction',
|
---|
| 301 | 'display',
|
---|
| 302 | 'empty-cells',
|
---|
| 303 | 'filter',
|
---|
| 304 | 'flex',
|
---|
| 305 | 'flex-basis',
|
---|
| 306 | 'flex-direction',
|
---|
| 307 | 'flex-flow',
|
---|
| 308 | 'flex-grow',
|
---|
| 309 | 'flex-shrink',
|
---|
| 310 | 'flex-wrap',
|
---|
| 311 | 'float',
|
---|
| 312 | 'font',
|
---|
| 313 | 'font-display',
|
---|
| 314 | 'font-family',
|
---|
| 315 | 'font-feature-settings',
|
---|
| 316 | 'font-kerning',
|
---|
| 317 | 'font-language-override',
|
---|
| 318 | 'font-size',
|
---|
| 319 | 'font-size-adjust',
|
---|
| 320 | 'font-smoothing',
|
---|
| 321 | 'font-stretch',
|
---|
| 322 | 'font-style',
|
---|
| 323 | 'font-variant',
|
---|
| 324 | 'font-variant-ligatures',
|
---|
| 325 | 'font-variation-settings',
|
---|
| 326 | 'font-weight',
|
---|
| 327 | 'height',
|
---|
| 328 | 'hyphens',
|
---|
| 329 | 'icon',
|
---|
| 330 | 'image-orientation',
|
---|
| 331 | 'image-rendering',
|
---|
| 332 | 'image-resolution',
|
---|
| 333 | 'ime-mode',
|
---|
| 334 | 'inherit',
|
---|
| 335 | 'initial',
|
---|
| 336 | 'justify-content',
|
---|
| 337 | 'left',
|
---|
| 338 | 'letter-spacing',
|
---|
| 339 | 'line-height',
|
---|
| 340 | 'list-style',
|
---|
| 341 | 'list-style-image',
|
---|
| 342 | 'list-style-position',
|
---|
| 343 | 'list-style-type',
|
---|
| 344 | 'margin',
|
---|
| 345 | 'margin-bottom',
|
---|
| 346 | 'margin-left',
|
---|
| 347 | 'margin-right',
|
---|
| 348 | 'margin-top',
|
---|
| 349 | 'marks',
|
---|
| 350 | 'mask',
|
---|
| 351 | 'max-height',
|
---|
| 352 | 'max-width',
|
---|
| 353 | 'min-height',
|
---|
| 354 | 'min-width',
|
---|
| 355 | 'nav-down',
|
---|
| 356 | 'nav-index',
|
---|
| 357 | 'nav-left',
|
---|
| 358 | 'nav-right',
|
---|
| 359 | 'nav-up',
|
---|
| 360 | 'none',
|
---|
| 361 | 'normal',
|
---|
| 362 | 'object-fit',
|
---|
| 363 | 'object-position',
|
---|
| 364 | 'opacity',
|
---|
| 365 | 'order',
|
---|
| 366 | 'orphans',
|
---|
| 367 | 'outline',
|
---|
| 368 | 'outline-color',
|
---|
| 369 | 'outline-offset',
|
---|
| 370 | 'outline-style',
|
---|
| 371 | 'outline-width',
|
---|
| 372 | 'overflow',
|
---|
| 373 | 'overflow-wrap',
|
---|
| 374 | 'overflow-x',
|
---|
| 375 | 'overflow-y',
|
---|
| 376 | 'padding',
|
---|
| 377 | 'padding-bottom',
|
---|
| 378 | 'padding-left',
|
---|
| 379 | 'padding-right',
|
---|
| 380 | 'padding-top',
|
---|
| 381 | 'page-break-after',
|
---|
| 382 | 'page-break-before',
|
---|
| 383 | 'page-break-inside',
|
---|
| 384 | 'perspective',
|
---|
| 385 | 'perspective-origin',
|
---|
| 386 | 'pointer-events',
|
---|
| 387 | 'position',
|
---|
| 388 | 'quotes',
|
---|
| 389 | 'resize',
|
---|
| 390 | 'right',
|
---|
| 391 | 'src', // @font-face
|
---|
| 392 | 'tab-size',
|
---|
| 393 | 'table-layout',
|
---|
| 394 | 'text-align',
|
---|
| 395 | 'text-align-last',
|
---|
| 396 | 'text-decoration',
|
---|
| 397 | 'text-decoration-color',
|
---|
| 398 | 'text-decoration-line',
|
---|
| 399 | 'text-decoration-style',
|
---|
| 400 | 'text-indent',
|
---|
| 401 | 'text-overflow',
|
---|
| 402 | 'text-rendering',
|
---|
| 403 | 'text-shadow',
|
---|
| 404 | 'text-transform',
|
---|
| 405 | 'text-underline-position',
|
---|
| 406 | 'top',
|
---|
| 407 | 'transform',
|
---|
| 408 | 'transform-origin',
|
---|
| 409 | 'transform-style',
|
---|
| 410 | 'transition',
|
---|
| 411 | 'transition-delay',
|
---|
| 412 | 'transition-duration',
|
---|
| 413 | 'transition-property',
|
---|
| 414 | 'transition-timing-function',
|
---|
| 415 | 'unicode-bidi',
|
---|
| 416 | 'vertical-align',
|
---|
| 417 | 'visibility',
|
---|
| 418 | 'white-space',
|
---|
| 419 | 'widows',
|
---|
| 420 | 'width',
|
---|
| 421 | 'word-break',
|
---|
| 422 | 'word-spacing',
|
---|
| 423 | 'word-wrap',
|
---|
| 424 | 'z-index'
|
---|
| 425 | // reverse makes sure longer attributes `font-weight` are matched fully
|
---|
| 426 | // instead of getting false positives on say `font`
|
---|
| 427 | ].reverse();
|
---|
| 428 |
|
---|
| 429 | /**
|
---|
| 430 | * @param {string} value
|
---|
| 431 | * @returns {RegExp}
|
---|
| 432 | * */
|
---|
| 433 |
|
---|
| 434 | /**
|
---|
| 435 | * @param {RegExp | string } re
|
---|
| 436 | * @returns {string}
|
---|
| 437 | */
|
---|
| 438 | function source(re) {
|
---|
| 439 | if (!re) return null;
|
---|
| 440 | if (typeof re === "string") return re;
|
---|
| 441 |
|
---|
| 442 | return re.source;
|
---|
| 443 | }
|
---|
| 444 |
|
---|
| 445 | /**
|
---|
| 446 | * @param {RegExp | string } re
|
---|
| 447 | * @returns {string}
|
---|
| 448 | */
|
---|
| 449 | function lookahead(re) {
|
---|
| 450 | return concat('(?=', re, ')');
|
---|
| 451 | }
|
---|
| 452 |
|
---|
| 453 | /**
|
---|
| 454 | * @param {...(RegExp | string) } args
|
---|
| 455 | * @returns {string}
|
---|
| 456 | */
|
---|
| 457 | function concat(...args) {
|
---|
| 458 | const joined = args.map((x) => source(x)).join("");
|
---|
| 459 | return joined;
|
---|
| 460 | }
|
---|
| 461 |
|
---|
| 462 | /*
|
---|
| 463 | Language: CSS
|
---|
| 464 | Category: common, css
|
---|
| 465 | Website: https://developer.mozilla.org/en-US/docs/Web/CSS
|
---|
| 466 | */
|
---|
| 467 |
|
---|
| 468 | /** @type LanguageFn */
|
---|
| 469 | function css(hljs) {
|
---|
| 470 | const modes = MODES(hljs);
|
---|
| 471 | const FUNCTION_DISPATCH = {
|
---|
| 472 | className: "built_in",
|
---|
| 473 | begin: /[\w-]+(?=\()/
|
---|
| 474 | };
|
---|
| 475 | const VENDOR_PREFIX = {
|
---|
| 476 | begin: /-(webkit|moz|ms|o)-(?=[a-z])/
|
---|
| 477 | };
|
---|
| 478 | const AT_MODIFIERS = "and or not only";
|
---|
| 479 | const AT_PROPERTY_RE = /@-?\w[\w]*(-\w+)*/; // @-webkit-keyframes
|
---|
| 480 | const IDENT_RE = '[a-zA-Z-][a-zA-Z0-9_-]*';
|
---|
| 481 | const STRINGS = [
|
---|
| 482 | hljs.APOS_STRING_MODE,
|
---|
| 483 | hljs.QUOTE_STRING_MODE
|
---|
| 484 | ];
|
---|
| 485 |
|
---|
| 486 | return {
|
---|
| 487 | name: 'CSS',
|
---|
| 488 | case_insensitive: true,
|
---|
| 489 | illegal: /[=|'\$]/,
|
---|
| 490 | keywords: {
|
---|
| 491 | keyframePosition: "from to"
|
---|
| 492 | },
|
---|
| 493 | classNameAliases: {
|
---|
| 494 | // for visual continuity with `tag {}` and because we
|
---|
| 495 | // don't have a great class for this?
|
---|
| 496 | keyframePosition: "selector-tag"
|
---|
| 497 | },
|
---|
| 498 | contains: [
|
---|
| 499 | hljs.C_BLOCK_COMMENT_MODE,
|
---|
| 500 | VENDOR_PREFIX,
|
---|
| 501 | // to recognize keyframe 40% etc which are outside the scope of our
|
---|
| 502 | // attribute value mode
|
---|
| 503 | hljs.CSS_NUMBER_MODE,
|
---|
| 504 | {
|
---|
| 505 | className: 'selector-id',
|
---|
| 506 | begin: /#[A-Za-z0-9_-]+/,
|
---|
| 507 | relevance: 0
|
---|
| 508 | },
|
---|
| 509 | {
|
---|
| 510 | className: 'selector-class',
|
---|
| 511 | begin: '\\.' + IDENT_RE,
|
---|
| 512 | relevance: 0
|
---|
| 513 | },
|
---|
| 514 | modes.ATTRIBUTE_SELECTOR_MODE,
|
---|
| 515 | {
|
---|
| 516 | className: 'selector-pseudo',
|
---|
| 517 | variants: [
|
---|
| 518 | {
|
---|
| 519 | begin: ':(' + PSEUDO_CLASSES.join('|') + ')'
|
---|
| 520 | },
|
---|
| 521 | {
|
---|
| 522 | begin: '::(' + PSEUDO_ELEMENTS.join('|') + ')'
|
---|
| 523 | }
|
---|
| 524 | ]
|
---|
| 525 | },
|
---|
| 526 | // we may actually need this (12/2020)
|
---|
| 527 | // { // pseudo-selector params
|
---|
| 528 | // begin: /\(/,
|
---|
| 529 | // end: /\)/,
|
---|
| 530 | // contains: [ hljs.CSS_NUMBER_MODE ]
|
---|
| 531 | // },
|
---|
| 532 | {
|
---|
| 533 | className: 'attribute',
|
---|
| 534 | begin: '\\b(' + ATTRIBUTES.join('|') + ')\\b'
|
---|
| 535 | },
|
---|
| 536 | // attribute values
|
---|
| 537 | {
|
---|
| 538 | begin: ':',
|
---|
| 539 | end: '[;}]',
|
---|
| 540 | contains: [
|
---|
| 541 | modes.HEXCOLOR,
|
---|
| 542 | modes.IMPORTANT,
|
---|
| 543 | hljs.CSS_NUMBER_MODE,
|
---|
| 544 | ...STRINGS,
|
---|
| 545 | // needed to highlight these as strings and to avoid issues with
|
---|
| 546 | // illegal characters that might be inside urls that would tigger the
|
---|
| 547 | // languages illegal stack
|
---|
| 548 | {
|
---|
| 549 | begin: /(url|data-uri)\(/,
|
---|
| 550 | end: /\)/,
|
---|
| 551 | relevance: 0, // from keywords
|
---|
| 552 | keywords: {
|
---|
| 553 | built_in: "url data-uri"
|
---|
| 554 | },
|
---|
| 555 | contains: [
|
---|
| 556 | {
|
---|
| 557 | className: "string",
|
---|
| 558 | // any character other than `)` as in `url()` will be the start
|
---|
| 559 | // of a string, which ends with `)` (from the parent mode)
|
---|
| 560 | begin: /[^)]/,
|
---|
| 561 | endsWithParent: true,
|
---|
| 562 | excludeEnd: true
|
---|
| 563 | }
|
---|
| 564 | ]
|
---|
| 565 | },
|
---|
| 566 | FUNCTION_DISPATCH
|
---|
| 567 | ]
|
---|
| 568 | },
|
---|
| 569 | {
|
---|
| 570 | begin: lookahead(/@/),
|
---|
| 571 | end: '[{;]',
|
---|
| 572 | relevance: 0,
|
---|
| 573 | illegal: /:/, // break on Less variables @var: ...
|
---|
| 574 | contains: [
|
---|
| 575 | {
|
---|
| 576 | className: 'keyword',
|
---|
| 577 | begin: AT_PROPERTY_RE
|
---|
| 578 | },
|
---|
| 579 | {
|
---|
| 580 | begin: /\s/,
|
---|
| 581 | endsWithParent: true,
|
---|
| 582 | excludeEnd: true,
|
---|
| 583 | relevance: 0,
|
---|
| 584 | keywords: {
|
---|
| 585 | $pattern: /[a-z-]+/,
|
---|
| 586 | keyword: AT_MODIFIERS,
|
---|
| 587 | attribute: MEDIA_FEATURES.join(" ")
|
---|
| 588 | },
|
---|
| 589 | contains: [
|
---|
| 590 | {
|
---|
| 591 | begin: /[a-z-]+(?=:)/,
|
---|
| 592 | className: "attribute"
|
---|
| 593 | },
|
---|
| 594 | ...STRINGS,
|
---|
| 595 | hljs.CSS_NUMBER_MODE
|
---|
| 596 | ]
|
---|
| 597 | }
|
---|
| 598 | ]
|
---|
| 599 | },
|
---|
| 600 | {
|
---|
| 601 | className: 'selector-tag',
|
---|
| 602 | begin: '\\b(' + TAGS.join('|') + ')\\b'
|
---|
| 603 | }
|
---|
| 604 | ]
|
---|
| 605 | };
|
---|
| 606 | }
|
---|
| 607 |
|
---|
| 608 | module.exports = css;
|
---|