forked from PrismJS/prism
-
Notifications
You must be signed in to change notification settings - Fork 0
/
known-failures.html
409 lines (270 loc) · 8.72 KB
/
known-failures.html
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
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8" />
<link rel="icon" href="favicon.png" />
<title>Known failures ▲ Prism</title>
<link rel="stylesheet" href="style.css" />
<link rel="stylesheet" href="themes/prism.css" data-noprefix />
<style>
#toc {
display: block;
position: static;
max-width: 900px;
font-size: 100%;
color: black;
}
#toc > ol {
columns: 4;
}
</style>
<script src="scripts/prefixfree.min.js"></script>
<script>var _gaq = [['_setAccount', 'UA-33746269-1'], ['_trackPageview']];</script>
<script src="https://www.google-analytics.com/ga.js" async></script>
</head>
<body class="language-none">
<header>
<div class="intro" data-src="templates/header-main.html" data-type="text/html"></div>
<h2>Known failures</h2>
<p>A list of rare edge cases where Prism highlights code incorrectly.</p>
</header>
<section>
<p>There are certain edge cases where Prism will fail. There are always such cases in every regex-based syntax highlighter. <br>
However, Prism dares to be open and honest about them. If a failure is listed here, it doesn’t mean it will never be fixed. This is more of a “known bugs” list, just with a certain type of bug.</p>
</section>
<section class="language-applescript">
<h3>Comments only support one level of nesting</h3>
<pre><code>(* Nested block
(* comments
(* on more than
2 levels *)
are *)
not supported *)</code></pre>
</section>
<section class="language-autoit">
<h3>Nested block comments</h3>
<pre><code>#cs
#cs
foo()
#ce
#ce</code></pre>
</section>
<section class="language-bison">
<h3>Two levels of nesting inside C section</h3>
<pre><code>{
if($1) {
if($2) {
}
}
} // <- Broken
%%
%%</code></pre>
</section>
<section class="language-d">
<h3>Comments only support one level of nesting</h3>
<pre><code>/+ /+ /+ this does not work +/ +/ +/</code></pre>
<h3>Token strings only support one level of nesting</h3>
<pre><code>q{ q{ q{ this does not work } } }</code></pre>
</section>
<section class="language-elixir">
<h3>String interpolation in single-quoted strings</h3>
<pre><code>'#{:atom} <- this should not be highligted'</code></pre>
</section>
<section class="language-groovy">
<h3>Two divisions on the same line</h3>
<pre><code>2 / 3 / 4</code></pre>
</section>
<section class="language-inform7">
<h3>Names starting with a number</h3>
<pre><code>The box 1A is a container</code></pre>
</section>
<section class="language-javascript">
<h3>String interpolation containing a closing brace</h3>
<pre><code>`${ /* } */ a + b }`
`${ '}' }`</code></pre>
<h3>String interpolation with deeply nested braces</h3>
<pre><code>`${foo({ a: { b: { c: true } } })}`</code></pre>
</section>
<section class="language-less">
<h3>At-rules looking like variables</h3>
<pre><code>@import "some file.less";</code></pre>
<h3>At-rules containing interpolation</h3>
<pre><code>@import "@{themes}/tidal-wave.less";</code></pre>
<h3>extend is not highlighted consistently</h3>
<pre><code>nav ul {
&:extend(.inline);
background: blue;
}
.a:extend(.b) {}</code></pre>
</section>
<section class="language-lua">
<h3>Functions with a single string parameter not using parentheses are not highlighted</h3>
<pre><code>foobar"param";</code></pre>
</section>
<section class="language-nasm">
<h3>Numbers with underscores</h3>
<pre><code>mov ax,1100_1000b
mov ax,1100_1000y
mov ax,0b1100_1000
mov ax,0y1100_1000
dd 1.222_222_222</code></pre>
</section>
<section class="language-parser">
<h3>Code block starting with a comment</h3>
<pre><code># Doesn't work
# Does work</code></pre>
<pre><code> # Does work when prefixed with a space</code></pre>
<h3>Comments inside expressions break literals and operators</h3>
<pre><code>^if(
$age>=4 # not too young
&& $age<=80 # and not too old
)</code></pre>
</section>
<section class="language-prolog">
<h3>Null-ary predicates are not highlighted</h3>
<pre><code>halt.
trace.
:- if(test1).
section_1.
:- elif(test2).
section_2.
:- elif(test3).
section_3.
:- else.
section_else.
:- endif.</code></pre>
</section>
<section class="language-puppet">
<h3>More than one level of nested braces inside interpolation</h3>
<pre><code>"Foobar ${foo({
bar => {baz => 42}
baz => 42
})} <- broken"</code></pre>
</section>
<section class="language-python">
<h3>Interpolation expressions containing strings with <code>{</code> or <code>}</code></h3>
<pre><code>f"{'}'}"</code></pre>
</section>
<section class="language-q">
<h3>The global context is highlighted as a verb</h3>
<pre><code>\d .</code></pre>
</section>
<section class="language-rest">
<h3>Nothing is highlighted inside table cells</h3>
<pre><code>+---------------+----------+
| column 1 | column 2 |
+--------------+-----------+
| **bold**? | *italic*? |
+--------------+-----------+</code></pre>
<h3>The inline markup recognition rules are not as strict as they are in the spec</h3>
<p>No inline markup should be highlighted in the following code.</p>
<pre><code>2 * x a ** b (* BOM32_* ` `` _ __ |
"*" '|' (*) [*] {*} <*> ‘*’ ‚*‘ ‘*‚ ’*’ ‚*’ “*” „*“ “*„ ”*” „*” »*« ›*‹ «*» »*» ›*›</code></pre>
</section>
<section class="language-rust">
<h3>Nested block comments</h3>
<pre><code>/* Nested block
/* comments
are */
not supported */</code></pre>
<h3>Delimiters of parameters for closures that don't use braces</h3>
<pre><code>|x| x + 1i;</code></pre>
</section>
<section class="language-sass">
<h3>Deprecated Sass syntax is not supported</h3>
<pre><code>.page
color = 5px + 9px
!width = 13px
.icon
width = !width</code></pre>
<h3>Selectors with pseudo classes are highlighted as property/value pairs</h3>
<pre><code>a:hover
text-decoration: underline</code></pre>
</section>
<section class="language-scala">
<h3>Nested block comments</h3>
<pre><code>/* Nested block
/* comments
are */
not supported */</code></pre>
</section>
<section class="language-scheme">
<h3>The first argument of <code>case-lambda</code> argument lists are highlighted as functions</h3>
<pre><code>(define plus
(case-lambda
(() 0)
((x) x)
((x y) (+ x y))
((x y z) (+ (+ x y) z))
(args (apply + args))))</code></pre>
</section>
<section class="language-swift">
<h3>Nested block comments</h3>
<pre><code>/* Nested block
/* comments
are */
not supported */</code></pre>
</section>
<section class="language-textile">
<h3>HTML inside Textile is not supported</h3>
<p>But Textile inside HTML should be just fine.</p>
<pre><code><strong>This _should_ work properly.</strong>
*But this is <em>definitely</em> broken.*</code></pre>
</section>
<section class="language-twig">
<h3>Tag containing Twig is not highlighted</h3>
<pre><code><div{% if foo %} class="bar"{% endif %}></div></code></pre>
</section>
<section class="language-wiki">
<h3>Nested magic words are not supported</h3>
<pre><code>{{#switch:{{PAGENAME}}
| L'Aquila = No translation
| L = Not OK
| L'Aquila = Entity escaping
| L'Aquila = Numeric char encoding
}}</code></pre>
<h3>Nesting of bold and italic is not supported</h3>
<pre><code>''Italic with '''bold''' inside''</code></pre>
</section>
<section>
<h1 id="themes">Themes</h1>
<p>Some of our themes are not compatible with certain layouts.</p>
<h2>Coy</h2>
<p>Coy's shadows and background might not wrap around the code correctly if combined with float of flexbox layouts.</p>
<img src="img/failures/coy-overlap.png"/>
<h3>Workarounds</h3>
<p>There are 2 possible workarounds:</p>
<p>The first workaround is setting <code>display: flex-root;</code> for the <code>pre</code> element. This will fix the issue but <code>flex-root</code> has <a href="https://caniuse.com/#feat=flow-root">limited browser support</a>.</p>
<p>The second is adding <code>clear: both;</code> to the style of the <code>pre</code> element. This will fix the issue but it will change the way code blocks behave when overlapping with other elements.</p>
</section>
<footer data-src="templates/footer.html" data-type="text/html"></footer>
<script src="scripts/utopia.js"></script>
<script src="prism.js"></script>
<script src="plugins/autoloader/prism-autoloader.js" data-autoloader-path="components"></script>
<script src="components.js"></script>
<script>
$$('section[class*=language-]').forEach(function (section) {
var lang = /(?:^|\s)language-([\w-]+)(?:$|\s)/.exec(section.className)[1];
var title = components.languages[lang].title;
$u.element.create('h1', {
contents: title,
id: lang,
before: section.firstChild
});
});
$$('section > h1').forEach(function (h1) {
$u.element.create('p', {
contents: {
tag: 'a',
properties: {
href: '#toc'
},
contents: '↑ Back to top'
},
inside: h1.parentNode
});
});
</script>
<script src="scripts/code.js"></script>
</body>
</html>