var foo = "bar", baz = 5;
(1 + 2 * 3)/4 >= 3 && 4 < 5 || 6 > 7
if (true) {
while (true) {
doSomething();
}
}
var foo = /([^/])\/(\\?.|\[.+?])+?\/[gim]{0,3}/g;
var bar = /\/\*[\w\W]*?\*\//g;
// http://lea.verou.me
var comment = /\/\*[\w\W]*?\*\//g;
// http://lea.verou.me
/* http://lea.verou.me */
var foo = "foo", bar = "He \"said\" 'hi'!"
// "foo"
/* "foo" */
env.content + '</' + env.tag + '>'
var foo = "/" + "/";
var foo = "http://prismjs.com"; // Strings are strings and comments are comments ;)
// hey, /this doesn’t fail!/ :D
var foo = 5 / 6 / 7;
var foo = 1/2, bar = /a/g;
var foo = /a/, bar = 3/4;
// Regex "y" and "u" flags
var a = /[a-zA-Z]+/gimyu;
// for..of loops
for(let x of y) { }
// Modules: import
import { foo as bar } from "file.js"
// Template strings
`Only on ${y} one line`
`This template string ${x} is on
multiple lines.`
`40 + 2 = ${ 40 + 2 }`
`The squares of the first 3 natural integers are ${[for (x of [1,2,3]) x*x].join(', ')}`
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.
`${ {foo:'bar'}.foo }`
`${ '}' }`