]>
luflow.net public git repositories - flow-web.git/blob - static/highlight/es/languages/stylus.js
1 /*! `stylus` 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 Author: Bryant Williams <b.n.williams@gmail.com>
820 Description: Stylus is an expressive, robust, feature-rich CSS language built for nodejs.
821 Website: https://github.com/stylus/stylus
826 /** @type LanguageFn */
827 function stylus(hljs
) {
828 const modes
= MODES(hljs
);
830 const AT_MODIFIERS
= "and or not only";
832 className: 'variable',
833 begin: '\\$' + hljs
.IDENT_RE
836 const AT_KEYWORDS
= [
853 const LOOKAHEAD_TAG_END
= '(?=[.\\s\\n[:,(])';
858 '(\\bReturn\\b)', // monkey
859 '(\\bEnd\\b)', // monkey
860 '(\\bend\\b)', // vbscript
861 '(\\bdef\\b)', // gradle
862 ';', // a whole lot of languages
864 '\\*\\s', // markdown
865 '===\\s', // markdown
873 case_insensitive: false,
874 keywords: 'if else for in',
875 illegal: '(' + ILLEGAL
.join('|') + ')',
879 hljs
.QUOTE_STRING_MODE
,
880 hljs
.APOS_STRING_MODE
,
883 hljs
.C_LINE_COMMENT_MODE
,
884 hljs
.C_BLOCK_COMMENT_MODE
,
891 begin: '\\.[a-zA-Z][a-zA-Z0-9_-]*' + LOOKAHEAD_TAG_END
,
892 className: 'selector-class'
897 begin: '#[a-zA-Z][a-zA-Z0-9_-]*' + LOOKAHEAD_TAG_END
,
898 className: 'selector-id'
903 begin: '\\b(' + TAGS
.join('|') + ')' + LOOKAHEAD_TAG_END
,
904 className: 'selector-tag'
909 className: 'selector-pseudo',
910 begin: '&?:(' + PSEUDO_CLASSES
.join('|') + ')' + LOOKAHEAD_TAG_END
913 className: 'selector-pseudo',
914 begin: '&?:(:)?(' + PSEUDO_ELEMENTS
.join('|') + ')' + LOOKAHEAD_TAG_END
917 modes
.ATTRIBUTE_SELECTOR_MODE
,
920 className: "keyword",
926 keyword: AT_MODIFIERS
,
927 attribute: MEDIA_FEATURES
.join(" ")
929 contains: [ modes
.CSS_NUMBER_MODE
]
935 className: 'keyword',
936 begin: '\@((-(o|moz|ms|webkit)-)?(' + AT_KEYWORDS
.join('|') + '))\\b'
943 modes
.CSS_NUMBER_MODE
,
946 // - only from beginning of line + whitespace
948 className: 'function',
949 begin: '^[a-zA-Z][a-zA-Z0-9_\-]*\\(.*\\)',
955 begin: '\\b[a-zA-Z][a-zA-Z0-9_\-]*'
964 hljs
.APOS_STRING_MODE
,
965 modes
.CSS_NUMBER_MODE
,
966 hljs
.QUOTE_STRING_MODE
976 // - only from beginning of line + whitespace
977 // - must have whitespace after it
979 className: 'attribute',
980 begin: '\\b(' + ATTRIBUTES
.join('|') + ')\\b',
987 hljs
.APOS_STRING_MODE
,
988 hljs
.QUOTE_STRING_MODE
,
989 modes
.CSS_NUMBER_MODE
,
990 hljs
.C_BLOCK_COMMENT_MODE
,
992 modes
.FUNCTION_DISPATCH
998 modes
.FUNCTION_DISPATCH
1007 export default hljsGrammar
;