| 1 | <!DOCTYPE html> |
| 2 | <html lang="en"> |
| 3 | <head> |
| 4 | |
| 5 | <meta charset="utf-8" /> |
| 6 | <link rel="icon" href="assets/favicon.png" /> |
| 7 | <title>Known failures ▲ Prism</title> |
| 8 | <link rel="stylesheet" href="assets/style.css" /> |
| 9 | <link rel="stylesheet" href="themes/prism.css" data-noprefix /> |
| 10 | <style> |
| 11 | #toc { |
| 12 | display: block; |
| 13 | position: static; |
| 14 | max-width: 900px; |
| 15 | font-size: 100%; |
| 16 | color: black; |
| 17 | } |
| 18 | #toc > ol { |
| 19 | columns: 4; |
| 20 | } |
| 21 | </style> |
| 22 | <script src="assets/vendor/prefixfree.min.js"></script> |
| 23 | |
| 24 | <script>var _gaq = [['_setAccount', 'UA-33746269-1'], ['_trackPageview']];</script> |
| 25 | <script src="https://www.google-analytics.com/ga.js" async></script> |
| 26 | </head> |
| 27 | <body class="language-none"> |
| 28 | |
| 29 | <header> |
| 30 | <div class="intro" data-src="assets/templates/header-main.html" data-type="text/html"></div> |
| 31 | |
| 32 | <h2>Known failures</h2> |
| 33 | <p>A list of rare edge cases where Prism highlights code incorrectly.</p> |
| 34 | </header> |
| 35 | |
| 36 | <section> |
| 37 | <p>There are certain edge cases where Prism will fail. There are always such cases in every regex-based syntax highlighter. <br> |
| 38 | 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> |
| 39 | </section> |
| 40 | |
| 41 | |
| 42 | <section class="language-applescript"> |
| 43 | |
| 44 | <h3>Comments only support one level of nesting</h3> |
| 45 | <pre><code>(* Nested block |
| 46 | (* comments |
| 47 | (* on more than |
| 48 | 2 levels *) |
| 49 | are *) |
| 50 | not supported *)</code></pre> |
| 51 | |
| 52 | </section> |
| 53 | |
| 54 | |
| 55 | <section class="language-autoit"> |
| 56 | |
| 57 | <h3>Nested block comments</h3> |
| 58 | <pre><code>#cs |
| 59 | #cs |
| 60 | foo() |
| 61 | #ce |
| 62 | #ce</code></pre> |
| 63 | |
| 64 | </section> |
| 65 | |
| 66 | |
| 67 | <section class="language-bison"> |
| 68 | |
| 69 | <h3>Two levels of nesting inside C section</h3> |
| 70 | <pre><code>{ |
| 71 | if($1) { |
| 72 | if($2) { |
| 73 | |
| 74 | } |
| 75 | } |
| 76 | } // <- Broken |
| 77 | %% |
| 78 | %%</code></pre> |
| 79 | |
| 80 | </section> |
| 81 | |
| 82 | |
| 83 | <section class="language-d"> |
| 84 | |
| 85 | <h3>Comments only support one level of nesting</h3> |
| 86 | <pre><code>/+ /+ /+ this does not work +/ +/ +/</code></pre> |
| 87 | |
| 88 | <h3>Token strings only support one level of nesting</h3> |
| 89 | <pre><code>q{ q{ q{ this does not work } } }</code></pre> |
| 90 | |
| 91 | </section> |
| 92 | |
| 93 | |
| 94 | <section class="language-elixir"> |
| 95 | |
| 96 | <h3>String interpolation in single-quoted strings</h3> |
| 97 | <pre><code>'#{:atom} <- this should not be highligted'</code></pre> |
| 98 | |
| 99 | </section> |
| 100 | |
| 101 | |
| 102 | <section class="language-groovy"> |
| 103 | |
| 104 | <h3>Two divisions on the same line</h3> |
| 105 | <pre><code>2 / 3 / 4</code></pre> |
| 106 | |
| 107 | </section> |
| 108 | |
| 109 | |
| 110 | <section class="language-inform7"> |
| 111 | |
| 112 | <h3>Names starting with a number</h3> |
| 113 | <pre><code>The box 1A is a container</code></pre> |
| 114 | |
| 115 | </section> |
| 116 | |
| 117 | |
| 118 | <section class="language-javascript"> |
| 119 | |
| 120 | <h3>String interpolation containing a closing brace</h3> |
| 121 | <pre><code>`${ /* } */ a + b }` |
| 122 | `${ '}' }`</code></pre> |
| 123 | |
| 124 | <h3>String interpolation with deeply nested braces</h3> |
| 125 | <pre><code>`${foo({ a: { b: { c: true } } })}`</code></pre> |
| 126 | |
| 127 | </section> |
| 128 | |
| 129 | |
| 130 | <section class="language-less"> |
| 131 | |
| 132 | <h3>At-rules looking like variables</h3> |
| 133 | <pre><code>@import "some file.less";</code></pre> |
| 134 | |
| 135 | <h3>At-rules containing interpolation</h3> |
| 136 | <pre><code>@import "@{themes}/tidal-wave.less";</code></pre> |
| 137 | |
| 138 | <h3>extend is not highlighted consistently</h3> |
| 139 | <pre><code>nav ul { |
| 140 | &:extend(.inline); |
| 141 | background: blue; |
| 142 | } |
| 143 | .a:extend(.b) {}</code></pre> |
| 144 | |
| 145 | </section> |
| 146 | |
| 147 | |
| 148 | <section class="language-lua"> |
| 149 | |
| 150 | <h3>Functions with a single string parameter not using parentheses are not highlighted</h3> |
| 151 | <pre><code>foobar"param";</code></pre> |
| 152 | |
| 153 | </section> |
| 154 | |
| 155 | |
| 156 | <section class="language-nasm"> |
| 157 | |
| 158 | <h3>Numbers with underscores</h3> |
| 159 | <pre><code>mov ax,1100_1000b |
| 160 | mov ax,1100_1000y |
| 161 | mov ax,0b1100_1000 |
| 162 | mov ax,0y1100_1000 |
| 163 | |
| 164 | dd 1.222_222_222</code></pre> |
| 165 | |
| 166 | </section> |
| 167 | |
| 168 | |
| 169 | <section class="language-parser"> |
| 170 | |
| 171 | <h3>Code block starting with a comment</h3> |
| 172 | <pre><code># Doesn't work |
| 173 | # Does work</code></pre> |
| 174 | <pre><code> # Does work when prefixed with a space</code></pre> |
| 175 | |
| 176 | <h3>Comments inside expressions break literals and operators</h3> |
| 177 | <pre><code>^if( |
| 178 | $age>=4 # not too young |
| 179 | && $age<=80 # and not too old |
| 180 | )</code></pre> |
| 181 | |
| 182 | </section> |
| 183 | |
| 184 | |
| 185 | <section class="language-prolog"> |
| 186 | |
| 187 | <h3>Null-ary predicates are not highlighted</h3> |
| 188 | <pre><code>halt. |
| 189 | trace. |
| 190 | |
| 191 | :- if(test1). |
| 192 | section_1. |
| 193 | :- elif(test2). |
| 194 | section_2. |
| 195 | :- elif(test3). |
| 196 | section_3. |
| 197 | :- else. |
| 198 | section_else. |
| 199 | :- endif.</code></pre> |
| 200 | |
| 201 | </section> |
| 202 | |
| 203 | |
| 204 | <section class="language-puppet"> |
| 205 | |
| 206 | <h3>More than one level of nested braces inside interpolation</h3> |
| 207 | <pre><code>"Foobar ${foo({ |
| 208 | bar => {baz => 42} |
| 209 | baz => 42 |
| 210 | })} <- broken"</code></pre> |
| 211 | |
| 212 | </section> |
| 213 | |
| 214 | |
| 215 | <section class="language-python"> |
| 216 | |
| 217 | <h3>Interpolation expressions containing strings with <code>{</code> or <code>}</code></h3> |
| 218 | <pre><code>f"{'}'}"</code></pre> |
| 219 | |
| 220 | </section> |
| 221 | |
| 222 | |
| 223 | <section class="language-q"> |
| 224 | |
| 225 | <h3>The global context is highlighted as a verb</h3> |
| 226 | <pre><code>\d .</code></pre> |
| 227 | |
| 228 | </section> |
| 229 | |
| 230 | |
| 231 | <section class="language-rest"> |
| 232 | |
| 233 | <h3>Nothing is highlighted inside table cells</h3> |
| 234 | <pre><code>+---------------+----------+ |
| 235 | | column 1 | column 2 | |
| 236 | +--------------+-----------+ |
| 237 | | **bold**? | *italic*? | |
| 238 | +--------------+-----------+</code></pre> |
| 239 | |
| 240 | <h3>The inline markup recognition rules are not as strict as they are in the spec</h3> |
| 241 | <p>No inline markup should be highlighted in the following code.</p> |
| 242 | <pre><code>2 * x a ** b (* BOM32_* ` `` _ __ | |
| 243 | "*" '|' (*) [*] {*} <*> ‘*’ ‚*‘ ‘*‚ ’*’ ‚*’ “*” „*“ “*„ ”*” „*” »*« ›*‹ «*» »*» ›*›</code></pre> |
| 244 | |
| 245 | </section> |
| 246 | |
| 247 | |
| 248 | <section class="language-rust"> |
| 249 | |
| 250 | <h3>Nested block comments</h3> |
| 251 | <pre><code>/* Nested block |
| 252 | /* comments |
| 253 | are */ |
| 254 | not supported */</code></pre> |
| 255 | |
| 256 | <h3>Delimiters of parameters for closures that don't use braces</h3> |
| 257 | <pre><code>|x| x + 1i;</code></pre> |
| 258 | |
| 259 | </section> |
| 260 | |
| 261 | |
| 262 | <section class="language-sass"> |
| 263 | |
| 264 | <h3>Deprecated Sass syntax is not supported</h3> |
| 265 | <pre><code>.page |
| 266 | color = 5px + 9px |
| 267 | |
| 268 | !width = 13px |
| 269 | .icon |
| 270 | width = !width</code></pre> |
| 271 | |
| 272 | <h3>Selectors with pseudo classes are highlighted as property/value pairs</h3> |
| 273 | <pre><code>a:hover |
| 274 | text-decoration: underline</code></pre> |
| 275 | |
| 276 | </section> |
| 277 | |
| 278 | |
| 279 | <section class="language-scala"> |
| 280 | |
| 281 | <h3>Nested block comments</h3> |
| 282 | <pre><code>/* Nested block |
| 283 | /* comments |
| 284 | are */ |
| 285 | not supported */</code></pre> |
| 286 | |
| 287 | </section> |
| 288 | |
| 289 | |
| 290 | <section class="language-scheme"> |
| 291 | |
| 292 | <h3>The first argument of <code>case-lambda</code> argument lists are highlighted as functions</h3> |
| 293 | <pre><code>(define plus |
| 294 | (case-lambda |
| 295 | (() 0) |
| 296 | ((x) x) |
| 297 | ((x y) (+ x y)) |
| 298 | ((x y z) (+ (+ x y) z)) |
| 299 | (args (apply + args))))</code></pre> |
| 300 | |
| 301 | </section> |
| 302 | |
| 303 | |
| 304 | <section class="language-swift"> |
| 305 | |
| 306 | <h3>Nested block comments</h3> |
| 307 | <pre><code>/* Nested block |
| 308 | /* comments |
| 309 | are */ |
| 310 | not supported */</code></pre> |
| 311 | |
| 312 | </section> |
| 313 | |
| 314 | |
| 315 | <section class="language-textile"> |
| 316 | |
| 317 | <h3>HTML inside Textile is not supported</h3> |
| 318 | |
| 319 | <p>But Textile inside HTML should be just fine.</p> |
| 320 | |
| 321 | <pre><code><strong>This _should_ work properly.</strong> |
| 322 | *But this is <em>definitely</em> broken.*</code></pre> |
| 323 | |
| 324 | </section> |
| 325 | |
| 326 | |
| 327 | <section class="language-twig"> |
| 328 | |
| 329 | <h3>Tag containing Twig is not highlighted</h3> |
| 330 | <pre><code><div{% if foo %} class="bar"{% endif %}></div></code></pre> |
| 331 | |
| 332 | </section> |
| 333 | |
| 334 | |
| 335 | <section class="language-wiki"> |
| 336 | |
| 337 | <h3>Nested magic words are not supported</h3> |
| 338 | |
| 339 | <pre><code>{{#switch:{{PAGENAME}} |
| 340 | | L'Aquila = No translation |
| 341 | | L = Not OK |
| 342 | | L'Aquila = Entity escaping |
| 343 | | L'Aquila = Numeric char encoding |
| 344 | }}</code></pre> |
| 345 | |
| 346 | <h3>Nesting of bold and italic is not supported</h3> |
| 347 | <pre><code>''Italic with '''bold''' inside''</code></pre> |
| 348 | |
| 349 | </section> |
| 350 | |
| 351 | |
| 352 | <section> |
| 353 | |
| 354 | <h1 id="themes">Themes</h1> |
| 355 | |
| 356 | <p>Some of our themes are not compatible with certain layouts.</p> |
| 357 | |
| 358 | <h2>Coy</h2> |
| 359 | |
| 360 | <p>Coy's shadows and background might not wrap around the code correctly if combined with float of flexbox layouts.</p> |
| 361 | |
| 362 | <img src="assets/img/failures/coy-overlap.png"/> |
| 363 | |
| 364 | <h3>Workarounds</h3> |
| 365 | |
| 366 | <p>There are 2 possible workarounds:</p> |
| 367 | |
| 368 | <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> |
| 369 | |
| 370 | <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> |
| 371 | |
| 372 | </section> |
| 373 | |
| 374 | |
| 375 | <footer data-src="assets/templates/footer.html" data-type="text/html"></footer> |
| 376 | |
| 377 | <script src="assets/vendor/utopia.js"></script> |
| 378 | <script src="prism.js"></script> |
| 379 | <script src="plugins/autoloader/prism-autoloader.js" data-autoloader-path="components"></script> |
| 380 | <script src="components.js"></script> |
| 381 | <script> |
| 382 | $$('section[class*=language-]').forEach(function (section) { |
| 383 | var lang = /(?:^|\s)language-([\w-]+)(?:$|\s)/.exec(section.className)[1]; |
| 384 | var title = components.languages[lang].title; |
| 385 | |
| 386 | $u.element.create('h1', { |
| 387 | contents: title, |
| 388 | id: lang, |
| 389 | before: section.firstChild |
| 390 | }); |
| 391 | }); |
| 392 | |
| 393 | $$('section > h1').forEach(function (h1) { |
| 394 | $u.element.create('p', { |
| 395 | contents: { |
| 396 | tag: 'a', |
| 397 | properties: { |
| 398 | href: '#toc' |
| 399 | }, |
| 400 | contents: '↑ Back to top' |
| 401 | }, |
| 402 | inside: h1.parentNode |
| 403 | }); |
| 404 | }); |
| 405 | </script> |
| 406 | <script src="assets/code.js"></script> |
| 407 | |
| 408 | </body> |
| 409 | </html> |