Prism

Download

Prism is a lightweight, extensible syntax highlighter, built with modern web standards in mind. It’s used in millions of websites, including some of those you visit daily.

Theme:

Known failures

A list of rare edge cases where Prism highlights code incorrectly.

On this page

  1. AppleScript
  2. AutoIt
  3. Bison
  4. D
  5. Elixir
  6. Groovy
  7. Inform 7
  8. JavaScript
  9. Less
  10. Lua
  11. NASM
  12. Parser
  13. Prolog
  14. Puppet
  15. Python
  16. Q (kdb+ database)
  17. reST (reStructuredText)
  18. Rust
  19. Sass (Sass)
  20. Scala
  21. Scheme
  22. Swift
  23. Textile
  24. Twig
  25. Wiki markup
  26. Themes

There are certain edge cases where Prism will fail. There are always such cases in every regex-based syntax highlighter.
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.

AppleScript

Comments only support one level of nesting

(* Nested block
	(* comments
		(* on more than
		2 levels *)
	are *)
not supported *)

↑ Back to top

AutoIt

Nested block comments

#cs
	#cs
		foo()
	#ce
#ce

↑ Back to top

Bison

Two levels of nesting inside C section

{
	if($1) {
		if($2) {

		}
	}
} // <- Broken
%%
%%

↑ Back to top

D

Comments only support one level of nesting

/+ /+ /+ this does not work +/ +/ +/

Token strings only support one level of nesting

q{ q{ q{ this does not work } } }

↑ Back to top

Elixir

String interpolation in single-quoted strings

'#{:atom} <- this should not be highligted'

↑ Back to top

Groovy

Two divisions on the same line

2 / 3 / 4

↑ Back to top

Inform 7

Names starting with a number

The box 1A is a container

↑ Back to top

JavaScript

String interpolation containing a closing brace

`${ /* } */ a + b }`
`${ '}' }`

String interpolation with deeply nested braces

`${foo({ a: { b: { c: true } } })}`

↑ Back to top

Less

At-rules looking like variables

@import "some file.less";

At-rules containing interpolation

@import "@{themes}/tidal-wave.less";

extend is not highlighted consistently

nav ul {
  &:extend(.inline);
  background: blue;
}
.a:extend(.b) {}

↑ Back to top

Lua

Functions with a single string parameter not using parentheses are not highlighted

foobar"param";

↑ Back to top

NASM

Numbers with underscores

mov     ax,1100_1000b
mov     ax,1100_1000y
mov     ax,0b1100_1000
mov     ax,0y1100_1000

dd    1.222_222_222

↑ Back to top

Parser

Code block starting with a comment

# Doesn't work
# Does work
 # Does work when prefixed with a space

Comments inside expressions break literals and operators

^if(
    $age>=4  # not too young
    && $age<=80  # and not too old
)

↑ Back to top

Prolog

Null-ary predicates are not highlighted

halt.
trace.

:- if(test1).
section_1.
:- elif(test2).
section_2.
:- elif(test3).
section_3.
:- else.
section_else.
:- endif.

↑ Back to top

Puppet

More than one level of nested braces inside interpolation

"Foobar ${foo({
    bar => {baz => 42}
    baz => 42
})} <- broken"

↑ Back to top

Python

Interpolation expressions containing strings with { or }

f"{'}'}"

↑ Back to top

Q (kdb+ database)

The global context is highlighted as a verb

\d .

↑ Back to top

reST (reStructuredText)

Nothing is highlighted inside table cells

+---------------+----------+
| column 1     | column 2  |
+--------------+-----------+
| **bold**?    | *italic*? |
+--------------+-----------+

The inline markup recognition rules are not as strict as they are in the spec

No inline markup should be highlighted in the following code.

2 * x a ** b (* BOM32_* ` `` _ __ |
"*" '|' (*) [*] {*} <*> ‘*’ ‚*‘ ‘*‚ ’*’ ‚*’ “*” „*“ “*„ ”*” „*” »*« ›*‹ «*» »*» ›*›

↑ Back to top

Rust

Nested block comments

/* Nested block
	/* comments
	are */
not supported */

Delimiters of parameters for closures that don't use braces

|x| x + 1i;

↑ Back to top

Sass (Sass)

Deprecated Sass syntax is not supported

.page
  color = 5px + 9px

!width = 13px
.icon
  width = !width

Selectors with pseudo classes are highlighted as property/value pairs

a:hover
  text-decoration: underline

↑ Back to top

Scala

Nested block comments

/* Nested block
	/* comments
	are */
not supported */

↑ Back to top

Scheme

The first argument of case-lambda argument lists are highlighted as functions

(define plus
	(case-lambda
		(() 0)
		((x) x)
		((x y) (+ x y))
		((x y z) (+ (+ x y) z))
		(args (apply + args))))

↑ Back to top

Swift

Nested block comments

/* Nested block
	/* comments
	are */
not supported */

↑ Back to top

Textile

HTML inside Textile is not supported

But Textile inside HTML should be just fine.

<strong>This _should_ work properly.</strong>
*But this is <em>definitely</em> broken.*

↑ Back to top

Twig

Tag containing Twig is not highlighted

<div{% if foo %} class="bar"{% endif %}></div>

↑ Back to top

Wiki markup

Nested magic words are not supported

{{#switch:{{PAGENAME}}
| L'Aquila = No translation
| L = Not OK
| L'Aquila = Entity escaping
| L'Aquila = Numeric char encoding
}}

Nesting of bold and italic is not supported

''Italic with '''bold''' inside''

↑ Back to top

Themes

Some of our themes are not compatible with certain layouts.

Coy

Coy's shadows and background might not wrap around the code correctly if combined with float of flexbox layouts.

Workarounds

There are 2 possible workarounds:

The first workaround is setting display: flex-root; for the pre element. This will fix the issue but flex-root has limited browser support.

The second is adding clear: both; to the style of the pre element. This will fix the issue but it will change the way code blocks behave when overlapping with other elements.

↑ Back to top