]>
luflow.net public git repositories - flow-web.git/blob - static/highlight/languages/scss.js
1 /*! `scss` grammar compiled for Highlight.js 11.11.1 */
3 var hljsGrammar
= (function () {
6 const MODES
= (hljs
) => {
12 BLOCK_COMMENT: hljs
.C_BLOCK_COMMENT_MODE
,
15 begin: /#(([0-9a-fA-F]{3,4})|(([0-9a-fA-F]{2}){3,4}))\b/
18 className: "built_in",
21 ATTRIBUTE_SELECTOR_MODE: {
22 scope: 'selector-attr',
27 hljs
.APOS_STRING_MODE
,
28 hljs
.QUOTE_STRING_MODE
33 begin: hljs
.NUMBER_RE
+ '(' +
36 '|cm|mm|in|pt|pc|px' +
37 '|deg|grad|rad|turn' +
46 begin: /--[A-Za-z_][A-Za-z0-9_-]*/
142 'feComponentTransfer',
153 'feSpecularLighting',
180 // Sorting, then reversing makes sure longer attributes/elements like
181 // `font-weight` are matched fully instead of getting false positives on say `font`
183 const MEDIA_FEATURES
= [
190 'device-aspect-ratio',
204 'prefers-color-scheme',
206 'prefers-reduced-motion',
207 'prefers-reduced-transparency',
213 // TODO: find a better solution?
220 // https://developer.mozilla.org/en-US/docs/Web/CSS/Pseudo-classes
221 const PSEUDO_CLASSES
= [
243 'host', // host or host()
244 'host-context', // host-context()
257 'nth-child', // nth-child()
258 'nth-col', // nth-col()
259 'nth-last-child', // nth-last-child()
260 'nth-last-col', // nth-last-col()
261 'nth-last-of-type', //nth-last-of-type()
262 'nth-of-type', //nth-of-type()
283 // https://developer.mozilla.org/en-US/docs/Web/CSS/Pseudo-elements
284 const PSEUDO_ELEMENTS
= [
306 'alignment-baseline',
310 'animation-composition',
312 'animation-direction',
313 'animation-duration',
314 'animation-fill-mode',
315 'animation-iteration-count',
317 'animation-play-state',
319 'animation-range-end',
320 'animation-range-start',
321 'animation-timeline',
322 'animation-timing-function',
326 'backface-visibility',
328 'background-attachment',
329 'background-blend-mode',
334 'background-position',
335 'background-position-x',
336 'background-position-y',
343 'border-block-color',
345 'border-block-end-color',
346 'border-block-end-style',
347 'border-block-end-width',
348 'border-block-start',
349 'border-block-start-color',
350 'border-block-start-style',
351 'border-block-start-width',
352 'border-block-style',
353 'border-block-width',
355 'border-bottom-color',
356 'border-bottom-left-radius',
357 'border-bottom-right-radius',
358 'border-bottom-style',
359 'border-bottom-width',
362 'border-end-end-radius',
363 'border-end-start-radius',
365 'border-image-outset',
366 'border-image-repeat',
367 'border-image-slice',
368 'border-image-source',
369 'border-image-width',
371 'border-inline-color',
373 'border-inline-end-color',
374 'border-inline-end-style',
375 'border-inline-end-width',
376 'border-inline-start',
377 'border-inline-start-color',
378 'border-inline-start-style',
379 'border-inline-start-width',
380 'border-inline-style',
381 'border-inline-width',
388 'border-right-color',
389 'border-right-style',
390 'border-right-width',
392 'border-start-end-radius',
393 'border-start-start-radius',
397 'border-top-left-radius',
398 'border-top-right-radius',
404 'box-decoration-break',
424 'color-interpolation',
425 'color-interpolation-filters',
440 'contain-intrinsic-block-size',
441 'contain-intrinsic-height',
442 'contain-intrinsic-inline-size',
443 'contain-intrinsic-size',
444 'contain-intrinsic-width',
449 'content-visibility',
483 'font-feature-settings',
485 'font-language-override',
486 'font-optical-sizing',
495 'font-synthesis-position',
496 'font-synthesis-small-caps',
497 'font-synthesis-style',
498 'font-synthesis-weight',
500 'font-variant-alternates',
502 'font-variant-east-asian',
503 'font-variant-emoji',
504 'font-variant-ligatures',
505 'font-variant-numeric',
506 'font-variant-position',
507 'font-variation-settings',
509 'forced-color-adjust',
511 'glyph-orientation-horizontal',
512 'glyph-orientation-vertical',
526 'grid-template-areas',
527 'grid-template-columns',
528 'grid-template-rows',
529 'hanging-punctuation',
531 'hyphenate-character',
532 'hyphenate-limit-chars',
540 'initial-letter-align',
549 'inset-inline-start',
563 'list-style-position',
568 'margin-block-start',
572 'margin-inline-start',
585 'mask-border-outset',
586 'mask-border-repeat',
588 'mask-border-source',
638 'overflow-clip-margin',
644 'overscroll-behavior',
645 'overscroll-behavior-block',
646 'overscroll-behavior-inline',
647 'overscroll-behavior-x',
648 'overscroll-behavior-y',
652 'padding-block-start',
655 'padding-inline-end',
656 'padding-inline-start',
669 'perspective-origin',
676 'position-visibility',
677 'print-color-adjust',
692 'scroll-margin-block',
693 'scroll-margin-block-end',
694 'scroll-margin-block-start',
695 'scroll-margin-bottom',
696 'scroll-margin-inline',
697 'scroll-margin-inline-end',
698 'scroll-margin-inline-start',
699 'scroll-margin-left',
700 'scroll-margin-right',
703 'scroll-padding-block',
704 'scroll-padding-block-end',
705 'scroll-padding-block-start',
706 'scroll-padding-bottom',
707 'scroll-padding-inline',
708 'scroll-padding-inline-end',
709 'scroll-padding-inline-start',
710 'scroll-padding-left',
711 'scroll-padding-right',
712 'scroll-padding-top',
717 'scroll-timeline-axis',
718 'scroll-timeline-name',
722 'shape-image-threshold',
745 'text-combine-upright',
747 'text-decoration-color',
748 'text-decoration-line',
749 'text-decoration-skip',
750 'text-decoration-skip-ink',
751 'text-decoration-style',
752 'text-decoration-thickness',
754 'text-emphasis-color',
755 'text-emphasis-position',
756 'text-emphasis-style',
765 'text-underline-offset',
766 'text-underline-position',
778 'transition-behavior',
780 'transition-duration',
781 'transition-property',
782 'transition-timing-function',
790 'view-timeline-axis',
791 'view-timeline-inset',
792 'view-timeline-name',
793 'view-transition-name',
804 'white-space-collapse',
820 Description: Scss is an extension of the syntax of CSS.
821 Author: Kurt Emch <kurt@kurtemch.com>
822 Website: https://sass-lang.com
823 Category: common, css, web
827 /** @type LanguageFn */
828 function scss(hljs
) {
829 const modes
= MODES(hljs
);
830 const PSEUDO_ELEMENTS
$1 = PSEUDO_ELEMENTS
;
831 const PSEUDO_CLASSES
$1 = PSEUDO_CLASSES
;
833 const AT_IDENTIFIER
= '@[a-z-]+'; // @font-face
834 const AT_MODIFIERS
= "and or not only";
835 const IDENT_RE
= '[a-zA-Z-][a-zA-Z0-9_-]*';
837 className: 'variable',
838 begin: '(\\$' + IDENT_RE
+ ')\\b',
844 case_insensitive: true,
847 hljs
.C_LINE_COMMENT_MODE
,
848 hljs
.C_BLOCK_COMMENT_MODE
,
849 // to recognize keyframe 40% etc which are outside the scope of our
850 // attribute value mode
851 modes
.CSS_NUMBER_MODE
,
853 className: 'selector-id',
854 begin: '#[A-Za-z0-9_-]+',
858 className: 'selector-class',
859 begin: '\\.[A-Za-z0-9_-]+',
862 modes
.ATTRIBUTE_SELECTOR_MODE
,
864 className: 'selector-tag',
865 begin: '\\b(' + TAGS
.join('|') + ')\\b',
866 // was there, before, but why?
870 className: 'selector-pseudo',
871 begin: ':(' + PSEUDO_CLASSES
$1.join('|') + ')'
874 className: 'selector-pseudo',
875 begin: ':(:)?(' + PSEUDO_ELEMENTS
$1.join('|') + ')'
878 { // pseudo-selector params
881 contains: [ modes
.CSS_NUMBER_MODE
]
885 className: 'attribute',
886 begin: '\\b(' + ATTRIBUTES
.join('|') + ')\\b'
888 { begin: '\\b(whitespace|wait|w-resize|visible|vertical-text|vertical-ideographic|uppercase|upper-roman|upper-alpha|underline|transparent|top|thin|thick|text|text-top|text-bottom|tb-rl|table-header-group|table-footer-group|sw-resize|super|strict|static|square|solid|small-caps|separate|se-resize|scroll|s-resize|rtl|row-resize|ridge|right|repeat|repeat-y|repeat-x|relative|progress|pointer|overline|outside|outset|oblique|nowrap|not-allowed|normal|none|nw-resize|no-repeat|no-drop|newspaper|ne-resize|n-resize|move|middle|medium|ltr|lr-tb|lowercase|lower-roman|lower-alpha|loose|list-item|line|line-through|line-edge|lighter|left|keep-all|justify|italic|inter-word|inter-ideograph|inside|inset|inline|inline-block|inherit|inactive|ideograph-space|ideograph-parenthesis|ideograph-numeric|ideograph-alpha|horizontal|hidden|help|hand|groove|fixed|ellipsis|e-resize|double|dotted|distribute|distribute-space|distribute-letter|distribute-all-lines|disc|disabled|default|decimal|dashed|crosshair|collapse|col-resize|circle|char|center|capitalize|break-word|break-all|bottom|both|bolder|bold|block|bidi-override|below|baseline|auto|always|all-scroll|absolute|table|table-cell)\\b' },
897 modes
.CSS_NUMBER_MODE
,
898 hljs
.QUOTE_STRING_MODE
,
899 hljs
.APOS_STRING_MODE
,
901 modes
.FUNCTION_DISPATCH
904 // matching these here allows us to treat them more like regular CSS
905 // rules so everything between the {} gets regular rule highlighting,
906 // which is what we want for page and font-face
908 begin: '@(page|font-face)',
910 $pattern: AT_IDENTIFIER
,
911 keyword: '@page @font-face'
920 keyword: AT_MODIFIERS
,
921 attribute: MEDIA_FEATURES
.join(" ")
925 begin: AT_IDENTIFIER
,
929 begin: /[a-z-]+(?=:)/,
930 className: "attribute"
933 hljs
.QUOTE_STRING_MODE
,
934 hljs
.APOS_STRING_MODE
,
936 modes
.CSS_NUMBER_MODE
939 modes
.FUNCTION_DISPATCH
948 hljs
.registerLanguage('scss', hljsGrammar
);