To use this language, use the class "language-javascript".
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;
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 */ baz"; "foo // bar";
foo = /"foo"/;