1 | Prism.languages.stylus = {
|
2 | 'comment': {
|
3 | pattern: /(^|[^\\])(\/\*[\w\W]*?\*\/|\/\/.*?(\r?\n|$))/g,
|
4 | lookbehind: true
|
5 | },
|
6 | 'keyword': /(px|r?em|ex|ch|vw|vh|vmin|vmax|deg|grad|rad|turn|m?s|k?Hz|dpi|dppx|dpcm)\b|\b(is|defined|not|isnt|and|or|unless|for|in)\b/g,
|
7 | 'atrule': /@[\w-]+(?=\s+\S+)/gi,
|
8 | 'url': /url\((["']?).*?\1\)/gi,
|
9 | 'variable': /^\s*([\w-]+)(?=\s*[+-\\]?=)/gm,
|
10 | 'string': /("|')(\\\n|\\?.)*?\1/g,
|
11 | 'important': /\B!important\b/gi,
|
12 | 'hexcode': /#[\da-f]{3,6}/gi,
|
13 | 'entity': /\\[\da-f]{1,8}/gi,
|
14 | 'number': /\d+\.?\d*%?/g,
|
15 | 'selector': [
|
16 | {
|
17 | pattern: /::?(after|before|first-letter|first-line|selection)/g,
|
18 | alias: 'pseudo-element'
|
19 | },{
|
20 | pattern: /:(?:active|checked|disabled|empty|enabled|first-child|first-of-type|focus|hover|in-range|invalid|lang|last-child|last-of-type|link|not|nth-child|nth-last-child|nth-last-of-type|nth-of-type|only-of-type|only-child|optional|out-of-range|read-only|read-write|required|root|target|valid|visited)(?:\(.*\))?/g,
|
21 | alias:'pseudo-class'
|
22 | },{
|
23 | pattern: /\[[\w-]+?\s*[*~$^|=]?(?:=\s*\S+)?\]/g,
|
24 | inside: {
|
25 | "attr-name":
|
26 | {
|
27 | pattern: /(\[)([\w-]+)(?=\s*[*~$^|=]{0,2})/g,
|
28 | lookbehind: true
|
29 | },
|
30 | "punctuation": /\[|\]/g,
|
31 | "operator": /[*~$^|=]/g,
|
32 | "attr-value": {
|
33 | pattern: /\S+/
|
34 | },
|
35 | },
|
36 | alias: 'attr'
|
37 | },
|
38 | {
|
39 | pattern: /\.[a-z-]+/i,
|
40 | alias: 'class'
|
41 | },
|
42 | {
|
43 | pattern: /#[a-z-]+/i,
|
44 | alias: 'id'
|
45 | },
|
46 | {
|
47 | pattern: /\b(html|head|title|base|link|meta|style|script|noscript|template|body|section|nav|article|aside|h[1-6]|header|footer|address|main|p|hr|pre|blockquote|ol|ul|li|dl|dt|dd|figure|figcaption|div|a|em|strong|small|s|cite|q|dfn|abbr|data|time|code|var|samp|kbd|sub|sup|i|b|u|mark|ruby|rt|rp|bdi|dbo|span|br|wbr|ins|del|image|iframe|embed|object|param|video|audio|source|track|canvas|map|area|sv|math|table|caption|colgroup|col|tbody|thead|tfoot|tr|td|th|form|fieldset|legeng|label|input|button|select|datalist|optgroup|option|textarea|keygen|output|progress|meter|details|summary|menuitem|menu)\b/g,
|
48 | alias: 'tag'
|
49 | },
|
50 | ],
|
51 | 'property': [
|
52 | /^\s*([a-z-]+)(?=\s+[\w\W]+|\s*:)(?!\s*\{|\r?\n)/mig,
|
53 | {
|
54 | pattern: /(\(\s*)([a-z-]+)(?=\s*:)/ig,
|
55 | lookbehind: true
|
56 | }
|
57 | ],
|
58 | 'function': /[-a-z0-9]+(?=\()/ig,
|
59 | 'punctuation': /[\{\};:]/g,
|
60 | 'operator': /[-+]{1,2}|!|<=?|>=?|={1,3}|&{1,2}|\|?\||\?|\*|\/|~|\^|%/g
|
61 | }
|