-
Notifications
You must be signed in to change notification settings - Fork 32
/
highlight-test.stylus
267 lines (230 loc) · 4.2 KB
/
highlight-test.stylus
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
/**
* This file is compiled based on offical documentation at
* http://stylus-lang.com/docs/ to test highlighting
*/
// @at-rules
@import "test.css";
@charset "utf-8";
@font-face {
font-family: Ubuntu, sans-serif;
src: url('fonts/pompadur.ttf');
}
// animation
@keyframes myfirst {
from {
background: red;
}
50% {
background red
}
to {
background: yellow;
}
}
// media query
@media screen and (max-width: 500px) {
a {
color: #fff;
}
}
// one-line code
a { color: red; top: 0; } b { color: #fff; } i { color: #fff; }
// Colors
body {
color: #fff;
color: #ffffff;
color: #fff4;
color: #ffffff44;
color: rgb(100%, 100%, 50%);
color: rgb(23, 23, 23);
color: rgba(23, 23, 23, 0.4);
color: rgba(#c33, 0.4);
color: hsl(23, 23, 23);
color: hsla(23, 23, 23, 0.4);
color: hsla(#fff, 0.4);
}
// Properties
a {
top: 0
top:0
top :0
top 0
// tabs instead of spaces as delimiters
-webkit-transition : arguments
-moz-transition arguments
// multiline property, comma separated
box-shadow: 0 1px 1px #fff,
0 0 4px rgba(0,0,0,0.4)
// multiline function call
background-image: linear-gradient(
top,
#fff,
#ccc
)
}
// pseudo-elements and selectors
a:nth-child(2n+1):not(:dir(rtl))::after:lang(fsd):active {
color: red;
}
// Literal css
@css {
a {
color: #fff;
}
}
// Universal selector
*, *.test, *#test
color: white
// tag attributes selectors
[a=bb], [a~=bb], [a|=bb], [a="bb"], [a='bb'],
[{x}a{x}sd{x}=sdf], [a={x}s{x}df{x}]
color: red
// Escaping
body
top 10 \+ 5
// Multiple selectors separated by line break
html,
body
font
color red
// vendor prefix
-webkit-background-clip: border-box
// ending in interpolation
h1{s} {
text-decoration: none;
}
// no space before braces
h2{
color black
}
// Selectors start with a symbol
div
:before
::before
~ div
+ div
> div
[href^="#"]
/ div
*
background-color: red
// Compound selectors
body.someclass#someid
font normal 18px/30px OpenSans, Verdana, sans-serif
// Custom Properties
html
--foo 12px
font var(--foo)
// Multiple selectors separated by comma
textarea, input
border 1px solid #fff
// Multiple properties separated by line
font .a32
font-family font1
font-size base-font-size
font normal
font bold
font lighter
font monospace
font 400
font 1.2em
font "Verdana"
font normal 18px/30px OpenSans, Verdana, sans-serif
left 15px
// Multiple properties separated by semicolon
header
font-size 10px; left 15px;
// Ambigious property / selector
// when with comma should be recognized as a selector
header body,
header
top 0
// Parent reference, including BEM-style expansion
.block
&
top 0
&:hover
top 0
&.test
top 0
&_modifier
top 0
&#test
top 0
header&
top 0
footer &
top 0
// Variable assignments
i = '' // test comment
n ?= 5
test := 5
// Hashes
hash = {
somekey: true
// commented: true
'escaped key 1' : 'value'
"escaped key 2" : 'value'
}
hashOneLine = { somekey: true }
hashEmpty = {}
hash['key'] = 'value'
hash['other'] = hash['key']
hash.somekey = false
hash.nested = { somekey: false }
hash.nested.somekey = true
hash['nested'].somekey = true
hash.nested['somekey'] = true
// making sure this isn't considered an assignment
input[type=text] {
&:focus {
text-align: center;
}
}
// Complex case of a property
a
/* */fo{i}nt-family{n+1}fsd #ccc sdfs // 213px
// Function definition and control structures
somefunction(a, b = 16px, c = b, d...)
if c
top b
else
return a
for x, y in somedictionary
&_{x}_{y}
color x if y
// simple function (mixin) definition
somemixin()
color red
// usage of a function (mixin) and value in braces
a
somemixin()
margin-bottom (2px / 1)
// built-in functions
.foo
test = 5
jpg = "png"
background-image url(../test.jpg) // will yeild url("../5.png")
background-image url("../test.jpg")
// block mixin
bar()
{block}
body
+bar()
width: 100%;
// Placeholder selectors
$foo
color red
// Extending
.bar
@extend $foo
background: #000
// Special treatment for cursor
.bar
cursor: pointer
.bar
cursor: pointer
.bar
cursor : pointer
.bar
cursor url('zoom.cur')