]>
luflow.net public git repositories - flow-web.git/blob - static/highlight/es/languages/scss.js
1 /*! `scss` grammar compiled for Highlight.js 11.11.1 */
2 var hljsGrammar
= (function () {
5 const MODES
= (hljs
) => {
11 BLOCK_COMMENT: hljs
.C_BLOCK_COMMENT_MODE
,
14 begin: /#(([0-9a-fA-F]{3,4})|(([0-9a-fA-F]{2}){3,4}))\b/
17 className: "built_in",
20 ATTRIBUTE_SELECTOR_MODE: {
21 scope: 'selector-attr',
26 hljs
.APOS_STRING_MODE
,
27 hljs
.QUOTE_STRING_MODE
32 begin: hljs
.NUMBER_RE
+ '(' +
35 '|cm|mm|in|pt|pc|px' +
36 '|deg|grad|rad|turn' +
45 begin: /--[A-Za-z_][A-Za-z0-9_-]*/
141 'feComponentTransfer',
152 'feSpecularLighting',
179 // Sorting, then reversing makes sure longer attributes/elements like
180 // `font-weight` are matched fully instead of getting false positives on say `font`
182 const MEDIA_FEATURES
= [
189 'device-aspect-ratio',
203 'prefers-color-scheme',
205 'prefers-reduced-motion',
206 'prefers-reduced-transparency',
212 // TODO: find a better solution?
219 // https://developer.mozilla.org/en-US/docs/Web/CSS/Pseudo-classes
220 const PSEUDO_CLASSES
= [
242 'host', // host or host()
243 'host-context', // host-context()
256 'nth-child', // nth-child()
257 'nth-col', // nth-col()
258 'nth-last-child', // nth-last-child()
259 'nth-last-col', // nth-last-col()
260 'nth-last-of-type', //nth-last-of-type()
261 'nth-of-type', //nth-of-type()
282 // https://developer.mozilla.org/en-US/docs/Web/CSS/Pseudo-elements
283 const PSEUDO_ELEMENTS
= [
305 'alignment-baseline',
309 'animation-composition',
311 'animation-direction',
312 'animation-duration',
313 'animation-fill-mode',
314 'animation-iteration-count',
316 'animation-play-state',
318 'animation-range-end',
319 'animation-range-start',
320 'animation-timeline',
321 'animation-timing-function',
325 'backface-visibility',
327 'background-attachment',
328 'background-blend-mode',
333 'background-position',
334 'background-position-x',
335 'background-position-y',
342 'border-block-color',
344 'border-block-end-color',
345 'border-block-end-style',
346 'border-block-end-width',
347 'border-block-start',
348 'border-block-start-color',
349 'border-block-start-style',
350 'border-block-start-width',
351 'border-block-style',
352 'border-block-width',
354 'border-bottom-color',
355 'border-bottom-left-radius',
356 'border-bottom-right-radius',
357 'border-bottom-style',
358 'border-bottom-width',
361 'border-end-end-radius',
362 'border-end-start-radius',
364 'border-image-outset',
365 'border-image-repeat',
366 'border-image-slice',
367 'border-image-source',
368 'border-image-width',
370 'border-inline-color',
372 'border-inline-end-color',
373 'border-inline-end-style',
374 'border-inline-end-width',
375 'border-inline-start',
376 'border-inline-start-color',
377 'border-inline-start-style',
378 'border-inline-start-width',
379 'border-inline-style',
380 'border-inline-width',
387 'border-right-color',
388 'border-right-style',
389 'border-right-width',
391 'border-start-end-radius',
392 'border-start-start-radius',
396 'border-top-left-radius',
397 'border-top-right-radius',
403 'box-decoration-break',
423 'color-interpolation',
424 'color-interpolation-filters',
439 'contain-intrinsic-block-size',
440 'contain-intrinsic-height',
441 'contain-intrinsic-inline-size',
442 'contain-intrinsic-size',
443 'contain-intrinsic-width',
448 'content-visibility',
482 'font-feature-settings',
484 'font-language-override',
485 'font-optical-sizing',
494 'font-synthesis-position',
495 'font-synthesis-small-caps',
496 'font-synthesis-style',
497 'font-synthesis-weight',
499 'font-variant-alternates',
501 'font-variant-east-asian',
502 'font-variant-emoji',
503 'font-variant-ligatures',
504 'font-variant-numeric',
505 'font-variant-position',
506 'font-variation-settings',
508 'forced-color-adjust',
510 'glyph-orientation-horizontal',
511 'glyph-orientation-vertical',
525 'grid-template-areas',
526 'grid-template-columns',
527 'grid-template-rows',
528 'hanging-punctuation',
530 'hyphenate-character',
531 'hyphenate-limit-chars',
539 'initial-letter-align',
548 'inset-inline-start',
562 'list-style-position',
567 'margin-block-start',
571 'margin-inline-start',
584 'mask-border-outset',
585 'mask-border-repeat',
587 'mask-border-source',
637 'overflow-clip-margin',
643 'overscroll-behavior',
644 'overscroll-behavior-block',
645 'overscroll-behavior-inline',
646 'overscroll-behavior-x',
647 'overscroll-behavior-y',
651 'padding-block-start',
654 'padding-inline-end',
655 'padding-inline-start',
668 'perspective-origin',
675 'position-visibility',
676 'print-color-adjust',
691 'scroll-margin-block',
692 'scroll-margin-block-end',
693 'scroll-margin-block-start',
694 'scroll-margin-bottom',
695 'scroll-margin-inline',
696 'scroll-margin-inline-end',
697 'scroll-margin-inline-start',
698 'scroll-margin-left',
699 'scroll-margin-right',
702 'scroll-padding-block',
703 'scroll-padding-block-end',
704 'scroll-padding-block-start',
705 'scroll-padding-bottom',
706 'scroll-padding-inline',
707 'scroll-padding-inline-end',
708 'scroll-padding-inline-start',
709 'scroll-padding-left',
710 'scroll-padding-right',
711 'scroll-padding-top',
716 'scroll-timeline-axis',
717 'scroll-timeline-name',
721 'shape-image-threshold',
744 'text-combine-upright',
746 'text-decoration-color',
747 'text-decoration-line',
748 'text-decoration-skip',
749 'text-decoration-skip-ink',
750 'text-decoration-style',
751 'text-decoration-thickness',
753 'text-emphasis-color',
754 'text-emphasis-position',
755 'text-emphasis-style',
764 'text-underline-offset',
765 'text-underline-position',
777 'transition-behavior',
779 'transition-duration',
780 'transition-property',
781 'transition-timing-function',
789 'view-timeline-axis',
790 'view-timeline-inset',
791 'view-timeline-name',
792 'view-transition-name',
803 'white-space-collapse',
819 Description: Scss is an extension of the syntax of CSS.
820 Author: Kurt Emch <kurt@kurtemch.com>
821 Website: https://sass-lang.com
822 Category: common, css, web
826 /** @type LanguageFn */
827 function scss(hljs
) {
828 const modes
= MODES(hljs
);
829 const PSEUDO_ELEMENTS
$1 = PSEUDO_ELEMENTS
;
830 const PSEUDO_CLASSES
$1 = PSEUDO_CLASSES
;
832 const AT_IDENTIFIER
= '@[a-z-]+'; // @font-face
833 const AT_MODIFIERS
= "and or not only";
834 const IDENT_RE
= '[a-zA-Z-][a-zA-Z0-9_-]*';
836 className: 'variable',
837 begin: '(\\$' + IDENT_RE
+ ')\\b',
843 case_insensitive: true,
846 hljs
.C_LINE_COMMENT_MODE
,
847 hljs
.C_BLOCK_COMMENT_MODE
,
848 // to recognize keyframe 40% etc which are outside the scope of our
849 // attribute value mode
850 modes
.CSS_NUMBER_MODE
,
852 className: 'selector-id',
853 begin: '#[A-Za-z0-9_-]+',
857 className: 'selector-class',
858 begin: '\\.[A-Za-z0-9_-]+',
861 modes
.ATTRIBUTE_SELECTOR_MODE
,
863 className: 'selector-tag',
864 begin: '\\b(' + TAGS
.join('|') + ')\\b',
865 // was there, before, but why?
869 className: 'selector-pseudo',
870 begin: ':(' + PSEUDO_CLASSES
$1.join('|') + ')'
873 className: 'selector-pseudo',
874 begin: ':(:)?(' + PSEUDO_ELEMENTS
$1.join('|') + ')'
877 { // pseudo-selector params
880 contains: [ modes
.CSS_NUMBER_MODE
]
884 className: 'attribute',
885 begin: '\\b(' + ATTRIBUTES
.join('|') + ')\\b'
887 { 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' },
896 modes
.CSS_NUMBER_MODE
,
897 hljs
.QUOTE_STRING_MODE
,
898 hljs
.APOS_STRING_MODE
,
900 modes
.FUNCTION_DISPATCH
903 // matching these here allows us to treat them more like regular CSS
904 // rules so everything between the {} gets regular rule highlighting,
905 // which is what we want for page and font-face
907 begin: '@(page|font-face)',
909 $pattern: AT_IDENTIFIER
,
910 keyword: '@page @font-face'
919 keyword: AT_MODIFIERS
,
920 attribute: MEDIA_FEATURES
.join(" ")
924 begin: AT_IDENTIFIER
,
928 begin: /[a-z-]+(?=:)/,
929 className: "attribute"
932 hljs
.QUOTE_STRING_MODE
,
933 hljs
.APOS_STRING_MODE
,
935 modes
.CSS_NUMBER_MODE
938 modes
.FUNCTION_DISPATCH
947 export default hljsGrammar
;