UNPKG

102 kBJavaScriptView Raw
1/**
2 * Prism: Lightweight, robust, elegant syntax highlighting
3 * MIT license http://www.opensource.org/licenses/mit-license.php/
4 * @author Lea Verou http://lea.verou.me
5 */
6
7/**
8 * prism-react-renderer:
9 * This file has been modified to remove:
10 * - globals and window dependency
11 * - worker support
12 * - highlightAll and other element dependent methods
13 * - _.hooks helpers
14 * - UMD/node-specific hacks
15 * It has also been run through prettier
16 */
17var Prism = function () {
18 var uniqueId = 0;
19 var _ = {
20 util: {
21 encode: function (tokens) {
22 if (tokens instanceof Token) {
23 return new Token(tokens.type, _.util.encode(tokens.content), tokens.alias);
24 } else if (_.util.type(tokens) === "Array") {
25 return tokens.map(_.util.encode);
26 } else {
27 return tokens.replace(/&/g, "&amp;").replace(/</g, "&lt;").replace(/\u00a0/g, " ");
28 }
29 },
30 type: function (o) {
31 return Object.prototype.toString.call(o).match(/\[object (\w+)\]/)[1];
32 },
33 objId: function (obj) {
34 if (!obj["__id"]) {
35 Object.defineProperty(obj, "__id", {
36 value: ++uniqueId
37 });
38 }
39
40 return obj["__id"];
41 },
42 // Deep clone a language definition (e.g. to extend it)
43 clone: function (o, visited) {
44 var type = _.util.type(o);
45
46 visited = visited || {};
47
48 switch (type) {
49 case "Object":
50 if (visited[_.util.objId(o)]) {
51 return visited[_.util.objId(o)];
52 }
53
54 var clone = {};
55 visited[_.util.objId(o)] = clone;
56
57 for (var key in o) {
58 if (o.hasOwnProperty(key)) {
59 clone[key] = _.util.clone(o[key], visited);
60 }
61 }
62
63 return clone;
64
65 case "Array":
66 if (visited[_.util.objId(o)]) {
67 return visited[_.util.objId(o)];
68 }
69
70 var clone = [];
71 visited[_.util.objId(o)] = clone;
72 o.forEach(function (v, i) {
73 clone[i] = _.util.clone(v, visited);
74 });
75 return clone;
76 }
77
78 return o;
79 }
80 },
81 languages: {
82 extend: function (id, redef) {
83 var lang = _.util.clone(_.languages[id]);
84
85 for (var key in redef) {
86 lang[key] = redef[key];
87 }
88
89 return lang;
90 },
91
92 /**
93 * Insert a token before another token in a language literal
94 * As this needs to recreate the object (we cannot actually insert before keys in object literals),
95 * we cannot just provide an object, we need anobject and a key.
96 * @param inside The key (or language id) of the parent
97 * @param before The key to insert before. If not provided, the function appends instead.
98 * @param insert Object with the key/value pairs to insert
99 * @param root The object that contains `inside`. If equal to Prism.languages, it can be omitted.
100 */
101 insertBefore: function (inside, before, insert, root) {
102 root = root || _.languages;
103 var grammar = root[inside];
104
105 if (arguments.length == 2) {
106 insert = arguments[1];
107
108 for (var newToken in insert) {
109 if (insert.hasOwnProperty(newToken)) {
110 grammar[newToken] = insert[newToken];
111 }
112 }
113
114 return grammar;
115 }
116
117 var ret = {};
118
119 for (var token in grammar) {
120 if (grammar.hasOwnProperty(token)) {
121 if (token == before) {
122 for (var newToken in insert) {
123 if (insert.hasOwnProperty(newToken)) {
124 ret[newToken] = insert[newToken];
125 }
126 }
127 }
128
129 ret[token] = grammar[token];
130 }
131 } // Update references in other language definitions
132
133
134 _.languages.DFS(_.languages, function (key, value) {
135 if (value === root[inside] && key != inside) {
136 this[key] = ret;
137 }
138 });
139
140 return root[inside] = ret;
141 },
142 // Traverse a language definition with Depth First Search
143 DFS: function (o, callback, type, visited) {
144 visited = visited || {};
145
146 for (var i in o) {
147 if (o.hasOwnProperty(i)) {
148 callback.call(o, i, o[i], type || i);
149
150 if (_.util.type(o[i]) === "Object" && !visited[_.util.objId(o[i])]) {
151 visited[_.util.objId(o[i])] = true;
152
153 _.languages.DFS(o[i], callback, null, visited);
154 } else if (_.util.type(o[i]) === "Array" && !visited[_.util.objId(o[i])]) {
155 visited[_.util.objId(o[i])] = true;
156
157 _.languages.DFS(o[i], callback, i, visited);
158 }
159 }
160 }
161 }
162 },
163 plugins: {},
164 highlight: function (text, grammar, language) {
165 var env = {
166 code: text,
167 grammar: grammar,
168 language: language
169 };
170
171 _.hooks.run("before-tokenize", env);
172
173 env.tokens = _.tokenize(env.code, env.grammar);
174
175 _.hooks.run("after-tokenize", env);
176
177 return Token.stringify(_.util.encode(env.tokens), env.language);
178 },
179 matchGrammar: function (text, strarr, grammar, index, startPos, oneshot, target) {
180 var Token = _.Token;
181
182 for (var token in grammar) {
183 if (!grammar.hasOwnProperty(token) || !grammar[token]) {
184 continue;
185 }
186
187 if (token == target) {
188 return;
189 }
190
191 var patterns = grammar[token];
192 patterns = _.util.type(patterns) === "Array" ? patterns : [patterns];
193
194 for (var j = 0; j < patterns.length; ++j) {
195 var pattern = patterns[j],
196 inside = pattern.inside,
197 lookbehind = !!pattern.lookbehind,
198 greedy = !!pattern.greedy,
199 lookbehindLength = 0,
200 alias = pattern.alias;
201
202 if (greedy && !pattern.pattern.global) {
203 // Without the global flag, lastIndex won't work
204 var flags = pattern.pattern.toString().match(/[imuy]*$/)[0];
205 pattern.pattern = RegExp(pattern.pattern.source, flags + "g");
206 }
207
208 pattern = pattern.pattern || pattern; // Don’t cache length as it changes during the loop
209
210 for (var i = index, pos = startPos; i < strarr.length; pos += strarr[i].length, ++i) {
211 var str = strarr[i];
212
213 if (strarr.length > text.length) {
214 // Something went terribly wrong, ABORT, ABORT!
215 return;
216 }
217
218 if (str instanceof Token) {
219 continue;
220 }
221
222 if (greedy && i != strarr.length - 1) {
223 pattern.lastIndex = pos;
224 var match = pattern.exec(text);
225
226 if (!match) {
227 break;
228 }
229
230 var from = match.index + (lookbehind ? match[1].length : 0),
231 to = match.index + match[0].length,
232 k = i,
233 p = pos;
234
235 for (var len = strarr.length; k < len && (p < to || !strarr[k].type && !strarr[k - 1].greedy); ++k) {
236 p += strarr[k].length; // Move the index i to the element in strarr that is closest to from
237
238 if (from >= p) {
239 ++i;
240 pos = p;
241 }
242 } // If strarr[i] is a Token, then the match starts inside another Token, which is invalid
243
244
245 if (strarr[i] instanceof Token) {
246 continue;
247 } // Number of tokens to delete and replace with the new match
248
249
250 delNum = k - i;
251 str = text.slice(pos, p);
252 match.index -= pos;
253 } else {
254 pattern.lastIndex = 0;
255 var match = pattern.exec(str),
256 delNum = 1;
257 }
258
259 if (!match) {
260 if (oneshot) {
261 break;
262 }
263
264 continue;
265 }
266
267 if (lookbehind) {
268 lookbehindLength = match[1] ? match[1].length : 0;
269 }
270
271 var from = match.index + lookbehindLength,
272 match = match[0].slice(lookbehindLength),
273 to = from + match.length,
274 before = str.slice(0, from),
275 after = str.slice(to);
276 var args = [i, delNum];
277
278 if (before) {
279 ++i;
280 pos += before.length;
281 args.push(before);
282 }
283
284 var wrapped = new Token(token, inside ? _.tokenize(match, inside) : match, alias, match, greedy);
285 args.push(wrapped);
286
287 if (after) {
288 args.push(after);
289 }
290
291 Array.prototype.splice.apply(strarr, args);
292
293 if (delNum != 1) {
294 _.matchGrammar(text, strarr, grammar, i, pos, true, token);
295 }
296
297 if (oneshot) {
298 break;
299 }
300 }
301 }
302 }
303 },
304 hooks: {
305 add: function () {},
306 run: function (name, env) {}
307 },
308 tokenize: function (text, grammar, language) {
309 var strarr = [text];
310 var rest = grammar.rest;
311
312 if (rest) {
313 for (var token in rest) {
314 grammar[token] = rest[token];
315 }
316
317 delete grammar.rest;
318 }
319
320 _.matchGrammar(text, strarr, grammar, 0, 0, false);
321
322 return strarr;
323 }
324 };
325
326 var Token = _.Token = function (type, content, alias, matchedStr, greedy) {
327 this.type = type;
328 this.content = content;
329 this.alias = alias; // Copy of the full string this token was created from
330
331 this.length = (matchedStr || "").length | 0;
332 this.greedy = !!greedy;
333 };
334
335 Token.stringify = function (o, language, parent) {
336 if (typeof o == "string") {
337 return o;
338 }
339
340 if (_.util.type(o) === "Array") {
341 return o.map(function (element) {
342 return Token.stringify(element, language, o);
343 }).join("");
344 }
345
346 var env = {
347 type: o.type,
348 content: Token.stringify(o.content, language, parent),
349 tag: "span",
350 classes: ["token", o.type],
351 attributes: {},
352 language: language,
353 parent: parent
354 };
355
356 if (o.alias) {
357 var aliases = _.util.type(o.alias) === "Array" ? o.alias : [o.alias];
358 Array.prototype.push.apply(env.classes, aliases);
359 }
360
361 var attributes = Object.keys(env.attributes).map(function (name) {
362 return name + '="' + (env.attributes[name] || "").replace(/"/g, "&quot;") + '"';
363 }).join(" ");
364 return "<" + env.tag + ' class="' + env.classes.join(" ") + '"' + (attributes ? " " + attributes : "") + ">" + env.content + "</" + env.tag + ">";
365 };
366
367 return _;
368}();
369
370/* This content is auto-generated to include some prismjs language components: */
371
372/* "prismjs/components/prism-markup" */
373
374Prism.languages.markup = {
375 'comment': /<!--[\s\S]*?-->/,
376 'prolog': /<\?[\s\S]+?\?>/,
377 'doctype': {
378 // https://www.w3.org/TR/xml/#NT-doctypedecl
379 pattern: /<!DOCTYPE(?:[^>"'[\]]|"[^"]*"|'[^']*')+(?:\[(?:[^<"'\]]|"[^"]*"|'[^']*'|<(?!!--)|<!--(?:[^-]|-(?!->))*-->)*\]\s*)?>/i,
380 greedy: true,
381 inside: {
382 'internal-subset': {
383 pattern: /(\[)[\s\S]+(?=\]>$)/,
384 lookbehind: true,
385 greedy: true,
386 inside: null // see below
387
388 },
389 'string': {
390 pattern: /"[^"]*"|'[^']*'/,
391 greedy: true
392 },
393 'punctuation': /^<!|>$|[[\]]/,
394 'doctype-tag': /^DOCTYPE/,
395 'name': /[^\s<>'"]+/
396 }
397 },
398 'cdata': /<!\[CDATA\[[\s\S]*?]]>/i,
399 'tag': {
400 pattern: /<\/?(?!\d)[^\s>\/=$<%]+(?:\s(?:\s*[^\s>\/=]+(?:\s*=\s*(?:"[^"]*"|'[^']*'|[^\s'">=]+(?=[\s>]))|(?=[\s/>])))+)?\s*\/?>/,
401 greedy: true,
402 inside: {
403 'tag': {
404 pattern: /^<\/?[^\s>\/]+/,
405 inside: {
406 'punctuation': /^<\/?/,
407 'namespace': /^[^\s>\/:]+:/
408 }
409 },
410 'attr-value': {
411 pattern: /=\s*(?:"[^"]*"|'[^']*'|[^\s'">=]+)/,
412 inside: {
413 'punctuation': [{
414 pattern: /^=/,
415 alias: 'attr-equals'
416 }, /"|'/]
417 }
418 },
419 'punctuation': /\/?>/,
420 'attr-name': {
421 pattern: /[^\s>\/]+/,
422 inside: {
423 'namespace': /^[^\s>\/:]+:/
424 }
425 }
426 }
427 },
428 'entity': [{
429 pattern: /&[\da-z]{1,8};/i,
430 alias: 'named-entity'
431 }, /&#x?[\da-f]{1,8};/i]
432};
433Prism.languages.markup['tag'].inside['attr-value'].inside['entity'] = Prism.languages.markup['entity'];
434Prism.languages.markup['doctype'].inside['internal-subset'].inside = Prism.languages.markup; // Plugin to make entity title show the real entity, idea by Roman Komarov
435
436Prism.hooks.add('wrap', function (env) {
437 if (env.type === 'entity') {
438 env.attributes['title'] = env.content.replace(/&amp;/, '&');
439 }
440});
441Object.defineProperty(Prism.languages.markup.tag, 'addInlined', {
442 /**
443 * Adds an inlined language to markup.
444 *
445 * An example of an inlined language is CSS with `<style>` tags.
446 *
447 * @param {string} tagName The name of the tag that contains the inlined language. This name will be treated as
448 * case insensitive.
449 * @param {string} lang The language key.
450 * @example
451 * addInlined('style', 'css');
452 */
453 value: function addInlined(tagName, lang) {
454 var includedCdataInside = {};
455 includedCdataInside['language-' + lang] = {
456 pattern: /(^<!\[CDATA\[)[\s\S]+?(?=\]\]>$)/i,
457 lookbehind: true,
458 inside: Prism.languages[lang]
459 };
460 includedCdataInside['cdata'] = /^<!\[CDATA\[|\]\]>$/i;
461 var inside = {
462 'included-cdata': {
463 pattern: /<!\[CDATA\[[\s\S]*?\]\]>/i,
464 inside: includedCdataInside
465 }
466 };
467 inside['language-' + lang] = {
468 pattern: /[\s\S]+/,
469 inside: Prism.languages[lang]
470 };
471 var def = {};
472 def[tagName] = {
473 pattern: RegExp(/(<__[^>]*>)(?:<!\[CDATA\[(?:[^\]]|\](?!\]>))*\]\]>|(?!<!\[CDATA\[)[\s\S])*?(?=<\/__>)/.source.replace(/__/g, function () {
474 return tagName;
475 }), 'i'),
476 lookbehind: true,
477 greedy: true,
478 inside: inside
479 };
480 Prism.languages.insertBefore('markup', 'cdata', def);
481 }
482});
483Prism.languages.html = Prism.languages.markup;
484Prism.languages.mathml = Prism.languages.markup;
485Prism.languages.svg = Prism.languages.markup;
486Prism.languages.xml = Prism.languages.extend('markup', {});
487Prism.languages.ssml = Prism.languages.xml;
488Prism.languages.atom = Prism.languages.xml;
489Prism.languages.rss = Prism.languages.xml;
490/* "prismjs/components/prism-bash" */
491
492(function (Prism) {
493 // $ set | grep '^[A-Z][^[:space:]]*=' | cut -d= -f1 | tr '\n' '|'
494 // + LC_ALL, RANDOM, REPLY, SECONDS.
495 // + make sure PS1..4 are here as they are not always set,
496 // - some useless things.
497 var envVars = '\\b(?:BASH|BASHOPTS|BASH_ALIASES|BASH_ARGC|BASH_ARGV|BASH_CMDS|BASH_COMPLETION_COMPAT_DIR|BASH_LINENO|BASH_REMATCH|BASH_SOURCE|BASH_VERSINFO|BASH_VERSION|COLORTERM|COLUMNS|COMP_WORDBREAKS|DBUS_SESSION_BUS_ADDRESS|DEFAULTS_PATH|DESKTOP_SESSION|DIRSTACK|DISPLAY|EUID|GDMSESSION|GDM_LANG|GNOME_KEYRING_CONTROL|GNOME_KEYRING_PID|GPG_AGENT_INFO|GROUPS|HISTCONTROL|HISTFILE|HISTFILESIZE|HISTSIZE|HOME|HOSTNAME|HOSTTYPE|IFS|INSTANCE|JOB|LANG|LANGUAGE|LC_ADDRESS|LC_ALL|LC_IDENTIFICATION|LC_MEASUREMENT|LC_MONETARY|LC_NAME|LC_NUMERIC|LC_PAPER|LC_TELEPHONE|LC_TIME|LESSCLOSE|LESSOPEN|LINES|LOGNAME|LS_COLORS|MACHTYPE|MAILCHECK|MANDATORY_PATH|NO_AT_BRIDGE|OLDPWD|OPTERR|OPTIND|ORBIT_SOCKETDIR|OSTYPE|PAPERSIZE|PATH|PIPESTATUS|PPID|PS1|PS2|PS3|PS4|PWD|RANDOM|REPLY|SECONDS|SELINUX_INIT|SESSION|SESSIONTYPE|SESSION_MANAGER|SHELL|SHELLOPTS|SHLVL|SSH_AUTH_SOCK|TERM|UID|UPSTART_EVENTS|UPSTART_INSTANCE|UPSTART_JOB|UPSTART_SESSION|USER|WINDOWID|XAUTHORITY|XDG_CONFIG_DIRS|XDG_CURRENT_DESKTOP|XDG_DATA_DIRS|XDG_GREETER_DATA_DIR|XDG_MENU_PREFIX|XDG_RUNTIME_DIR|XDG_SEAT|XDG_SEAT_PATH|XDG_SESSION_DESKTOP|XDG_SESSION_ID|XDG_SESSION_PATH|XDG_SESSION_TYPE|XDG_VTNR|XMODIFIERS)\\b';
498 var commandAfterHeredoc = {
499 pattern: /(^(["']?)\w+\2)[ \t]+\S.*/,
500 lookbehind: true,
501 alias: 'punctuation',
502 // this looks reasonably well in all themes
503 inside: null // see below
504
505 };
506 var insideString = {
507 'bash': commandAfterHeredoc,
508 'environment': {
509 pattern: RegExp("\\$" + envVars),
510 alias: 'constant'
511 },
512 'variable': [// [0]: Arithmetic Environment
513 {
514 pattern: /\$?\(\([\s\S]+?\)\)/,
515 greedy: true,
516 inside: {
517 // If there is a $ sign at the beginning highlight $(( and )) as variable
518 'variable': [{
519 pattern: /(^\$\(\([\s\S]+)\)\)/,
520 lookbehind: true
521 }, /^\$\(\(/],
522 'number': /\b0x[\dA-Fa-f]+\b|(?:\b\d+(?:\.\d*)?|\B\.\d+)(?:[Ee]-?\d+)?/,
523 // Operators according to https://www.gnu.org/software/bash/manual/bashref.html#Shell-Arithmetic
524 'operator': /--?|-=|\+\+?|\+=|!=?|~|\*\*?|\*=|\/=?|%=?|<<=?|>>=?|<=?|>=?|==?|&&?|&=|\^=?|\|\|?|\|=|\?|:/,
525 // If there is no $ sign at the beginning highlight (( and )) as punctuation
526 'punctuation': /\(\(?|\)\)?|,|;/
527 }
528 }, // [1]: Command Substitution
529 {
530 pattern: /\$\((?:\([^)]+\)|[^()])+\)|`[^`]+`/,
531 greedy: true,
532 inside: {
533 'variable': /^\$\(|^`|\)$|`$/
534 }
535 }, // [2]: Brace expansion
536 {
537 pattern: /\$\{[^}]+\}/,
538 greedy: true,
539 inside: {
540 'operator': /:[-=?+]?|[!\/]|##?|%%?|\^\^?|,,?/,
541 'punctuation': /[\[\]]/,
542 'environment': {
543 pattern: RegExp("(\\{)" + envVars),
544 lookbehind: true,
545 alias: 'constant'
546 }
547 }
548 }, /\$(?:\w+|[#?*!@$])/],
549 // Escape sequences from echo and printf's manuals, and escaped quotes.
550 'entity': /\\(?:[abceEfnrtv\\"]|O?[0-7]{1,3}|x[0-9a-fA-F]{1,2}|u[0-9a-fA-F]{4}|U[0-9a-fA-F]{8})/
551 };
552 Prism.languages.bash = {
553 'shebang': {
554 pattern: /^#!\s*\/.*/,
555 alias: 'important'
556 },
557 'comment': {
558 pattern: /(^|[^"{\\$])#.*/,
559 lookbehind: true
560 },
561 'function-name': [// a) function foo {
562 // b) foo() {
563 // c) function foo() {
564 // but not “foo {”
565 {
566 // a) and c)
567 pattern: /(\bfunction\s+)\w+(?=(?:\s*\(?:\s*\))?\s*\{)/,
568 lookbehind: true,
569 alias: 'function'
570 }, {
571 // b)
572 pattern: /\b\w+(?=\s*\(\s*\)\s*\{)/,
573 alias: 'function'
574 }],
575 // Highlight variable names as variables in for and select beginnings.
576 'for-or-select': {
577 pattern: /(\b(?:for|select)\s+)\w+(?=\s+in\s)/,
578 alias: 'variable',
579 lookbehind: true
580 },
581 // Highlight variable names as variables in the left-hand part
582 // of assignments (“=” and “+=”).
583 'assign-left': {
584 pattern: /(^|[\s;|&]|[<>]\()\w+(?=\+?=)/,
585 inside: {
586 'environment': {
587 pattern: RegExp("(^|[\\s;|&]|[<>]\\()" + envVars),
588 lookbehind: true,
589 alias: 'constant'
590 }
591 },
592 alias: 'variable',
593 lookbehind: true
594 },
595 'string': [// Support for Here-documents https://en.wikipedia.org/wiki/Here_document
596 {
597 pattern: /((?:^|[^<])<<-?\s*)(\w+?)\s[\s\S]*?(?:\r?\n|\r)\2/,
598 lookbehind: true,
599 greedy: true,
600 inside: insideString
601 }, // Here-document with quotes around the tag
602 // → No expansion (so no “inside”).
603 {
604 pattern: /((?:^|[^<])<<-?\s*)(["'])(\w+)\2\s[\s\S]*?(?:\r?\n|\r)\3/,
605 lookbehind: true,
606 greedy: true,
607 inside: {
608 'bash': commandAfterHeredoc
609 }
610 }, // “Normal” string
611 {
612 pattern: /(^|[^\\](?:\\\\)*)(["'])(?:\\[\s\S]|\$\([^)]+\)|\$(?!\()|`[^`]+`|(?!\2)[^\\`$])*\2/,
613 lookbehind: true,
614 greedy: true,
615 inside: insideString
616 }],
617 'environment': {
618 pattern: RegExp("\\$?" + envVars),
619 alias: 'constant'
620 },
621 'variable': insideString.variable,
622 'function': {
623 pattern: /(^|[\s;|&]|[<>]\()(?:add|apropos|apt|aptitude|apt-cache|apt-get|aspell|automysqlbackup|awk|basename|bash|bc|bconsole|bg|bzip2|cal|cat|cfdisk|chgrp|chkconfig|chmod|chown|chroot|cksum|clear|cmp|column|comm|composer|cp|cron|crontab|csplit|curl|cut|date|dc|dd|ddrescue|debootstrap|df|diff|diff3|dig|dir|dircolors|dirname|dirs|dmesg|du|egrep|eject|env|ethtool|expand|expect|expr|fdformat|fdisk|fg|fgrep|file|find|fmt|fold|format|free|fsck|ftp|fuser|gawk|git|gparted|grep|groupadd|groupdel|groupmod|groups|grub-mkconfig|gzip|halt|head|hg|history|host|hostname|htop|iconv|id|ifconfig|ifdown|ifup|import|install|ip|jobs|join|kill|killall|less|link|ln|locate|logname|logrotate|look|lpc|lpr|lprint|lprintd|lprintq|lprm|ls|lsof|lynx|make|man|mc|mdadm|mkconfig|mkdir|mke2fs|mkfifo|mkfs|mkisofs|mknod|mkswap|mmv|more|most|mount|mtools|mtr|mutt|mv|nano|nc|netstat|nice|nl|nohup|notify-send|npm|nslookup|op|open|parted|passwd|paste|pathchk|ping|pkill|pnpm|popd|pr|printcap|printenv|ps|pushd|pv|quota|quotacheck|quotactl|ram|rar|rcp|reboot|remsync|rename|renice|rev|rm|rmdir|rpm|rsync|scp|screen|sdiff|sed|sendmail|seq|service|sftp|sh|shellcheck|shuf|shutdown|sleep|slocate|sort|split|ssh|stat|strace|su|sudo|sum|suspend|swapon|sync|tac|tail|tar|tee|time|timeout|top|touch|tr|traceroute|tsort|tty|umount|uname|unexpand|uniq|units|unrar|unshar|unzip|update-grub|uptime|useradd|userdel|usermod|users|uudecode|uuencode|v|vdir|vi|vim|virsh|vmstat|wait|watch|wc|wget|whereis|which|who|whoami|write|xargs|xdg-open|yarn|yes|zenity|zip|zsh|zypper)(?=$|[)\s;|&])/,
624 lookbehind: true
625 },
626 'keyword': {
627 pattern: /(^|[\s;|&]|[<>]\()(?:if|then|else|elif|fi|for|while|in|case|esac|function|select|do|done|until)(?=$|[)\s;|&])/,
628 lookbehind: true
629 },
630 // https://www.gnu.org/software/bash/manual/html_node/Shell-Builtin-Commands.html
631 'builtin': {
632 pattern: /(^|[\s;|&]|[<>]\()(?:\.|:|break|cd|continue|eval|exec|exit|export|getopts|hash|pwd|readonly|return|shift|test|times|trap|umask|unset|alias|bind|builtin|caller|command|declare|echo|enable|help|let|local|logout|mapfile|printf|read|readarray|source|type|typeset|ulimit|unalias|set|shopt)(?=$|[)\s;|&])/,
633 lookbehind: true,
634 // Alias added to make those easier to distinguish from strings.
635 alias: 'class-name'
636 },
637 'boolean': {
638 pattern: /(^|[\s;|&]|[<>]\()(?:true|false)(?=$|[)\s;|&])/,
639 lookbehind: true
640 },
641 'file-descriptor': {
642 pattern: /\B&\d\b/,
643 alias: 'important'
644 },
645 'operator': {
646 // Lots of redirections here, but not just that.
647 pattern: /\d?<>|>\||\+=|==?|!=?|=~|<<[<-]?|[&\d]?>>|\d?[<>]&?|&[>&]?|\|[&|]?|<=?|>=?/,
648 inside: {
649 'file-descriptor': {
650 pattern: /^\d/,
651 alias: 'important'
652 }
653 }
654 },
655 'punctuation': /\$?\(\(?|\)\)?|\.\.|[{}[\];\\]/,
656 'number': {
657 pattern: /(^|\s)(?:[1-9]\d*|0)(?:[.,]\d+)?\b/,
658 lookbehind: true
659 }
660 };
661 commandAfterHeredoc.inside = Prism.languages.bash;
662 /* Patterns in command substitution. */
663
664 var toBeCopied = ['comment', 'function-name', 'for-or-select', 'assign-left', 'string', 'environment', 'function', 'keyword', 'builtin', 'boolean', 'file-descriptor', 'operator', 'punctuation', 'number'];
665 var inside = insideString.variable[1].inside;
666
667 for (var i = 0; i < toBeCopied.length; i++) {
668 inside[toBeCopied[i]] = Prism.languages.bash[toBeCopied[i]];
669 }
670
671 Prism.languages.shell = Prism.languages.bash;
672})(Prism);
673/* "prismjs/components/prism-clike" */
674
675
676Prism.languages.clike = {
677 'comment': [{
678 pattern: /(^|[^\\])\/\*[\s\S]*?(?:\*\/|$)/,
679 lookbehind: true,
680 greedy: true
681 }, {
682 pattern: /(^|[^\\:])\/\/.*/,
683 lookbehind: true,
684 greedy: true
685 }],
686 'string': {
687 pattern: /(["'])(?:\\(?:\r\n|[\s\S])|(?!\1)[^\\\r\n])*\1/,
688 greedy: true
689 },
690 'class-name': {
691 pattern: /(\b(?:class|interface|extends|implements|trait|instanceof|new)\s+|\bcatch\s+\()[\w.\\]+/i,
692 lookbehind: true,
693 inside: {
694 'punctuation': /[.\\]/
695 }
696 },
697 'keyword': /\b(?:if|else|while|do|for|return|in|instanceof|function|new|try|throw|catch|finally|null|break|continue)\b/,
698 'boolean': /\b(?:true|false)\b/,
699 'function': /\w+(?=\()/,
700 'number': /\b0x[\da-f]+\b|(?:\b\d+(?:\.\d*)?|\B\.\d+)(?:e[+-]?\d+)?/i,
701 'operator': /[<>]=?|[!=]=?=?|--?|\+\+?|&&?|\|\|?|[?*/~^%]/,
702 'punctuation': /[{}[\];(),.:]/
703};
704/* "prismjs/components/prism-c" */
705
706Prism.languages.c = Prism.languages.extend('clike', {
707 'comment': {
708 pattern: /\/\/(?:[^\r\n\\]|\\(?:\r\n?|\n|(?![\r\n])))*|\/\*[\s\S]*?(?:\*\/|$)/,
709 greedy: true
710 },
711 'class-name': {
712 pattern: /(\b(?:enum|struct)\s+(?:__attribute__\s*\(\([\s\S]*?\)\)\s*)?)\w+|\b[a-z]\w*_t\b/,
713 lookbehind: true
714 },
715 'keyword': /\b(?:__attribute__|_Alignas|_Alignof|_Atomic|_Bool|_Complex|_Generic|_Imaginary|_Noreturn|_Static_assert|_Thread_local|asm|typeof|inline|auto|break|case|char|const|continue|default|do|double|else|enum|extern|float|for|goto|if|int|long|register|return|short|signed|sizeof|static|struct|switch|typedef|union|unsigned|void|volatile|while)\b/,
716 'function': /[a-z_]\w*(?=\s*\()/i,
717 'number': /(?:\b0x(?:[\da-f]+(?:\.[\da-f]*)?|\.[\da-f]+)(?:p[+-]?\d+)?|(?:\b\d+(?:\.\d*)?|\B\.\d+)(?:e[+-]?\d+)?)[ful]{0,4}/i,
718 'operator': />>=?|<<=?|->|([-+&|:])\1|[?:~]|[-+*/%&|^!=<>]=?/
719});
720Prism.languages.insertBefore('c', 'string', {
721 'macro': {
722 // allow for multiline macro definitions
723 // spaces after the # character compile fine with gcc
724 pattern: /(^\s*)#\s*[a-z](?:[^\r\n\\/]|\/(?!\*)|\/\*(?:[^*]|\*(?!\/))*\*\/|\\(?:\r\n|[\s\S]))*/im,
725 lookbehind: true,
726 greedy: true,
727 alias: 'property',
728 inside: {
729 'string': [{
730 // highlight the path of the include statement as a string
731 pattern: /^(#\s*include\s*)<[^>]+>/,
732 lookbehind: true
733 }, Prism.languages.c['string']],
734 'comment': Prism.languages.c['comment'],
735 'macro-name': [{
736 pattern: /(^#\s*define\s+)\w+\b(?!\()/i,
737 lookbehind: true
738 }, {
739 pattern: /(^#\s*define\s+)\w+\b(?=\()/i,
740 lookbehind: true,
741 alias: 'function'
742 }],
743 // highlight macro directives as keywords
744 'directive': {
745 pattern: /^(#\s*)[a-z]+/,
746 lookbehind: true,
747 alias: 'keyword'
748 },
749 'directive-hash': /^#/,
750 'punctuation': /##|\\(?=[\r\n])/,
751 'expression': {
752 pattern: /\S[\s\S]*/,
753 inside: Prism.languages.c
754 }
755 }
756 },
757 // highlight predefined macros as constants
758 'constant': /\b(?:__FILE__|__LINE__|__DATE__|__TIME__|__TIMESTAMP__|__func__|EOF|NULL|SEEK_CUR|SEEK_END|SEEK_SET|stdin|stdout|stderr)\b/
759});
760delete Prism.languages.c['boolean'];
761/* "prismjs/components/prism-cpp" */
762
763(function (Prism) {
764 var keyword = /\b(?:alignas|alignof|asm|auto|bool|break|case|catch|char|char8_t|char16_t|char32_t|class|compl|concept|const|consteval|constexpr|constinit|const_cast|continue|co_await|co_return|co_yield|decltype|default|delete|do|double|dynamic_cast|else|enum|explicit|export|extern|float|for|friend|goto|if|inline|int|int8_t|int16_t|int32_t|int64_t|uint8_t|uint16_t|uint32_t|uint64_t|long|mutable|namespace|new|noexcept|nullptr|operator|private|protected|public|register|reinterpret_cast|requires|return|short|signed|sizeof|static|static_assert|static_cast|struct|switch|template|this|thread_local|throw|try|typedef|typeid|typename|union|unsigned|using|virtual|void|volatile|wchar_t|while)\b/;
765 Prism.languages.cpp = Prism.languages.extend('c', {
766 'class-name': [{
767 pattern: RegExp(/(\b(?:class|concept|enum|struct|typename)\s+)(?!<keyword>)\w+/.source.replace(/<keyword>/g, function () {
768 return keyword.source;
769 })),
770 lookbehind: true
771 }, // This is intended to capture the class name of method implementations like:
772 // void foo::bar() const {}
773 // However! The `foo` in the above example could also be a namespace, so we only capture the class name if
774 // it starts with an uppercase letter. This approximation should give decent results.
775 /\b[A-Z]\w*(?=\s*::\s*\w+\s*\()/, // This will capture the class name before destructors like:
776 // Foo::~Foo() {}
777 /\b[A-Z_]\w*(?=\s*::\s*~\w+\s*\()/i, // This also intends to capture the class name of method implementations but here the class has template
778 // parameters, so it can't be a namespace (until C++ adds generic namespaces).
779 /\w+(?=\s*<(?:[^<>]|<(?:[^<>]|<[^<>]*>)*>)*>\s*::\s*\w+\s*\()/],
780 'keyword': keyword,
781 'number': {
782 pattern: /(?:\b0b[01']+|\b0x(?:[\da-f']+(?:\.[\da-f']*)?|\.[\da-f']+)(?:p[+-]?[\d']+)?|(?:\b[\d']+(?:\.[\d']*)?|\B\.[\d']+)(?:e[+-]?[\d']+)?)[ful]{0,4}/i,
783 greedy: true
784 },
785 'operator': />>=?|<<=?|->|([-+&|:])\1|[?:~]|<=>|[-+*/%&|^!=<>]=?|\b(?:and|and_eq|bitand|bitor|not|not_eq|or|or_eq|xor|xor_eq)\b/,
786 'boolean': /\b(?:true|false)\b/
787 });
788 Prism.languages.insertBefore('cpp', 'string', {
789 'raw-string': {
790 pattern: /R"([^()\\ ]{0,16})\([\s\S]*?\)\1"/,
791 alias: 'string',
792 greedy: true
793 }
794 });
795 Prism.languages.insertBefore('cpp', 'class-name', {
796 // the base clause is an optional list of parent classes
797 // https://en.cppreference.com/w/cpp/language/class
798 'base-clause': {
799 pattern: /(\b(?:class|struct)\s+\w+\s*:\s*)[^;{}"'\s]+(?:\s+[^;{}"'\s]+)*(?=\s*[;{])/,
800 lookbehind: true,
801 greedy: true,
802 inside: Prism.languages.extend('cpp', {})
803 }
804 });
805 Prism.languages.insertBefore('inside', 'operator', {
806 // All untokenized words that are not namespaces should be class names
807 'class-name': /\b[a-z_]\w*\b(?!\s*::)/i
808 }, Prism.languages.cpp['base-clause']);
809})(Prism);
810/* "prismjs/components/prism-css" */
811
812
813(function (Prism) {
814 var string = /("|')(?:\\(?:\r\n|[\s\S])|(?!\1)[^\\\r\n])*\1/;
815 Prism.languages.css = {
816 'comment': /\/\*[\s\S]*?\*\//,
817 'atrule': {
818 pattern: /@[\w-](?:[^;{\s]|\s+(?![\s{]))*(?:;|(?=\s*\{))/,
819 inside: {
820 'rule': /^@[\w-]+/,
821 'selector-function-argument': {
822 pattern: /(\bselector\s*\(\s*(?![\s)]))(?:[^()\s]|\s+(?![\s)])|\((?:[^()]|\([^()]*\))*\))+(?=\s*\))/,
823 lookbehind: true,
824 alias: 'selector'
825 },
826 'keyword': {
827 pattern: /(^|[^\w-])(?:and|not|only|or)(?![\w-])/,
828 lookbehind: true
829 } // See rest below
830
831 }
832 },
833 'url': {
834 // https://drafts.csswg.org/css-values-3/#urls
835 pattern: RegExp('\\burl\\((?:' + string.source + '|' + /(?:[^\\\r\n()"']|\\[\s\S])*/.source + ')\\)', 'i'),
836 greedy: true,
837 inside: {
838 'function': /^url/i,
839 'punctuation': /^\(|\)$/,
840 'string': {
841 pattern: RegExp('^' + string.source + '$'),
842 alias: 'url'
843 }
844 }
845 },
846 'selector': RegExp('[^{}\\s](?:[^{};"\'\\s]|\\s+(?![\\s{])|' + string.source + ')*(?=\\s*\\{)'),
847 'string': {
848 pattern: string,
849 greedy: true
850 },
851 'property': /(?!\s)[-_a-z\xA0-\uFFFF](?:(?!\s)[-\w\xA0-\uFFFF])*(?=\s*:)/i,
852 'important': /!important\b/i,
853 'function': /[-a-z0-9]+(?=\()/i,
854 'punctuation': /[(){};:,]/
855 };
856 Prism.languages.css['atrule'].inside.rest = Prism.languages.css;
857 var markup = Prism.languages.markup;
858
859 if (markup) {
860 markup.tag.addInlined('style', 'css');
861 Prism.languages.insertBefore('inside', 'attr-value', {
862 'style-attr': {
863 pattern: /(^|["'\s])style\s*=\s*(?:"[^"]*"|'[^']*')/i,
864 lookbehind: true,
865 inside: {
866 'attr-value': {
867 pattern: /=\s*(?:"[^"]*"|'[^']*'|[^\s'">=]+)/,
868 inside: {
869 'style': {
870 pattern: /(["'])[\s\S]+(?=["']$)/,
871 lookbehind: true,
872 alias: 'language-css',
873 inside: Prism.languages.css
874 },
875 'punctuation': [{
876 pattern: /^=/,
877 alias: 'attr-equals'
878 }, /"|'/]
879 }
880 },
881 'attr-name': /^style/i
882 }
883 }
884 }, markup.tag);
885 }
886})(Prism);
887/* "prismjs/components/prism-css-extras" */
888
889
890(function (Prism) {
891 var string = /("|')(?:\\(?:\r\n|[\s\S])|(?!\1)[^\\\r\n])*\1/;
892 var selectorInside;
893 Prism.languages.css.selector = {
894 pattern: Prism.languages.css.selector,
895 inside: selectorInside = {
896 'pseudo-element': /:(?:after|before|first-letter|first-line|selection)|::[-\w]+/,
897 'pseudo-class': /:[-\w]+/,
898 'class': /\.[-\w]+/,
899 'id': /#[-\w]+/,
900 'attribute': {
901 pattern: RegExp('\\[(?:[^[\\]"\']|' + string.source + ')*\\]'),
902 greedy: true,
903 inside: {
904 'punctuation': /^\[|\]$/,
905 'case-sensitivity': {
906 pattern: /(\s)[si]$/i,
907 lookbehind: true,
908 alias: 'keyword'
909 },
910 'namespace': {
911 pattern: /^(\s*)(?:(?!\s)[-*\w\xA0-\uFFFF])*\|(?!=)/,
912 lookbehind: true,
913 inside: {
914 'punctuation': /\|$/
915 }
916 },
917 'attr-name': {
918 pattern: /^(\s*)(?:(?!\s)[-\w\xA0-\uFFFF])+/,
919 lookbehind: true
920 },
921 'attr-value': [string, {
922 pattern: /(=\s*)(?:(?!\s)[-\w\xA0-\uFFFF])+(?=\s*$)/,
923 lookbehind: true
924 }],
925 'operator': /[|~*^$]?=/
926 }
927 },
928 'n-th': [{
929 pattern: /(\(\s*)[+-]?\d*[\dn](?:\s*[+-]\s*\d+)?(?=\s*\))/,
930 lookbehind: true,
931 inside: {
932 'number': /[\dn]+/,
933 'operator': /[+-]/
934 }
935 }, {
936 pattern: /(\(\s*)(?:even|odd)(?=\s*\))/i,
937 lookbehind: true
938 }],
939 'combinator': />|\+|~|\|\|/,
940 // the `tag` token has been existed and removed.
941 // because we can't find a perfect tokenize to match it.
942 // if you want to add it, please read https://github.com/PrismJS/prism/pull/2373 first.
943 'punctuation': /[(),]/
944 }
945 };
946 Prism.languages.css['atrule'].inside['selector-function-argument'].inside = selectorInside;
947 Prism.languages.insertBefore('css', 'property', {
948 'variable': {
949 pattern: /(^|[^-\w\xA0-\uFFFF])--(?!\s)[-_a-z\xA0-\uFFFF](?:(?!\s)[-\w\xA0-\uFFFF])*/i,
950 lookbehind: true
951 }
952 });
953 var unit = {
954 pattern: /(\b\d+)(?:%|[a-z]+\b)/,
955 lookbehind: true
956 }; // 123 -123 .123 -.123 12.3 -12.3
957
958 var number = {
959 pattern: /(^|[^\w.-])-?(?:\d+(?:\.\d+)?|\.\d+)/,
960 lookbehind: true
961 };
962 Prism.languages.insertBefore('css', 'function', {
963 'operator': {
964 pattern: /(\s)[+\-*\/](?=\s)/,
965 lookbehind: true
966 },
967 // CAREFUL!
968 // Previewers and Inline color use hexcode and color.
969 'hexcode': {
970 pattern: /\B#(?:[\da-f]{1,2}){3,4}\b/i,
971 alias: 'color'
972 },
973 'color': [/\b(?:AliceBlue|AntiqueWhite|Aqua|Aquamarine|Azure|Beige|Bisque|Black|BlanchedAlmond|Blue|BlueViolet|Brown|BurlyWood|CadetBlue|Chartreuse|Chocolate|Coral|CornflowerBlue|Cornsilk|Crimson|Cyan|DarkBlue|DarkCyan|DarkGoldenRod|DarkGr[ae]y|DarkGreen|DarkKhaki|DarkMagenta|DarkOliveGreen|DarkOrange|DarkOrchid|DarkRed|DarkSalmon|DarkSeaGreen|DarkSlateBlue|DarkSlateGr[ae]y|DarkTurquoise|DarkViolet|DeepPink|DeepSkyBlue|DimGr[ae]y|DodgerBlue|FireBrick|FloralWhite|ForestGreen|Fuchsia|Gainsboro|GhostWhite|Gold|GoldenRod|Gr[ae]y|Green|GreenYellow|HoneyDew|HotPink|IndianRed|Indigo|Ivory|Khaki|Lavender|LavenderBlush|LawnGreen|LemonChiffon|LightBlue|LightCoral|LightCyan|LightGoldenRodYellow|LightGr[ae]y|LightGreen|LightPink|LightSalmon|LightSeaGreen|LightSkyBlue|LightSlateGr[ae]y|LightSteelBlue|LightYellow|Lime|LimeGreen|Linen|Magenta|Maroon|MediumAquaMarine|MediumBlue|MediumOrchid|MediumPurple|MediumSeaGreen|MediumSlateBlue|MediumSpringGreen|MediumTurquoise|MediumVioletRed|MidnightBlue|MintCream|MistyRose|Moccasin|NavajoWhite|Navy|OldLace|Olive|OliveDrab|Orange|OrangeRed|Orchid|PaleGoldenRod|PaleGreen|PaleTurquoise|PaleVioletRed|PapayaWhip|PeachPuff|Peru|Pink|Plum|PowderBlue|Purple|Red|RosyBrown|RoyalBlue|SaddleBrown|Salmon|SandyBrown|SeaGreen|SeaShell|Sienna|Silver|SkyBlue|SlateBlue|SlateGr[ae]y|Snow|SpringGreen|SteelBlue|Tan|Teal|Thistle|Tomato|Transparent|Turquoise|Violet|Wheat|White|WhiteSmoke|Yellow|YellowGreen)\b/i, {
974 pattern: /\b(?:rgb|hsl)\(\s*\d{1,3}\s*,\s*\d{1,3}%?\s*,\s*\d{1,3}%?\s*\)\B|\b(?:rgb|hsl)a\(\s*\d{1,3}\s*,\s*\d{1,3}%?\s*,\s*\d{1,3}%?\s*,\s*(?:0|0?\.\d+|1)\s*\)\B/i,
975 inside: {
976 'unit': unit,
977 'number': number,
978 'function': /[\w-]+(?=\()/,
979 'punctuation': /[(),]/
980 }
981 }],
982 // it's important that there is no boundary assertion after the hex digits
983 'entity': /\\[\da-f]{1,8}/i,
984 'unit': unit,
985 'number': number
986 });
987})(Prism);
988/* "prismjs/components/prism-javascript" */
989
990
991Prism.languages.javascript = Prism.languages.extend('clike', {
992 'class-name': [Prism.languages.clike['class-name'], {
993 pattern: /(^|[^$\w\xA0-\uFFFF])(?!\s)[_$A-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*(?=\.(?:prototype|constructor))/,
994 lookbehind: true
995 }],
996 'keyword': [{
997 pattern: /((?:^|})\s*)(?:catch|finally)\b/,
998 lookbehind: true
999 }, {
1000 pattern: /(^|[^.]|\.\.\.\s*)\b(?:as|async(?=\s*(?:function\b|\(|[$\w\xA0-\uFFFF]|$))|await|break|case|class|const|continue|debugger|default|delete|do|else|enum|export|extends|for|from|function|(?:get|set)(?=\s*[\[$\w\xA0-\uFFFF])|if|implements|import|in|instanceof|interface|let|new|null|of|package|private|protected|public|return|static|super|switch|this|throw|try|typeof|undefined|var|void|while|with|yield)\b/,
1001 lookbehind: true
1002 }],
1003 // Allow for all non-ASCII characters (See http://stackoverflow.com/a/2008444)
1004 'function': /#?(?!\s)[_$a-zA-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*(?=\s*(?:\.\s*(?:apply|bind|call)\s*)?\()/,
1005 'number': /\b(?:(?:0[xX](?:[\dA-Fa-f](?:_[\dA-Fa-f])?)+|0[bB](?:[01](?:_[01])?)+|0[oO](?:[0-7](?:_[0-7])?)+)n?|(?:\d(?:_\d)?)+n|NaN|Infinity)\b|(?:\b(?:\d(?:_\d)?)+\.?(?:\d(?:_\d)?)*|\B\.(?:\d(?:_\d)?)+)(?:[Ee][+-]?(?:\d(?:_\d)?)+)?/,
1006 'operator': /--|\+\+|\*\*=?|=>|&&=?|\|\|=?|[!=]==|<<=?|>>>?=?|[-+*/%&|^!=<>]=?|\.{3}|\?\?=?|\?\.?|[~:]/
1007});
1008Prism.languages.javascript['class-name'][0].pattern = /(\b(?:class|interface|extends|implements|instanceof|new)\s+)[\w.\\]+/;
1009Prism.languages.insertBefore('javascript', 'keyword', {
1010 'regex': {
1011 pattern: /((?:^|[^$\w\xA0-\uFFFF."'\])\s]|\b(?:return|yield))\s*)\/(?:\[(?:[^\]\\\r\n]|\\.)*]|\\.|[^/\\\[\r\n])+\/[gimyus]{0,6}(?=(?:\s|\/\*(?:[^*]|\*(?!\/))*\*\/)*(?:$|[\r\n,.;:})\]]|\/\/))/,
1012 lookbehind: true,
1013 greedy: true,
1014 inside: {
1015 'regex-source': {
1016 pattern: /^(\/)[\s\S]+(?=\/[a-z]*$)/,
1017 lookbehind: true,
1018 alias: 'language-regex',
1019 inside: Prism.languages.regex
1020 },
1021 'regex-flags': /[a-z]+$/,
1022 'regex-delimiter': /^\/|\/$/
1023 }
1024 },
1025 // This must be declared before keyword because we use "function" inside the look-forward
1026 'function-variable': {
1027 pattern: /#?(?!\s)[_$a-zA-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*(?=\s*[=:]\s*(?:async\s*)?(?:\bfunction\b|(?:\((?:[^()]|\([^()]*\))*\)|(?!\s)[_$a-zA-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*)\s*=>))/,
1028 alias: 'function'
1029 },
1030 'parameter': [{
1031 pattern: /(function(?:\s+(?!\s)[_$a-zA-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*)?\s*\(\s*)(?!\s)(?:[^()\s]|\s+(?![\s)])|\([^()]*\))+(?=\s*\))/,
1032 lookbehind: true,
1033 inside: Prism.languages.javascript
1034 }, {
1035 pattern: /(?!\s)[_$a-zA-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*(?=\s*=>)/i,
1036 inside: Prism.languages.javascript
1037 }, {
1038 pattern: /(\(\s*)(?!\s)(?:[^()\s]|\s+(?![\s)])|\([^()]*\))+(?=\s*\)\s*=>)/,
1039 lookbehind: true,
1040 inside: Prism.languages.javascript
1041 }, {
1042 pattern: /((?:\b|\s|^)(?!(?:as|async|await|break|case|catch|class|const|continue|debugger|default|delete|do|else|enum|export|extends|finally|for|from|function|get|if|implements|import|in|instanceof|interface|let|new|null|of|package|private|protected|public|return|set|static|super|switch|this|throw|try|typeof|undefined|var|void|while|with|yield)(?![$\w\xA0-\uFFFF]))(?:(?!\s)[_$a-zA-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*\s*)\(\s*|\]\s*\(\s*)(?!\s)(?:[^()\s]|\s+(?![\s)])|\([^()]*\))+(?=\s*\)\s*\{)/,
1043 lookbehind: true,
1044 inside: Prism.languages.javascript
1045 }],
1046 'constant': /\b[A-Z](?:[A-Z_]|\dx?)*\b/
1047});
1048Prism.languages.insertBefore('javascript', 'string', {
1049 'template-string': {
1050 pattern: /`(?:\\[\s\S]|\${(?:[^{}]|{(?:[^{}]|{[^}]*})*})+}|(?!\${)[^\\`])*`/,
1051 greedy: true,
1052 inside: {
1053 'template-punctuation': {
1054 pattern: /^`|`$/,
1055 alias: 'string'
1056 },
1057 'interpolation': {
1058 pattern: /((?:^|[^\\])(?:\\{2})*)\${(?:[^{}]|{(?:[^{}]|{[^}]*})*})+}/,
1059 lookbehind: true,
1060 inside: {
1061 'interpolation-punctuation': {
1062 pattern: /^\${|}$/,
1063 alias: 'punctuation'
1064 },
1065 rest: Prism.languages.javascript
1066 }
1067 },
1068 'string': /[\s\S]+/
1069 }
1070 }
1071});
1072
1073if (Prism.languages.markup) {
1074 Prism.languages.markup.tag.addInlined('script', 'javascript');
1075}
1076
1077Prism.languages.js = Prism.languages.javascript;
1078/* "prismjs/components/prism-jsx" */
1079
1080(function (Prism) {
1081 var javascript = Prism.util.clone(Prism.languages.javascript);
1082 Prism.languages.jsx = Prism.languages.extend('markup', javascript);
1083 Prism.languages.jsx.tag.pattern = /<\/?(?:[\w.:-]+(?:\s+(?:[\w.:$-]+(?:=(?:"(?:\\[^]|[^\\"])*"|'(?:\\[^]|[^\\'])*'|[^\s{'">=]+|\{(?:\{(?:\{[^{}]*\}|[^{}])*\}|[^{}])+\}))?|\{\s*\.{3}\s*[a-z_$][\w$]*(?:\.[a-z_$][\w$]*)*\s*\}))*\s*\/?)?>/i;
1084 Prism.languages.jsx.tag.inside['tag'].pattern = /^<\/?[^\s>\/]*/i;
1085 Prism.languages.jsx.tag.inside['attr-value'].pattern = /=(?!\{)(?:"(?:\\[^]|[^\\"])*"|'(?:\\[^]|[^\\'])*'|[^\s'">]+)/i;
1086 Prism.languages.jsx.tag.inside['tag'].inside['class-name'] = /^[A-Z]\w*(?:\.[A-Z]\w*)*$/;
1087 Prism.languages.insertBefore('inside', 'attr-name', {
1088 'spread': {
1089 pattern: /\{\s*\.{3}\s*[a-z_$][\w$]*(?:\.[a-z_$][\w$]*)*\s*\}/,
1090 inside: {
1091 'punctuation': /\.{3}|[{}.]/,
1092 'attr-value': /\w+/
1093 }
1094 }
1095 }, Prism.languages.jsx.tag);
1096 Prism.languages.insertBefore('inside', 'attr-value', {
1097 'script': {
1098 // Allow for two levels of nesting
1099 pattern: /=(?:\{(?:\{(?:\{[^{}]*\}|[^{}])*\}|[^{}])+\})/i,
1100 inside: {
1101 'script-punctuation': {
1102 pattern: /^=(?={)/,
1103 alias: 'punctuation'
1104 },
1105 rest: Prism.languages.jsx
1106 },
1107 'alias': 'language-javascript'
1108 }
1109 }, Prism.languages.jsx.tag); // The following will handle plain text inside tags
1110
1111 var stringifyToken = function (token) {
1112 if (!token) {
1113 return '';
1114 }
1115
1116 if (typeof token === 'string') {
1117 return token;
1118 }
1119
1120 if (typeof token.content === 'string') {
1121 return token.content;
1122 }
1123
1124 return token.content.map(stringifyToken).join('');
1125 };
1126
1127 var walkTokens = function (tokens) {
1128 var openedTags = [];
1129
1130 for (var i = 0; i < tokens.length; i++) {
1131 var token = tokens[i];
1132 var notTagNorBrace = false;
1133
1134 if (typeof token !== 'string') {
1135 if (token.type === 'tag' && token.content[0] && token.content[0].type === 'tag') {
1136 // We found a tag, now find its kind
1137 if (token.content[0].content[0].content === '</') {
1138 // Closing tag
1139 if (openedTags.length > 0 && openedTags[openedTags.length - 1].tagName === stringifyToken(token.content[0].content[1])) {
1140 // Pop matching opening tag
1141 openedTags.pop();
1142 }
1143 } else {
1144 if (token.content[token.content.length - 1].content === '/>') ; else {
1145 // Opening tag
1146 openedTags.push({
1147 tagName: stringifyToken(token.content[0].content[1]),
1148 openedBraces: 0
1149 });
1150 }
1151 }
1152 } else if (openedTags.length > 0 && token.type === 'punctuation' && token.content === '{') {
1153 // Here we might have entered a JSX context inside a tag
1154 openedTags[openedTags.length - 1].openedBraces++;
1155 } else if (openedTags.length > 0 && openedTags[openedTags.length - 1].openedBraces > 0 && token.type === 'punctuation' && token.content === '}') {
1156 // Here we might have left a JSX context inside a tag
1157 openedTags[openedTags.length - 1].openedBraces--;
1158 } else {
1159 notTagNorBrace = true;
1160 }
1161 }
1162
1163 if (notTagNorBrace || typeof token === 'string') {
1164 if (openedTags.length > 0 && openedTags[openedTags.length - 1].openedBraces === 0) {
1165 // Here we are inside a tag, and not inside a JSX context.
1166 // That's plain text: drop any tokens matched.
1167 var plainText = stringifyToken(token); // And merge text with adjacent text
1168
1169 if (i < tokens.length - 1 && (typeof tokens[i + 1] === 'string' || tokens[i + 1].type === 'plain-text')) {
1170 plainText += stringifyToken(tokens[i + 1]);
1171 tokens.splice(i + 1, 1);
1172 }
1173
1174 if (i > 0 && (typeof tokens[i - 1] === 'string' || tokens[i - 1].type === 'plain-text')) {
1175 plainText = stringifyToken(tokens[i - 1]) + plainText;
1176 tokens.splice(i - 1, 1);
1177 i--;
1178 }
1179
1180 tokens[i] = new Prism.Token('plain-text', plainText, null, plainText);
1181 }
1182 }
1183
1184 if (token.content && typeof token.content !== 'string') {
1185 walkTokens(token.content);
1186 }
1187 }
1188 };
1189
1190 Prism.hooks.add('after-tokenize', function (env) {
1191 if (env.language !== 'jsx' && env.language !== 'tsx') {
1192 return;
1193 }
1194
1195 walkTokens(env.tokens);
1196 });
1197})(Prism);
1198/* "prismjs/components/prism-js-extras" */
1199
1200
1201(function (Prism) {
1202 Prism.languages.insertBefore('javascript', 'function-variable', {
1203 'method-variable': {
1204 pattern: RegExp('(\\.\\s*)' + Prism.languages.javascript['function-variable'].pattern.source),
1205 lookbehind: true,
1206 alias: ['function-variable', 'method', 'function', 'property-access']
1207 }
1208 });
1209 Prism.languages.insertBefore('javascript', 'function', {
1210 'method': {
1211 pattern: RegExp('(\\.\\s*)' + Prism.languages.javascript['function'].source),
1212 lookbehind: true,
1213 alias: ['function', 'property-access']
1214 }
1215 });
1216 Prism.languages.insertBefore('javascript', 'constant', {
1217 'known-class-name': [{
1218 // standard built-ins
1219 // https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects
1220 pattern: /\b(?:(?:(?:Uint|Int)(?:8|16|32)|Uint8Clamped|Float(?:32|64))?Array|ArrayBuffer|BigInt|Boolean|DataView|Date|Error|Function|Intl|JSON|Math|Number|Object|Promise|Proxy|Reflect|RegExp|String|Symbol|(?:Weak)?(?:Set|Map)|WebAssembly)\b/,
1221 alias: 'class-name'
1222 }, {
1223 // errors
1224 pattern: /\b(?:[A-Z]\w*)Error\b/,
1225 alias: 'class-name'
1226 }]
1227 });
1228 /**
1229 * Replaces the `<ID>` placeholder in the given pattern with a pattern for general JS identifiers.
1230 *
1231 * @param {string} source
1232 * @param {string} [flags]
1233 * @returns {RegExp}
1234 */
1235
1236 function withId(source, flags) {
1237 return RegExp(source.replace(/<ID>/g, function () {
1238 return /(?!\s)[_$a-zA-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*/.source;
1239 }), flags);
1240 }
1241
1242 Prism.languages.insertBefore('javascript', 'keyword', {
1243 'imports': {
1244 // https://tc39.es/ecma262/#sec-imports
1245 pattern: withId(/(\bimport\b\s*)(?:<ID>(?:\s*,\s*(?:\*\s*as\s+<ID>|\{[^{}]*\}))?|\*\s*as\s+<ID>|\{[^{}]*\})(?=\s*\bfrom\b)/.source),
1246 lookbehind: true,
1247 inside: Prism.languages.javascript
1248 },
1249 'exports': {
1250 // https://tc39.es/ecma262/#sec-exports
1251 pattern: withId(/(\bexport\b\s*)(?:\*(?:\s*as\s+<ID>)?(?=\s*\bfrom\b)|\{[^{}]*\})/.source),
1252 lookbehind: true,
1253 inside: Prism.languages.javascript
1254 }
1255 });
1256 Prism.languages.javascript['keyword'].unshift({
1257 pattern: /\b(?:as|default|export|from|import)\b/,
1258 alias: 'module'
1259 }, {
1260 pattern: /\b(?:await|break|catch|continue|do|else|for|finally|if|return|switch|throw|try|while|yield)\b/,
1261 alias: 'control-flow'
1262 }, {
1263 pattern: /\bnull\b/,
1264 alias: ['null', 'nil']
1265 }, {
1266 pattern: /\bundefined\b/,
1267 alias: 'nil'
1268 });
1269 Prism.languages.insertBefore('javascript', 'operator', {
1270 'spread': {
1271 pattern: /\.{3}/,
1272 alias: 'operator'
1273 },
1274 'arrow': {
1275 pattern: /=>/,
1276 alias: 'operator'
1277 }
1278 });
1279 Prism.languages.insertBefore('javascript', 'punctuation', {
1280 'property-access': {
1281 pattern: withId(/(\.\s*)#?<ID>/.source),
1282 lookbehind: true
1283 },
1284 'maybe-class-name': {
1285 pattern: /(^|[^$\w\xA0-\uFFFF])[A-Z][$\w\xA0-\uFFFF]+/,
1286 lookbehind: true
1287 },
1288 'dom': {
1289 // this contains only a few commonly used DOM variables
1290 pattern: /\b(?:document|location|navigator|performance|(?:local|session)Storage|window)\b/,
1291 alias: 'variable'
1292 },
1293 'console': {
1294 pattern: /\bconsole(?=\s*\.)/,
1295 alias: 'class-name'
1296 }
1297 }); // add 'maybe-class-name' to tokens which might be a class name
1298
1299 var maybeClassNameTokens = ['function', 'function-variable', 'method', 'method-variable', 'property-access'];
1300
1301 for (var i = 0; i < maybeClassNameTokens.length; i++) {
1302 var token = maybeClassNameTokens[i];
1303 var value = Prism.languages.javascript[token]; // convert regex to object
1304
1305 if (Prism.util.type(value) === 'RegExp') {
1306 value = Prism.languages.javascript[token] = {
1307 pattern: value
1308 };
1309 } // keep in mind that we don't support arrays
1310
1311
1312 var inside = value.inside || {};
1313 value.inside = inside;
1314 inside['maybe-class-name'] = /^[A-Z][\s\S]*/;
1315 }
1316})(Prism);
1317/* "prismjs/components/prism-coffeescript" */
1318
1319
1320(function (Prism) {
1321 // Ignore comments starting with { to privilege string interpolation highlighting
1322 var comment = /#(?!\{).+/,
1323 interpolation = {
1324 pattern: /#\{[^}]+\}/,
1325 alias: 'variable'
1326 };
1327 Prism.languages.coffeescript = Prism.languages.extend('javascript', {
1328 'comment': comment,
1329 'string': [// Strings are multiline
1330 {
1331 pattern: /'(?:\\[\s\S]|[^\\'])*'/,
1332 greedy: true
1333 }, {
1334 // Strings are multiline
1335 pattern: /"(?:\\[\s\S]|[^\\"])*"/,
1336 greedy: true,
1337 inside: {
1338 'interpolation': interpolation
1339 }
1340 }],
1341 'keyword': /\b(?:and|break|by|catch|class|continue|debugger|delete|do|each|else|extend|extends|false|finally|for|if|in|instanceof|is|isnt|let|loop|namespace|new|no|not|null|of|off|on|or|own|return|super|switch|then|this|throw|true|try|typeof|undefined|unless|until|when|while|window|with|yes|yield)\b/,
1342 'class-member': {
1343 pattern: /@(?!\d)\w+/,
1344 alias: 'variable'
1345 }
1346 });
1347 Prism.languages.insertBefore('coffeescript', 'comment', {
1348 'multiline-comment': {
1349 pattern: /###[\s\S]+?###/,
1350 alias: 'comment'
1351 },
1352 // Block regexp can contain comments and interpolation
1353 'block-regex': {
1354 pattern: /\/{3}[\s\S]*?\/{3}/,
1355 alias: 'regex',
1356 inside: {
1357 'comment': comment,
1358 'interpolation': interpolation
1359 }
1360 }
1361 });
1362 Prism.languages.insertBefore('coffeescript', 'string', {
1363 'inline-javascript': {
1364 pattern: /`(?:\\[\s\S]|[^\\`])*`/,
1365 inside: {
1366 'delimiter': {
1367 pattern: /^`|`$/,
1368 alias: 'punctuation'
1369 },
1370 'script': {
1371 pattern: /[\s\S]+/,
1372 alias: 'language-javascript',
1373 inside: Prism.languages.javascript
1374 }
1375 }
1376 },
1377 // Block strings
1378 'multiline-string': [{
1379 pattern: /'''[\s\S]*?'''/,
1380 greedy: true,
1381 alias: 'string'
1382 }, {
1383 pattern: /"""[\s\S]*?"""/,
1384 greedy: true,
1385 alias: 'string',
1386 inside: {
1387 interpolation: interpolation
1388 }
1389 }]
1390 });
1391 Prism.languages.insertBefore('coffeescript', 'keyword', {
1392 // Object property
1393 'property': /(?!\d)\w+(?=\s*:(?!:))/
1394 });
1395 delete Prism.languages.coffeescript['template-string'];
1396 Prism.languages.coffee = Prism.languages.coffeescript;
1397})(Prism);
1398/* "prismjs/components/prism-diff" */
1399
1400
1401(function (Prism) {
1402 Prism.languages.diff = {
1403 'coord': [// Match all kinds of coord lines (prefixed by "+++", "---" or "***").
1404 /^(?:\*{3}|-{3}|\+{3}).*$/m, // Match "@@ ... @@" coord lines in unified diff.
1405 /^@@.*@@$/m, // Match coord lines in normal diff (starts with a number).
1406 /^\d.*$/m] // deleted, inserted, unchanged, diff
1407
1408 };
1409 /**
1410 * A map from the name of a block to its line prefix.
1411 *
1412 * @type {Object<string, string>}
1413 */
1414
1415 var PREFIXES = {
1416 'deleted-sign': '-',
1417 'deleted-arrow': '<',
1418 'inserted-sign': '+',
1419 'inserted-arrow': '>',
1420 'unchanged': ' ',
1421 'diff': '!'
1422 }; // add a token for each prefix
1423
1424 Object.keys(PREFIXES).forEach(function (name) {
1425 var prefix = PREFIXES[name];
1426 var alias = [];
1427
1428 if (!/^\w+$/.test(name)) {
1429 // "deleted-sign" -> "deleted"
1430 alias.push(/\w+/.exec(name)[0]);
1431 }
1432
1433 if (name === "diff") {
1434 alias.push("bold");
1435 }
1436
1437 Prism.languages.diff[name] = {
1438 pattern: RegExp('^(?:[' + prefix + '].*(?:\r\n?|\n|(?![\\s\\S])))+', 'm'),
1439 alias: alias,
1440 inside: {
1441 'line': {
1442 pattern: /(.)(?=[\s\S]).*(?:\r\n?|\n)?/,
1443 lookbehind: true
1444 },
1445 'prefix': {
1446 pattern: /[\s\S]/,
1447 alias: /\w+/.exec(name)[0]
1448 }
1449 }
1450 };
1451 }); // make prefixes available to Diff plugin
1452
1453 Object.defineProperty(Prism.languages.diff, 'PREFIXES', {
1454 value: PREFIXES
1455 });
1456})(Prism);
1457/* "prismjs/components/prism-git" */
1458
1459
1460Prism.languages.git = {
1461 /*
1462 * A simple one line comment like in a git status command
1463 * For instance:
1464 * $ git status
1465 * # On branch infinite-scroll
1466 * # Your branch and 'origin/sharedBranches/frontendTeam/infinite-scroll' have diverged,
1467 * # and have 1 and 2 different commits each, respectively.
1468 * nothing to commit (working directory clean)
1469 */
1470 'comment': /^#.*/m,
1471
1472 /*
1473 * Regexp to match the changed lines in a git diff output. Check the example below.
1474 */
1475 'deleted': /^[-–].*/m,
1476 'inserted': /^\+.*/m,
1477
1478 /*
1479 * a string (double and simple quote)
1480 */
1481 'string': /("|')(?:\\.|(?!\1)[^\\\r\n])*\1/m,
1482
1483 /*
1484 * a git command. It starts with a random prompt finishing by a $, then "git" then some other parameters
1485 * For instance:
1486 * $ git add file.txt
1487 */
1488 'command': {
1489 pattern: /^.*\$ git .*$/m,
1490 inside: {
1491 /*
1492 * A git command can contain a parameter starting by a single or a double dash followed by a string
1493 * For instance:
1494 * $ git diff --cached
1495 * $ git log -p
1496 */
1497 'parameter': /\s--?\w+/m
1498 }
1499 },
1500
1501 /*
1502 * Coordinates displayed in a git diff command
1503 * For instance:
1504 * $ git diff
1505 * diff --git file.txt file.txt
1506 * index 6214953..1d54a52 100644
1507 * --- file.txt
1508 * +++ file.txt
1509 * @@ -1 +1,2 @@
1510 * -Here's my tetx file
1511 * +Here's my text file
1512 * +And this is the second line
1513 */
1514 'coord': /^@@.*@@$/m,
1515
1516 /*
1517 * Match a "commit [SHA1]" line in a git log output.
1518 * For instance:
1519 * $ git log
1520 * commit a11a14ef7e26f2ca62d4b35eac455ce636d0dc09
1521 * Author: lgiraudel
1522 * Date: Mon Feb 17 11:18:34 2014 +0100
1523 *
1524 * Add of a new line
1525 */
1526 'commit-sha1': /^commit \w{40}$/m
1527};
1528/* "prismjs/components/prism-go" */
1529
1530Prism.languages.go = Prism.languages.extend('clike', {
1531 'string': {
1532 pattern: /(["'`])(?:\\[\s\S]|(?!\1)[^\\])*\1/,
1533 greedy: true
1534 },
1535 'keyword': /\b(?:break|case|chan|const|continue|default|defer|else|fallthrough|for|func|go(?:to)?|if|import|interface|map|package|range|return|select|struct|switch|type|var)\b/,
1536 'boolean': /\b(?:_|iota|nil|true|false)\b/,
1537 'number': /(?:\b0x[a-f\d]+|(?:\b\d+(?:\.\d*)?|\B\.\d+)(?:e[-+]?\d+)?)i?/i,
1538 'operator': /[*\/%^!=]=?|\+[=+]?|-[=-]?|\|[=|]?|&(?:=|&|\^=?)?|>(?:>=?|=)?|<(?:<=?|=|-)?|:=|\.\.\./,
1539 'builtin': /\b(?:bool|byte|complex(?:64|128)|error|float(?:32|64)|rune|string|u?int(?:8|16|32|64)?|uintptr|append|cap|close|complex|copy|delete|imag|len|make|new|panic|print(?:ln)?|real|recover)\b/
1540});
1541delete Prism.languages.go['class-name'];
1542/* "prismjs/components/prism-graphql" */
1543
1544Prism.languages.graphql = {
1545 'comment': /#.*/,
1546 'description': {
1547 pattern: /(?:"""(?:[^"]|(?!""")")*"""|"(?:\\.|[^\\"\r\n])*")(?=\s*[a-z_])/i,
1548 greedy: true,
1549 alias: 'string',
1550 inside: {
1551 'language-markdown': {
1552 pattern: /(^"(?:"")?)(?!\1)[\s\S]+(?=\1$)/,
1553 lookbehind: true,
1554 inside: Prism.languages.markdown
1555 }
1556 }
1557 },
1558 'string': {
1559 pattern: /"""(?:[^"]|(?!""")")*"""|"(?:\\.|[^\\"\r\n])*"/,
1560 greedy: true
1561 },
1562 'number': /(?:\B-|\b)\d+(?:\.\d+)?(?:e[+-]?\d+)?\b/i,
1563 'boolean': /\b(?:true|false)\b/,
1564 'variable': /\$[a-z_]\w*/i,
1565 'directive': {
1566 pattern: /@[a-z_]\w*/i,
1567 alias: 'function'
1568 },
1569 'attr-name': {
1570 pattern: /[a-z_]\w*(?=\s*(?:\((?:[^()"]|"(?:\\.|[^\\"\r\n])*")*\))?:)/i,
1571 greedy: true
1572 },
1573 'class-name': {
1574 pattern: /(\b(?:enum|implements|interface|on|scalar|type|union)\s+|&\s*)[a-zA-Z_]\w*/,
1575 lookbehind: true
1576 },
1577 'fragment': {
1578 pattern: /(\bfragment\s+|\.{3}\s*(?!on\b))[a-zA-Z_]\w*/,
1579 lookbehind: true,
1580 alias: 'function'
1581 },
1582 'keyword': /\b(?:directive|enum|extend|fragment|implements|input|interface|mutation|on|query|repeatable|scalar|schema|subscription|type|union)\b/,
1583 'operator': /[!=|&]|\.{3}/,
1584 'punctuation': /[!(){}\[\]:=,]/,
1585 'constant': /\b(?!ID\b)[A-Z][A-Z_\d]*\b/
1586};
1587/* "prismjs/components/prism-markup-templating" */
1588
1589(function (Prism) {
1590 /**
1591 * Returns the placeholder for the given language id and index.
1592 *
1593 * @param {string} language
1594 * @param {string|number} index
1595 * @returns {string}
1596 */
1597 function getPlaceholder(language, index) {
1598 return '___' + language.toUpperCase() + index + '___';
1599 }
1600
1601 Object.defineProperties(Prism.languages['markup-templating'] = {}, {
1602 buildPlaceholders: {
1603 /**
1604 * Tokenize all inline templating expressions matching `placeholderPattern`.
1605 *
1606 * If `replaceFilter` is provided, only matches of `placeholderPattern` for which `replaceFilter` returns
1607 * `true` will be replaced.
1608 *
1609 * @param {object} env The environment of the `before-tokenize` hook.
1610 * @param {string} language The language id.
1611 * @param {RegExp} placeholderPattern The matches of this pattern will be replaced by placeholders.
1612 * @param {(match: string) => boolean} [replaceFilter]
1613 */
1614 value: function (env, language, placeholderPattern, replaceFilter) {
1615 if (env.language !== language) {
1616 return;
1617 }
1618
1619 var tokenStack = env.tokenStack = [];
1620 env.code = env.code.replace(placeholderPattern, function (match) {
1621 if (typeof replaceFilter === 'function' && !replaceFilter(match)) {
1622 return match;
1623 }
1624
1625 var i = tokenStack.length;
1626 var placeholder; // Check for existing strings
1627
1628 while (env.code.indexOf(placeholder = getPlaceholder(language, i)) !== -1) {
1629 ++i;
1630 } // Create a sparse array
1631
1632
1633 tokenStack[i] = match;
1634 return placeholder;
1635 }); // Switch the grammar to markup
1636
1637 env.grammar = Prism.languages.markup;
1638 }
1639 },
1640 tokenizePlaceholders: {
1641 /**
1642 * Replace placeholders with proper tokens after tokenizing.
1643 *
1644 * @param {object} env The environment of the `after-tokenize` hook.
1645 * @param {string} language The language id.
1646 */
1647 value: function (env, language) {
1648 if (env.language !== language || !env.tokenStack) {
1649 return;
1650 } // Switch the grammar back
1651
1652
1653 env.grammar = Prism.languages[language];
1654 var j = 0;
1655 var keys = Object.keys(env.tokenStack);
1656
1657 function walkTokens(tokens) {
1658 for (var i = 0; i < tokens.length; i++) {
1659 // all placeholders are replaced already
1660 if (j >= keys.length) {
1661 break;
1662 }
1663
1664 var token = tokens[i];
1665
1666 if (typeof token === 'string' || token.content && typeof token.content === 'string') {
1667 var k = keys[j];
1668 var t = env.tokenStack[k];
1669 var s = typeof token === 'string' ? token : token.content;
1670 var placeholder = getPlaceholder(language, k);
1671 var index = s.indexOf(placeholder);
1672
1673 if (index > -1) {
1674 ++j;
1675 var before = s.substring(0, index);
1676 var middle = new Prism.Token(language, Prism.tokenize(t, env.grammar), 'language-' + language, t);
1677 var after = s.substring(index + placeholder.length);
1678 var replacement = [];
1679
1680 if (before) {
1681 replacement.push.apply(replacement, walkTokens([before]));
1682 }
1683
1684 replacement.push(middle);
1685
1686 if (after) {
1687 replacement.push.apply(replacement, walkTokens([after]));
1688 }
1689
1690 if (typeof token === 'string') {
1691 tokens.splice.apply(tokens, [i, 1].concat(replacement));
1692 } else {
1693 token.content = replacement;
1694 }
1695 }
1696 } else if (token.content
1697 /* && typeof token.content !== 'string' */
1698 ) {
1699 walkTokens(token.content);
1700 }
1701 }
1702
1703 return tokens;
1704 }
1705
1706 walkTokens(env.tokens);
1707 }
1708 }
1709 });
1710})(Prism);
1711/* "prismjs/components/prism-handlebars" */
1712
1713
1714(function (Prism) {
1715 Prism.languages.handlebars = {
1716 'comment': /\{\{![\s\S]*?\}\}/,
1717 'delimiter': {
1718 pattern: /^\{\{\{?|\}\}\}?$/i,
1719 alias: 'punctuation'
1720 },
1721 'string': /(["'])(?:\\.|(?!\1)[^\\\r\n])*\1/,
1722 'number': /\b0x[\dA-Fa-f]+\b|(?:\b\d+(?:\.\d*)?|\B\.\d+)(?:[Ee][+-]?\d+)?/,
1723 'boolean': /\b(?:true|false)\b/,
1724 'block': {
1725 pattern: /^(\s*(?:~\s*)?)[#\/]\S+?(?=\s*(?:~\s*)?$|\s)/i,
1726 lookbehind: true,
1727 alias: 'keyword'
1728 },
1729 'brackets': {
1730 pattern: /\[[^\]]+\]/,
1731 inside: {
1732 punctuation: /\[|\]/,
1733 variable: /[\s\S]+/
1734 }
1735 },
1736 'punctuation': /[!"#%&':()*+,.\/;<=>@\[\\\]^`{|}~]/,
1737 'variable': /[^!"#%&'()*+,\/;<=>@\[\\\]^`{|}~\s]+/
1738 };
1739 Prism.hooks.add('before-tokenize', function (env) {
1740 var handlebarsPattern = /\{\{\{[\s\S]+?\}\}\}|\{\{[\s\S]+?\}\}/g;
1741 Prism.languages['markup-templating'].buildPlaceholders(env, 'handlebars', handlebarsPattern);
1742 });
1743 Prism.hooks.add('after-tokenize', function (env) {
1744 Prism.languages['markup-templating'].tokenizePlaceholders(env, 'handlebars');
1745 });
1746})(Prism);
1747/* "prismjs/components/prism-json" */
1748// https://www.json.org/json-en.html
1749
1750
1751Prism.languages.json = {
1752 'property': {
1753 pattern: /"(?:\\.|[^\\"\r\n])*"(?=\s*:)/,
1754 greedy: true
1755 },
1756 'string': {
1757 pattern: /"(?:\\.|[^\\"\r\n])*"(?!\s*:)/,
1758 greedy: true
1759 },
1760 'comment': {
1761 pattern: /\/\/.*|\/\*[\s\S]*?(?:\*\/|$)/,
1762 greedy: true
1763 },
1764 'number': /-?\b\d+(?:\.\d+)?(?:e[+-]?\d+)?\b/i,
1765 'punctuation': /[{}[\],]/,
1766 'operator': /:/,
1767 'boolean': /\b(?:true|false)\b/,
1768 'null': {
1769 pattern: /\bnull\b/,
1770 alias: 'keyword'
1771 }
1772};
1773Prism.languages.webmanifest = Prism.languages.json;
1774/* "prismjs/components/prism-less" */
1775
1776/* FIXME :
1777 :extend() is not handled specifically : its highlighting is buggy.
1778 Mixin usage must be inside a ruleset to be highlighted.
1779 At-rules (e.g. import) containing interpolations are buggy.
1780 Detached rulesets are highlighted as at-rules.
1781 A comment before a mixin usage prevents the latter to be properly highlighted.
1782 */
1783
1784Prism.languages.less = Prism.languages.extend('css', {
1785 'comment': [/\/\*[\s\S]*?\*\//, {
1786 pattern: /(^|[^\\])\/\/.*/,
1787 lookbehind: true
1788 }],
1789 'atrule': {
1790 pattern: /@[\w-](?:\((?:[^(){}]|\([^(){}]*\))*\)|[^(){};\s]|\s+(?!\s))*?(?=\s*\{)/,
1791 inside: {
1792 'punctuation': /[:()]/
1793 }
1794 },
1795 // selectors and mixins are considered the same
1796 'selector': {
1797 pattern: /(?:@\{[\w-]+\}|[^{};\s@])(?:@\{[\w-]+\}|\((?:[^(){}]|\([^(){}]*\))*\)|[^(){};@\s]|\s+(?!\s))*?(?=\s*\{)/,
1798 inside: {
1799 // mixin parameters
1800 'variable': /@+[\w-]+/
1801 }
1802 },
1803 'property': /(?:@\{[\w-]+\}|[\w-])+(?:\+_?)?(?=\s*:)/i,
1804 'operator': /[+\-*\/]/
1805});
1806Prism.languages.insertBefore('less', 'property', {
1807 'variable': [// Variable declaration (the colon must be consumed!)
1808 {
1809 pattern: /@[\w-]+\s*:/,
1810 inside: {
1811 "punctuation": /:/
1812 }
1813 }, // Variable usage
1814 /@@?[\w-]+/],
1815 'mixin-usage': {
1816 pattern: /([{;]\s*)[.#](?!\d)[\w-].*?(?=[(;])/,
1817 lookbehind: true,
1818 alias: 'function'
1819 }
1820});
1821/* "prismjs/components/prism-makefile" */
1822
1823Prism.languages.makefile = {
1824 'comment': {
1825 pattern: /(^|[^\\])#(?:\\(?:\r\n|[\s\S])|[^\\\r\n])*/,
1826 lookbehind: true
1827 },
1828 'string': {
1829 pattern: /(["'])(?:\\(?:\r\n|[\s\S])|(?!\1)[^\\\r\n])*\1/,
1830 greedy: true
1831 },
1832 // Built-in target names
1833 'builtin': /\.[A-Z][^:#=\s]+(?=\s*:(?!=))/,
1834 // Targets
1835 'symbol': {
1836 pattern: /^(?:[^:=\s]|[ \t]+(?![\s:]))+(?=\s*:(?!=))/m,
1837 inside: {
1838 'variable': /\$+(?:(?!\$)[^(){}:#=\s]+|(?=[({]))/
1839 }
1840 },
1841 'variable': /\$+(?:(?!\$)[^(){}:#=\s]+|\([@*%<^+?][DF]\)|(?=[({]))/,
1842 'keyword': [// Directives
1843 /-include\b|\b(?:define|else|endef|endif|export|ifn?def|ifn?eq|include|override|private|sinclude|undefine|unexport|vpath)\b/, // Functions
1844 {
1845 pattern: /(\()(?:addsuffix|abspath|and|basename|call|dir|error|eval|file|filter(?:-out)?|findstring|firstword|flavor|foreach|guile|if|info|join|lastword|load|notdir|or|origin|patsubst|realpath|shell|sort|strip|subst|suffix|value|warning|wildcard|word(?:s|list)?)(?=[ \t])/,
1846 lookbehind: true
1847 }],
1848 'operator': /(?:::|[?:+!])?=|[|@]/,
1849 'punctuation': /[:;(){}]/
1850};
1851/* "prismjs/components/prism-markdown" */
1852
1853(function (Prism) {
1854 // Allow only one line break
1855 var inner = /(?:\\.|[^\\\n\r]|(?:\n|\r\n?)(?!\n|\r\n?))/.source;
1856 /**
1857 * This function is intended for the creation of the bold or italic pattern.
1858 *
1859 * This also adds a lookbehind group to the given pattern to ensure that the pattern is not backslash-escaped.
1860 *
1861 * _Note:_ Keep in mind that this adds a capturing group.
1862 *
1863 * @param {string} pattern
1864 * @returns {RegExp}
1865 */
1866
1867 function createInline(pattern) {
1868 pattern = pattern.replace(/<inner>/g, function () {
1869 return inner;
1870 });
1871 return RegExp(/((?:^|[^\\])(?:\\{2})*)/.source + '(?:' + pattern + ')');
1872 }
1873
1874 var tableCell = /(?:\\.|``(?:[^`\r\n]|`(?!`))+``|`[^`\r\n]+`|[^\\|\r\n`])+/.source;
1875 var tableRow = /\|?__(?:\|__)+\|?(?:(?:\n|\r\n?)|(?![\s\S]))/.source.replace(/__/g, function () {
1876 return tableCell;
1877 });
1878 var tableLine = /\|?[ \t]*:?-{3,}:?[ \t]*(?:\|[ \t]*:?-{3,}:?[ \t]*)+\|?(?:\n|\r\n?)/.source;
1879 Prism.languages.markdown = Prism.languages.extend('markup', {});
1880 Prism.languages.insertBefore('markdown', 'prolog', {
1881 'front-matter-block': {
1882 pattern: /(^(?:\s*[\r\n])?)---(?!.)[\s\S]*?[\r\n]---(?!.)/,
1883 lookbehind: true,
1884 greedy: true,
1885 inside: {
1886 'punctuation': /^---|---$/,
1887 'font-matter': {
1888 pattern: /\S+(?:\s+\S+)*/,
1889 alias: ['yaml', 'language-yaml'],
1890 inside: Prism.languages.yaml
1891 }
1892 }
1893 },
1894 'blockquote': {
1895 // > ...
1896 pattern: /^>(?:[\t ]*>)*/m,
1897 alias: 'punctuation'
1898 },
1899 'table': {
1900 pattern: RegExp('^' + tableRow + tableLine + '(?:' + tableRow + ')*', 'm'),
1901 inside: {
1902 'table-data-rows': {
1903 pattern: RegExp('^(' + tableRow + tableLine + ')(?:' + tableRow + ')*$'),
1904 lookbehind: true,
1905 inside: {
1906 'table-data': {
1907 pattern: RegExp(tableCell),
1908 inside: Prism.languages.markdown
1909 },
1910 'punctuation': /\|/
1911 }
1912 },
1913 'table-line': {
1914 pattern: RegExp('^(' + tableRow + ')' + tableLine + '$'),
1915 lookbehind: true,
1916 inside: {
1917 'punctuation': /\||:?-{3,}:?/
1918 }
1919 },
1920 'table-header-row': {
1921 pattern: RegExp('^' + tableRow + '$'),
1922 inside: {
1923 'table-header': {
1924 pattern: RegExp(tableCell),
1925 alias: 'important',
1926 inside: Prism.languages.markdown
1927 },
1928 'punctuation': /\|/
1929 }
1930 }
1931 }
1932 },
1933 'code': [{
1934 // Prefixed by 4 spaces or 1 tab and preceded by an empty line
1935 pattern: /((?:^|\n)[ \t]*\n|(?:^|\r\n?)[ \t]*\r\n?)(?: {4}|\t).+(?:(?:\n|\r\n?)(?: {4}|\t).+)*/,
1936 lookbehind: true,
1937 alias: 'keyword'
1938 }, {
1939 // `code`
1940 // ``code``
1941 pattern: /``.+?``|`[^`\r\n]+`/,
1942 alias: 'keyword'
1943 }, {
1944 // ```optional language
1945 // code block
1946 // ```
1947 pattern: /^```[\s\S]*?^```$/m,
1948 greedy: true,
1949 inside: {
1950 'code-block': {
1951 pattern: /^(```.*(?:\n|\r\n?))[\s\S]+?(?=(?:\n|\r\n?)^```$)/m,
1952 lookbehind: true
1953 },
1954 'code-language': {
1955 pattern: /^(```).+/,
1956 lookbehind: true
1957 },
1958 'punctuation': /```/
1959 }
1960 }],
1961 'title': [{
1962 // title 1
1963 // =======
1964 // title 2
1965 // -------
1966 pattern: /\S.*(?:\n|\r\n?)(?:==+|--+)(?=[ \t]*$)/m,
1967 alias: 'important',
1968 inside: {
1969 punctuation: /==+$|--+$/
1970 }
1971 }, {
1972 // # title 1
1973 // ###### title 6
1974 pattern: /(^\s*)#.+/m,
1975 lookbehind: true,
1976 alias: 'important',
1977 inside: {
1978 punctuation: /^#+|#+$/
1979 }
1980 }],
1981 'hr': {
1982 // ***
1983 // ---
1984 // * * *
1985 // -----------
1986 pattern: /(^\s*)([*-])(?:[\t ]*\2){2,}(?=\s*$)/m,
1987 lookbehind: true,
1988 alias: 'punctuation'
1989 },
1990 'list': {
1991 // * item
1992 // + item
1993 // - item
1994 // 1. item
1995 pattern: /(^\s*)(?:[*+-]|\d+\.)(?=[\t ].)/m,
1996 lookbehind: true,
1997 alias: 'punctuation'
1998 },
1999 'url-reference': {
2000 // [id]: http://example.com "Optional title"
2001 // [id]: http://example.com 'Optional title'
2002 // [id]: http://example.com (Optional title)
2003 // [id]: <http://example.com> "Optional title"
2004 pattern: /!?\[[^\]]+\]:[\t ]+(?:\S+|<(?:\\.|[^>\\])+>)(?:[\t ]+(?:"(?:\\.|[^"\\])*"|'(?:\\.|[^'\\])*'|\((?:\\.|[^)\\])*\)))?/,
2005 inside: {
2006 'variable': {
2007 pattern: /^(!?\[)[^\]]+/,
2008 lookbehind: true
2009 },
2010 'string': /(?:"(?:\\.|[^"\\])*"|'(?:\\.|[^'\\])*'|\((?:\\.|[^)\\])*\))$/,
2011 'punctuation': /^[\[\]!:]|[<>]/
2012 },
2013 alias: 'url'
2014 },
2015 'bold': {
2016 // **strong**
2017 // __strong__
2018 // allow one nested instance of italic text using the same delimiter
2019 pattern: createInline(/\b__(?:(?!_)<inner>|_(?:(?!_)<inner>)+_)+__\b|\*\*(?:(?!\*)<inner>|\*(?:(?!\*)<inner>)+\*)+\*\*/.source),
2020 lookbehind: true,
2021 greedy: true,
2022 inside: {
2023 'content': {
2024 pattern: /(^..)[\s\S]+(?=..$)/,
2025 lookbehind: true,
2026 inside: {} // see below
2027
2028 },
2029 'punctuation': /\*\*|__/
2030 }
2031 },
2032 'italic': {
2033 // *em*
2034 // _em_
2035 // allow one nested instance of bold text using the same delimiter
2036 pattern: createInline(/\b_(?:(?!_)<inner>|__(?:(?!_)<inner>)+__)+_\b|\*(?:(?!\*)<inner>|\*\*(?:(?!\*)<inner>)+\*\*)+\*/.source),
2037 lookbehind: true,
2038 greedy: true,
2039 inside: {
2040 'content': {
2041 pattern: /(^.)[\s\S]+(?=.$)/,
2042 lookbehind: true,
2043 inside: {} // see below
2044
2045 },
2046 'punctuation': /[*_]/
2047 }
2048 },
2049 'strike': {
2050 // ~~strike through~~
2051 // ~strike~
2052 pattern: createInline(/(~~?)(?:(?!~)<inner>)+?\2/.source),
2053 lookbehind: true,
2054 greedy: true,
2055 inside: {
2056 'content': {
2057 pattern: /(^~~?)[\s\S]+(?=\1$)/,
2058 lookbehind: true,
2059 inside: {} // see below
2060
2061 },
2062 'punctuation': /~~?/
2063 }
2064 },
2065 'url': {
2066 // [example](http://example.com "Optional title")
2067 // [example][id]
2068 // [example] [id]
2069 pattern: createInline(/!?\[(?:(?!\])<inner>)+\](?:\([^\s)]+(?:[\t ]+"(?:\\.|[^"\\])*")?\)|[ \t]?\[(?:(?!\])<inner>)+\])/.source),
2070 lookbehind: true,
2071 greedy: true,
2072 inside: {
2073 'operator': /^!/,
2074 'content': {
2075 pattern: /(^\[)[^\]]+(?=\])/,
2076 lookbehind: true,
2077 inside: {} // see below
2078
2079 },
2080 'variable': {
2081 pattern: /(^\][ \t]?\[)[^\]]+(?=\]$)/,
2082 lookbehind: true
2083 },
2084 'url': {
2085 pattern: /(^\]\()[^\s)]+/,
2086 lookbehind: true
2087 },
2088 'string': {
2089 pattern: /(^[ \t]+)"(?:\\.|[^"\\])*"(?=\)$)/,
2090 lookbehind: true
2091 }
2092 }
2093 }
2094 });
2095 ['url', 'bold', 'italic', 'strike'].forEach(function (token) {
2096 ['url', 'bold', 'italic', 'strike'].forEach(function (inside) {
2097 if (token !== inside) {
2098 Prism.languages.markdown[token].inside.content.inside[inside] = Prism.languages.markdown[inside];
2099 }
2100 });
2101 });
2102 Prism.hooks.add('after-tokenize', function (env) {
2103 if (env.language !== 'markdown' && env.language !== 'md') {
2104 return;
2105 }
2106
2107 function walkTokens(tokens) {
2108 if (!tokens || typeof tokens === 'string') {
2109 return;
2110 }
2111
2112 for (var i = 0, l = tokens.length; i < l; i++) {
2113 var token = tokens[i];
2114
2115 if (token.type !== 'code') {
2116 walkTokens(token.content);
2117 continue;
2118 }
2119 /*
2120 * Add the correct `language-xxxx` class to this code block. Keep in mind that the `code-language` token
2121 * is optional. But the grammar is defined so that there is only one case we have to handle:
2122 *
2123 * token.content = [
2124 * <span class="punctuation">```</span>,
2125 * <span class="code-language">xxxx</span>,
2126 * '\n', // exactly one new lines (\r or \n or \r\n)
2127 * <span class="code-block">...</span>,
2128 * '\n', // exactly one new lines again
2129 * <span class="punctuation">```</span>
2130 * ];
2131 */
2132
2133
2134 var codeLang = token.content[1];
2135 var codeBlock = token.content[3];
2136
2137 if (codeLang && codeBlock && codeLang.type === 'code-language' && codeBlock.type === 'code-block' && typeof codeLang.content === 'string') {
2138 // this might be a language that Prism does not support
2139 // do some replacements to support C++, C#, and F#
2140 var lang = codeLang.content.replace(/\b#/g, 'sharp').replace(/\b\+\+/g, 'pp'); // only use the first word
2141
2142 lang = (/[a-z][\w-]*/i.exec(lang) || [''])[0].toLowerCase();
2143 var alias = 'language-' + lang; // add alias
2144
2145 if (!codeBlock.alias) {
2146 codeBlock.alias = [alias];
2147 } else if (typeof codeBlock.alias === 'string') {
2148 codeBlock.alias = [codeBlock.alias, alias];
2149 } else {
2150 codeBlock.alias.push(alias);
2151 }
2152 }
2153 }
2154 }
2155
2156 walkTokens(env.tokens);
2157 });
2158 Prism.hooks.add('wrap', function (env) {
2159 if (env.type !== 'code-block') {
2160 return;
2161 }
2162
2163 var codeLang = '';
2164
2165 for (var i = 0, l = env.classes.length; i < l; i++) {
2166 var cls = env.classes[i];
2167 var match = /language-(.+)/.exec(cls);
2168
2169 if (match) {
2170 codeLang = match[1];
2171 break;
2172 }
2173 }
2174
2175 var grammar = Prism.languages[codeLang];
2176
2177 if (!grammar) {
2178 if (codeLang && codeLang !== 'none' && Prism.plugins.autoloader) {
2179 var id = 'md-' + new Date().valueOf() + '-' + Math.floor(Math.random() * 1e16);
2180 env.attributes['id'] = id;
2181 Prism.plugins.autoloader.loadLanguages(codeLang, function () {
2182 var ele = document.getElementById(id);
2183
2184 if (ele) {
2185 ele.innerHTML = Prism.highlight(ele.textContent, Prism.languages[codeLang], codeLang);
2186 }
2187 });
2188 }
2189 } else {
2190 // reverse Prism.util.encode
2191 var code = env.content.replace(/&lt;/g, '<').replace(/&amp;/g, '&');
2192 env.content = Prism.highlight(code, grammar, codeLang);
2193 }
2194 });
2195 Prism.languages.md = Prism.languages.markdown;
2196})(Prism);
2197/* "prismjs/components/prism-objectivec" */
2198
2199
2200Prism.languages.objectivec = Prism.languages.extend('c', {
2201 'string': /("|')(?:\\(?:\r\n|[\s\S])|(?!\1)[^\\\r\n])*\1|@"(?:\\(?:\r\n|[\s\S])|[^"\\\r\n])*"/,
2202 'keyword': /\b(?:asm|typeof|inline|auto|break|case|char|const|continue|default|do|double|else|enum|extern|float|for|goto|if|int|long|register|return|short|signed|sizeof|static|struct|switch|typedef|union|unsigned|void|volatile|while|in|self|super)\b|(?:@interface|@end|@implementation|@protocol|@class|@public|@protected|@private|@property|@try|@catch|@finally|@throw|@synthesize|@dynamic|@selector)\b/,
2203 'operator': /-[->]?|\+\+?|!=?|<<?=?|>>?=?|==?|&&?|\|\|?|[~^%?*\/@]/
2204});
2205delete Prism.languages.objectivec['class-name'];
2206Prism.languages.objc = Prism.languages.objectivec;
2207/* "prismjs/components/prism-ocaml" */
2208
2209Prism.languages.ocaml = {
2210 'comment': /\(\*[\s\S]*?\*\)/,
2211 'string': [{
2212 pattern: /"(?:\\.|[^\\\r\n"])*"/,
2213 greedy: true
2214 }, {
2215 pattern: /(['`])(?:\\(?:\d+|x[\da-f]+|.)|(?!\1)[^\\\r\n])\1/i,
2216 greedy: true
2217 }],
2218 'number': /\b(?:0x[\da-f][\da-f_]+|(?:0[bo])?\d[\d_]*(?:\.[\d_]*)?(?:e[+-]?[\d_]+)?)/i,
2219 'directive': {
2220 pattern: /\B#\w+/,
2221 alias: 'important'
2222 },
2223 'label': {
2224 pattern: /\B~\w+/,
2225 alias: 'function'
2226 },
2227 'type-variable': {
2228 pattern: /\B'\w+/,
2229 alias: 'function'
2230 },
2231 'variant': {
2232 pattern: /`\w+/,
2233 alias: 'variable'
2234 },
2235 'module': {
2236 pattern: /\b[A-Z]\w+/,
2237 alias: 'variable'
2238 },
2239 // For the list of keywords and operators,
2240 // see: http://caml.inria.fr/pub/docs/manual-ocaml/lex.html#sec84
2241 'keyword': /\b(?:as|assert|begin|class|constraint|do|done|downto|else|end|exception|external|for|fun|function|functor|if|in|include|inherit|initializer|lazy|let|match|method|module|mutable|new|nonrec|object|of|open|private|rec|sig|struct|then|to|try|type|val|value|virtual|when|where|while|with)\b/,
2242 'boolean': /\b(?:false|true)\b/,
2243 // Custom operators are allowed
2244 'operator': /:=|[=<>@^|&+\-*\/$%!?~][!$%&*+\-.\/:<=>?@^|~]*|\b(?:and|asr|land|lor|lsl|lsr|lxor|mod|or)\b/,
2245 'punctuation': /[(){}\[\]|.,:;]|\b_\b/
2246};
2247/* "prismjs/components/prism-python" */
2248
2249Prism.languages.python = {
2250 'comment': {
2251 pattern: /(^|[^\\])#.*/,
2252 lookbehind: true
2253 },
2254 'string-interpolation': {
2255 pattern: /(?:f|rf|fr)(?:("""|''')[\s\S]*?\1|("|')(?:\\.|(?!\2)[^\\\r\n])*\2)/i,
2256 greedy: true,
2257 inside: {
2258 'interpolation': {
2259 // "{" <expression> <optional "!s", "!r", or "!a"> <optional ":" format specifier> "}"
2260 pattern: /((?:^|[^{])(?:{{)*){(?!{)(?:[^{}]|{(?!{)(?:[^{}]|{(?!{)(?:[^{}])+})+})+}/,
2261 lookbehind: true,
2262 inside: {
2263 'format-spec': {
2264 pattern: /(:)[^:(){}]+(?=}$)/,
2265 lookbehind: true
2266 },
2267 'conversion-option': {
2268 pattern: /![sra](?=[:}]$)/,
2269 alias: 'punctuation'
2270 },
2271 rest: null
2272 }
2273 },
2274 'string': /[\s\S]+/
2275 }
2276 },
2277 'triple-quoted-string': {
2278 pattern: /(?:[rub]|rb|br)?("""|''')[\s\S]*?\1/i,
2279 greedy: true,
2280 alias: 'string'
2281 },
2282 'string': {
2283 pattern: /(?:[rub]|rb|br)?("|')(?:\\.|(?!\1)[^\\\r\n])*\1/i,
2284 greedy: true
2285 },
2286 'function': {
2287 pattern: /((?:^|\s)def[ \t]+)[a-zA-Z_]\w*(?=\s*\()/g,
2288 lookbehind: true
2289 },
2290 'class-name': {
2291 pattern: /(\bclass\s+)\w+/i,
2292 lookbehind: true
2293 },
2294 'decorator': {
2295 pattern: /(^\s*)@\w+(?:\.\w+)*/im,
2296 lookbehind: true,
2297 alias: ['annotation', 'punctuation'],
2298 inside: {
2299 'punctuation': /\./
2300 }
2301 },
2302 'keyword': /\b(?:and|as|assert|async|await|break|class|continue|def|del|elif|else|except|exec|finally|for|from|global|if|import|in|is|lambda|nonlocal|not|or|pass|print|raise|return|try|while|with|yield)\b/,
2303 'builtin': /\b(?:__import__|abs|all|any|apply|ascii|basestring|bin|bool|buffer|bytearray|bytes|callable|chr|classmethod|cmp|coerce|compile|complex|delattr|dict|dir|divmod|enumerate|eval|execfile|file|filter|float|format|frozenset|getattr|globals|hasattr|hash|help|hex|id|input|int|intern|isinstance|issubclass|iter|len|list|locals|long|map|max|memoryview|min|next|object|oct|open|ord|pow|property|range|raw_input|reduce|reload|repr|reversed|round|set|setattr|slice|sorted|staticmethod|str|sum|super|tuple|type|unichr|unicode|vars|xrange|zip)\b/,
2304 'boolean': /\b(?:True|False|None)\b/,
2305 'number': /(?:\b(?=\d)|\B(?=\.))(?:0[bo])?(?:(?:\d|0x[\da-f])[\da-f]*(?:\.\d*)?|\.\d+)(?:e[+-]?\d+)?j?\b/i,
2306 'operator': /[-+%=]=?|!=|\*\*?=?|\/\/?=?|<[<=>]?|>[=>]?|[&|^~]/,
2307 'punctuation': /[{}[\];(),.:]/
2308};
2309Prism.languages.python['string-interpolation'].inside['interpolation'].inside.rest = Prism.languages.python;
2310Prism.languages.py = Prism.languages.python;
2311/* "prismjs/components/prism-reason" */
2312
2313Prism.languages.reason = Prism.languages.extend('clike', {
2314 'string': {
2315 pattern: /"(?:\\(?:\r\n|[\s\S])|[^\\\r\n"])*"/,
2316 greedy: true
2317 },
2318 // 'class-name' must be matched *after* 'constructor' defined below
2319 'class-name': /\b[A-Z]\w*/,
2320 'keyword': /\b(?:and|as|assert|begin|class|constraint|do|done|downto|else|end|exception|external|for|fun|function|functor|if|in|include|inherit|initializer|lazy|let|method|module|mutable|new|nonrec|object|of|open|or|private|rec|sig|struct|switch|then|to|try|type|val|virtual|when|while|with)\b/,
2321 'operator': /\.{3}|:[:=]|\|>|->|=(?:==?|>)?|<=?|>=?|[|^?'#!~`]|[+\-*\/]\.?|\b(?:mod|land|lor|lxor|lsl|lsr|asr)\b/
2322});
2323Prism.languages.insertBefore('reason', 'class-name', {
2324 'character': {
2325 pattern: /'(?:\\x[\da-f]{2}|\\o[0-3][0-7][0-7]|\\\d{3}|\\.|[^'\\\r\n])'/,
2326 alias: 'string'
2327 },
2328 'constructor': {
2329 // Negative look-ahead prevents from matching things like String.capitalize
2330 pattern: /\b[A-Z]\w*\b(?!\s*\.)/,
2331 alias: 'variable'
2332 },
2333 'label': {
2334 pattern: /\b[a-z]\w*(?=::)/,
2335 alias: 'symbol'
2336 }
2337}); // We can't match functions property, so let's not even try.
2338
2339delete Prism.languages.reason.function;
2340/* "prismjs/components/prism-sass" */
2341
2342(function (Prism) {
2343 Prism.languages.sass = Prism.languages.extend('css', {
2344 // Sass comments don't need to be closed, only indented
2345 'comment': {
2346 pattern: /^([ \t]*)\/[\/*].*(?:(?:\r?\n|\r)\1[ \t].+)*/m,
2347 lookbehind: true
2348 }
2349 });
2350 Prism.languages.insertBefore('sass', 'atrule', {
2351 // We want to consume the whole line
2352 'atrule-line': {
2353 // Includes support for = and + shortcuts
2354 pattern: /^(?:[ \t]*)[@+=].+/m,
2355 inside: {
2356 'atrule': /(?:@[\w-]+|[+=])/m
2357 }
2358 }
2359 });
2360 delete Prism.languages.sass.atrule;
2361 var variable = /\$[-\w]+|#\{\$[-\w]+\}/;
2362 var operator = [/[+*\/%]|[=!]=|<=?|>=?|\b(?:and|or|not)\b/, {
2363 pattern: /(\s+)-(?=\s)/,
2364 lookbehind: true
2365 }];
2366 Prism.languages.insertBefore('sass', 'property', {
2367 // We want to consume the whole line
2368 'variable-line': {
2369 pattern: /^[ \t]*\$.+/m,
2370 inside: {
2371 'punctuation': /:/,
2372 'variable': variable,
2373 'operator': operator
2374 }
2375 },
2376 // We want to consume the whole line
2377 'property-line': {
2378 pattern: /^[ \t]*(?:[^:\s]+ *:.*|:[^:\s].*)/m,
2379 inside: {
2380 'property': [/[^:\s]+(?=\s*:)/, {
2381 pattern: /(:)[^:\s]+/,
2382 lookbehind: true
2383 }],
2384 'punctuation': /:/,
2385 'variable': variable,
2386 'operator': operator,
2387 'important': Prism.languages.sass.important
2388 }
2389 }
2390 });
2391 delete Prism.languages.sass.property;
2392 delete Prism.languages.sass.important; // Now that whole lines for other patterns are consumed,
2393 // what's left should be selectors
2394
2395 Prism.languages.insertBefore('sass', 'punctuation', {
2396 'selector': {
2397 pattern: /([ \t]*)\S(?:,[^,\r\n]+|[^,\r\n]*)(?:,[^,\r\n]+)*(?:,(?:\r?\n|\r)\1[ \t]+\S(?:,[^,\r\n]+|[^,\r\n]*)(?:,[^,\r\n]+)*)*/,
2398 lookbehind: true
2399 }
2400 });
2401})(Prism);
2402/* "prismjs/components/prism-scss" */
2403
2404
2405Prism.languages.scss = Prism.languages.extend('css', {
2406 'comment': {
2407 pattern: /(^|[^\\])(?:\/\*[\s\S]*?\*\/|\/\/.*)/,
2408 lookbehind: true
2409 },
2410 'atrule': {
2411 pattern: /@[\w-](?:\([^()]+\)|[^()\s]|\s+(?!\s))*?(?=\s+[{;])/,
2412 inside: {
2413 'rule': /@[\w-]+/ // See rest below
2414
2415 }
2416 },
2417 // url, compassified
2418 'url': /(?:[-a-z]+-)?url(?=\()/i,
2419 // CSS selector regex is not appropriate for Sass
2420 // since there can be lot more things (var, @ directive, nesting..)
2421 // a selector must start at the end of a property or after a brace (end of other rules or nesting)
2422 // it can contain some characters that aren't used for defining rules or end of selector, & (parent selector), or interpolated variable
2423 // the end of a selector is found when there is no rules in it ( {} or {\s}) or if there is a property (because an interpolated var
2424 // can "pass" as a selector- e.g: proper#{$erty})
2425 // this one was hard to do, so please be careful if you edit this one :)
2426 'selector': {
2427 // Initial look-ahead is used to prevent matching of blank selectors
2428 pattern: /(?=\S)[^@;{}()]?(?:[^@;{}()\s]|\s+(?!\s)|#\{\$[-\w]+\})+(?=\s*\{(?:\}|\s|[^}][^:{}]*[:{][^}]+))/m,
2429 inside: {
2430 'parent': {
2431 pattern: /&/,
2432 alias: 'important'
2433 },
2434 'placeholder': /%[-\w]+/,
2435 'variable': /\$[-\w]+|#\{\$[-\w]+\}/
2436 }
2437 },
2438 'property': {
2439 pattern: /(?:[-\w]|\$[-\w]|#\{\$[-\w]+\})+(?=\s*:)/,
2440 inside: {
2441 'variable': /\$[-\w]+|#\{\$[-\w]+\}/
2442 }
2443 }
2444});
2445Prism.languages.insertBefore('scss', 'atrule', {
2446 'keyword': [/@(?:if|else(?: if)?|forward|for|each|while|import|use|extend|debug|warn|mixin|include|function|return|content)\b/i, {
2447 pattern: /( +)(?:from|through)(?= )/,
2448 lookbehind: true
2449 }]
2450});
2451Prism.languages.insertBefore('scss', 'important', {
2452 // var and interpolated vars
2453 'variable': /\$[-\w]+|#\{\$[-\w]+\}/
2454});
2455Prism.languages.insertBefore('scss', 'function', {
2456 'module-modifier': {
2457 pattern: /\b(?:as|with|show|hide)\b/i,
2458 alias: 'keyword'
2459 },
2460 'placeholder': {
2461 pattern: /%[-\w]+/,
2462 alias: 'selector'
2463 },
2464 'statement': {
2465 pattern: /\B!(?:default|optional)\b/i,
2466 alias: 'keyword'
2467 },
2468 'boolean': /\b(?:true|false)\b/,
2469 'null': {
2470 pattern: /\bnull\b/,
2471 alias: 'keyword'
2472 },
2473 'operator': {
2474 pattern: /(\s)(?:[-+*\/%]|[=!]=|<=?|>=?|and|or|not)(?=\s)/,
2475 lookbehind: true
2476 }
2477});
2478Prism.languages.scss['atrule'].inside.rest = Prism.languages.scss;
2479/* "prismjs/components/prism-sql" */
2480
2481Prism.languages.sql = {
2482 'comment': {
2483 pattern: /(^|[^\\])(?:\/\*[\s\S]*?\*\/|(?:--|\/\/|#).*)/,
2484 lookbehind: true
2485 },
2486 'variable': [{
2487 pattern: /@(["'`])(?:\\[\s\S]|(?!\1)[^\\])+\1/,
2488 greedy: true
2489 }, /@[\w.$]+/],
2490 'string': {
2491 pattern: /(^|[^@\\])("|')(?:\\[\s\S]|(?!\2)[^\\]|\2\2)*\2/,
2492 greedy: true,
2493 lookbehind: true
2494 },
2495 'function': /\b(?:AVG|COUNT|FIRST|FORMAT|LAST|LCASE|LEN|MAX|MID|MIN|MOD|NOW|ROUND|SUM|UCASE)(?=\s*\()/i,
2496 // Should we highlight user defined functions too?
2497 'keyword': /\b(?:ACTION|ADD|AFTER|ALGORITHM|ALL|ALTER|ANALYZE|ANY|APPLY|AS|ASC|AUTHORIZATION|AUTO_INCREMENT|BACKUP|BDB|BEGIN|BERKELEYDB|BIGINT|BINARY|BIT|BLOB|BOOL|BOOLEAN|BREAK|BROWSE|BTREE|BULK|BY|CALL|CASCADED?|CASE|CHAIN|CHAR(?:ACTER|SET)?|CHECK(?:POINT)?|CLOSE|CLUSTERED|COALESCE|COLLATE|COLUMNS?|COMMENT|COMMIT(?:TED)?|COMPUTE|CONNECT|CONSISTENT|CONSTRAINT|CONTAINS(?:TABLE)?|CONTINUE|CONVERT|CREATE|CROSS|CURRENT(?:_DATE|_TIME|_TIMESTAMP|_USER)?|CURSOR|CYCLE|DATA(?:BASES?)?|DATE(?:TIME)?|DAY|DBCC|DEALLOCATE|DEC|DECIMAL|DECLARE|DEFAULT|DEFINER|DELAYED|DELETE|DELIMITERS?|DENY|DESC|DESCRIBE|DETERMINISTIC|DISABLE|DISCARD|DISK|DISTINCT|DISTINCTROW|DISTRIBUTED|DO|DOUBLE|DROP|DUMMY|DUMP(?:FILE)?|DUPLICATE|ELSE(?:IF)?|ENABLE|ENCLOSED|END|ENGINE|ENUM|ERRLVL|ERRORS|ESCAPED?|EXCEPT|EXEC(?:UTE)?|EXISTS|EXIT|EXPLAIN|EXTENDED|FETCH|FIELDS|FILE|FILLFACTOR|FIRST|FIXED|FLOAT|FOLLOWING|FOR(?: EACH ROW)?|FORCE|FOREIGN|FREETEXT(?:TABLE)?|FROM|FULL|FUNCTION|GEOMETRY(?:COLLECTION)?|GLOBAL|GOTO|GRANT|GROUP|HANDLER|HASH|HAVING|HOLDLOCK|HOUR|IDENTITY(?:_INSERT|COL)?|IF|IGNORE|IMPORT|INDEX|INFILE|INNER|INNODB|INOUT|INSERT|INT|INTEGER|INTERSECT|INTERVAL|INTO|INVOKER|ISOLATION|ITERATE|JOIN|KEYS?|KILL|LANGUAGE|LAST|LEAVE|LEFT|LEVEL|LIMIT|LINENO|LINES|LINESTRING|LOAD|LOCAL|LOCK|LONG(?:BLOB|TEXT)|LOOP|MATCH(?:ED)?|MEDIUM(?:BLOB|INT|TEXT)|MERGE|MIDDLEINT|MINUTE|MODE|MODIFIES|MODIFY|MONTH|MULTI(?:LINESTRING|POINT|POLYGON)|NATIONAL|NATURAL|NCHAR|NEXT|NO|NONCLUSTERED|NULLIF|NUMERIC|OFF?|OFFSETS?|ON|OPEN(?:DATASOURCE|QUERY|ROWSET)?|OPTIMIZE|OPTION(?:ALLY)?|ORDER|OUT(?:ER|FILE)?|OVER|PARTIAL|PARTITION|PERCENT|PIVOT|PLAN|POINT|POLYGON|PRECEDING|PRECISION|PREPARE|PREV|PRIMARY|PRINT|PRIVILEGES|PROC(?:EDURE)?|PUBLIC|PURGE|QUICK|RAISERROR|READS?|REAL|RECONFIGURE|REFERENCES|RELEASE|RENAME|REPEAT(?:ABLE)?|REPLACE|REPLICATION|REQUIRE|RESIGNAL|RESTORE|RESTRICT|RETURN(?:S|ING)?|REVOKE|RIGHT|ROLLBACK|ROUTINE|ROW(?:COUNT|GUIDCOL|S)?|RTREE|RULE|SAVE(?:POINT)?|SCHEMA|SECOND|SELECT|SERIAL(?:IZABLE)?|SESSION(?:_USER)?|SET(?:USER)?|SHARE|SHOW|SHUTDOWN|SIMPLE|SMALLINT|SNAPSHOT|SOME|SONAME|SQL|START(?:ING)?|STATISTICS|STATUS|STRIPED|SYSTEM_USER|TABLES?|TABLESPACE|TEMP(?:ORARY|TABLE)?|TERMINATED|TEXT(?:SIZE)?|THEN|TIME(?:STAMP)?|TINY(?:BLOB|INT|TEXT)|TOP?|TRAN(?:SACTIONS?)?|TRIGGER|TRUNCATE|TSEQUAL|TYPES?|UNBOUNDED|UNCOMMITTED|UNDEFINED|UNION|UNIQUE|UNLOCK|UNPIVOT|UNSIGNED|UPDATE(?:TEXT)?|USAGE|USE|USER|USING|VALUES?|VAR(?:BINARY|CHAR|CHARACTER|YING)|VIEW|WAITFOR|WARNINGS|WHEN|WHERE|WHILE|WITH(?: ROLLUP|IN)?|WORK|WRITE(?:TEXT)?|YEAR)\b/i,
2498 'boolean': /\b(?:TRUE|FALSE|NULL)\b/i,
2499 'number': /\b0x[\da-f]+\b|\b\d+(?:\.\d*)?|\B\.\d+\b/i,
2500 'operator': /[-+*\/=%^~]|&&?|\|\|?|!=?|<(?:=>?|<|>)?|>[>=]?|\b(?:AND|BETWEEN|IN|LIKE|NOT|OR|IS|DIV|REGEXP|RLIKE|SOUNDS LIKE|XOR)\b/i,
2501 'punctuation': /[;[\]()`,.]/
2502};
2503/* "prismjs/components/prism-stylus" */
2504
2505(function (Prism) {
2506 var unit = {
2507 pattern: /(\b\d+)(?:%|[a-z]+)/,
2508 lookbehind: true
2509 }; // 123 -123 .123 -.123 12.3 -12.3
2510
2511 var number = {
2512 pattern: /(^|[^\w.-])-?(?:\d+(?:\.\d+)?|\.\d+)/,
2513 lookbehind: true
2514 };
2515 var inside = {
2516 'comment': {
2517 pattern: /(^|[^\\])(?:\/\*[\s\S]*?\*\/|\/\/.*)/,
2518 lookbehind: true
2519 },
2520 'url': {
2521 pattern: /url\((["']?).*?\1\)/i,
2522 greedy: true
2523 },
2524 'string': {
2525 pattern: /("|')(?:(?!\1)[^\\\r\n]|\\(?:\r\n|[\s\S]))*\1/,
2526 greedy: true
2527 },
2528 'interpolation': null,
2529 // See below
2530 'func': null,
2531 // See below
2532 'important': /\B!(?:important|optional)\b/i,
2533 'keyword': {
2534 pattern: /(^|\s+)(?:(?:if|else|for|return|unless)(?=\s+|$)|@[\w-]+)/,
2535 lookbehind: true
2536 },
2537 'hexcode': /#[\da-f]{3,6}/i,
2538 'color': [/\b(?:AliceBlue|AntiqueWhite|Aqua|Aquamarine|Azure|Beige|Bisque|Black|BlanchedAlmond|Blue|BlueViolet|Brown|BurlyWood|CadetBlue|Chartreuse|Chocolate|Coral|CornflowerBlue|Cornsilk|Crimson|Cyan|DarkBlue|DarkCyan|DarkGoldenRod|DarkGr[ae]y|DarkGreen|DarkKhaki|DarkMagenta|DarkOliveGreen|DarkOrange|DarkOrchid|DarkRed|DarkSalmon|DarkSeaGreen|DarkSlateBlue|DarkSlateGr[ae]y|DarkTurquoise|DarkViolet|DeepPink|DeepSkyBlue|DimGr[ae]y|DodgerBlue|FireBrick|FloralWhite|ForestGreen|Fuchsia|Gainsboro|GhostWhite|Gold|GoldenRod|Gr[ae]y|Green|GreenYellow|HoneyDew|HotPink|IndianRed|Indigo|Ivory|Khaki|Lavender|LavenderBlush|LawnGreen|LemonChiffon|LightBlue|LightCoral|LightCyan|LightGoldenRodYellow|LightGr[ae]y|LightGreen|LightPink|LightSalmon|LightSeaGreen|LightSkyBlue|LightSlateGr[ae]y|LightSteelBlue|LightYellow|Lime|LimeGreen|Linen|Magenta|Maroon|MediumAquaMarine|MediumBlue|MediumOrchid|MediumPurple|MediumSeaGreen|MediumSlateBlue|MediumSpringGreen|MediumTurquoise|MediumVioletRed|MidnightBlue|MintCream|MistyRose|Moccasin|NavajoWhite|Navy|OldLace|Olive|OliveDrab|Orange|OrangeRed|Orchid|PaleGoldenRod|PaleGreen|PaleTurquoise|PaleVioletRed|PapayaWhip|PeachPuff|Peru|Pink|Plum|PowderBlue|Purple|Red|RosyBrown|RoyalBlue|SaddleBrown|Salmon|SandyBrown|SeaGreen|SeaShell|Sienna|Silver|SkyBlue|SlateBlue|SlateGr[ae]y|Snow|SpringGreen|SteelBlue|Tan|Teal|Thistle|Tomato|Transparent|Turquoise|Violet|Wheat|White|WhiteSmoke|Yellow|YellowGreen)\b/i, {
2539 pattern: /\b(?:rgb|hsl)\(\s*\d{1,3}\s*,\s*\d{1,3}%?\s*,\s*\d{1,3}%?\s*\)\B|\b(?:rgb|hsl)a\(\s*\d{1,3}\s*,\s*\d{1,3}%?\s*,\s*\d{1,3}%?\s*,\s*(?:0|0?\.\d+|1)\s*\)\B/i,
2540 inside: {
2541 'unit': unit,
2542 'number': number,
2543 'function': /[\w-]+(?=\()/,
2544 'punctuation': /[(),]/
2545 }
2546 }],
2547 'entity': /\\[\da-f]{1,8}/i,
2548 'unit': unit,
2549 'boolean': /\b(?:true|false)\b/,
2550 'operator': [// We want non-word chars around "-" because it is
2551 // accepted in property names.
2552 /~|[+!\/%<>?=]=?|[-:]=|\*[*=]?|\.{2,3}|&&|\|\||\B-\B|\b(?:and|in|is(?: a| defined| not|nt)?|not|or)\b/],
2553 'number': number,
2554 'punctuation': /[{}()\[\];:,]/
2555 };
2556 inside['interpolation'] = {
2557 pattern: /\{[^\r\n}:]+\}/,
2558 alias: 'variable',
2559 inside: {
2560 'delimiter': {
2561 pattern: /^{|}$/,
2562 alias: 'punctuation'
2563 },
2564 rest: inside
2565 }
2566 };
2567 inside['func'] = {
2568 pattern: /[\w-]+\([^)]*\).*/,
2569 inside: {
2570 'function': /^[^(]+/,
2571 rest: inside
2572 }
2573 };
2574 Prism.languages.stylus = {
2575 'atrule-declaration': {
2576 pattern: /(^\s*)@.+/m,
2577 lookbehind: true,
2578 inside: {
2579 'atrule': /^@[\w-]+/,
2580 rest: inside
2581 }
2582 },
2583 'variable-declaration': {
2584 pattern: /(^[ \t]*)[\w$-]+\s*.?=[ \t]*(?:\{[^{}]*\}|\S.*|$)/m,
2585 lookbehind: true,
2586 inside: {
2587 'variable': /^\S+/,
2588 rest: inside
2589 }
2590 },
2591 'statement': {
2592 pattern: /(^[ \t]*)(?:if|else|for|return|unless)[ \t].+/m,
2593 lookbehind: true,
2594 inside: {
2595 'keyword': /^\S+/,
2596 rest: inside
2597 }
2598 },
2599 // A property/value pair cannot end with a comma or a brace
2600 // It cannot have indented content unless it ended with a semicolon
2601 'property-declaration': {
2602 pattern: /((?:^|\{)([ \t]*))(?:[\w-]|\{[^}\r\n]+\})+(?:\s*:\s*|[ \t]+)(?!\s)[^{\r\n]*(?:;|[^{\r\n,](?=$)(?!(?:\r?\n|\r)(?:\{|\2[ \t]+)))/m,
2603 lookbehind: true,
2604 inside: {
2605 'property': {
2606 pattern: /^[^\s:]+/,
2607 inside: {
2608 'interpolation': inside.interpolation
2609 }
2610 },
2611 rest: inside
2612 }
2613 },
2614 // A selector can contain parentheses only as part of a pseudo-element
2615 // It can span multiple lines.
2616 // It must end with a comma or an accolade or have indented content.
2617 'selector': {
2618 pattern: /(^[ \t]*)(?:(?=\S)(?:[^{}\r\n:()]|::?[\w-]+(?:\([^)\r\n]*\)|(?![\w-]))|\{[^}\r\n]+\})+)(?:(?:\r?\n|\r)(?:\1(?:(?=\S)(?:[^{}\r\n:()]|::?[\w-]+(?:\([^)\r\n]*\)|(?![\w-]))|\{[^}\r\n]+\})+)))*(?:,$|\{|(?=(?:\r?\n|\r)(?:\{|\1[ \t]+)))/m,
2619 lookbehind: true,
2620 inside: {
2621 'interpolation': inside.interpolation,
2622 'comment': inside.comment,
2623 'punctuation': /[{},]/
2624 }
2625 },
2626 'func': inside.func,
2627 'string': inside.string,
2628 'comment': {
2629 pattern: /(^|[^\\])(?:\/\*[\s\S]*?\*\/|\/\/.*)/,
2630 lookbehind: true,
2631 greedy: true
2632 },
2633 'interpolation': inside.interpolation,
2634 'punctuation': /[{}()\[\];:.]/
2635 };
2636})(Prism);
2637/* "prismjs/components/prism-typescript" */
2638
2639
2640(function (Prism) {
2641 Prism.languages.typescript = Prism.languages.extend('javascript', {
2642 'class-name': {
2643 pattern: /(\b(?:class|extends|implements|instanceof|interface|new|type)\s+)(?!keyof\b)(?!\s)[_$a-zA-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*(?:\s*<(?:[^<>]|<(?:[^<>]|<[^<>]*>)*>)*>)?/,
2644 lookbehind: true,
2645 greedy: true,
2646 inside: null // see below
2647
2648 },
2649 // From JavaScript Prism keyword list and TypeScript language spec: https://github.com/Microsoft/TypeScript/blob/master/doc/spec.md#221-reserved-words
2650 'keyword': /\b(?:abstract|as|asserts|async|await|break|case|catch|class|const|constructor|continue|debugger|declare|default|delete|do|else|enum|export|extends|finally|for|from|function|get|if|implements|import|in|instanceof|interface|is|keyof|let|module|namespace|new|null|of|package|private|protected|public|readonly|return|require|set|static|super|switch|this|throw|try|type|typeof|undefined|var|void|while|with|yield)\b/,
2651 'builtin': /\b(?:string|Function|any|number|boolean|Array|symbol|console|Promise|unknown|never)\b/
2652 }); // doesn't work with TS because TS is too complex
2653
2654 delete Prism.languages.typescript['parameter']; // a version of typescript specifically for highlighting types
2655
2656 var typeInside = Prism.languages.extend('typescript', {});
2657 delete typeInside['class-name'];
2658 Prism.languages.typescript['class-name'].inside = typeInside;
2659 Prism.languages.insertBefore('typescript', 'function', {
2660 'generic-function': {
2661 // e.g. foo<T extends "bar" | "baz">( ...
2662 pattern: /#?(?!\s)[_$a-zA-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*\s*<(?:[^<>]|<(?:[^<>]|<[^<>]*>)*>)*>(?=\s*\()/,
2663 greedy: true,
2664 inside: {
2665 'function': /^#?(?!\s)[_$a-zA-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*/,
2666 'generic': {
2667 pattern: /<[\s\S]+/,
2668 // everything after the first <
2669 alias: 'class-name',
2670 inside: typeInside
2671 }
2672 }
2673 }
2674 });
2675 Prism.languages.ts = Prism.languages.typescript;
2676})(Prism);
2677/* "prismjs/components/prism-tsx" */
2678
2679
2680(function (Prism) {
2681 var typescript = Prism.util.clone(Prism.languages.typescript);
2682 Prism.languages.tsx = Prism.languages.extend('jsx', typescript); // This will prevent collisions between TSX tags and TS generic types.
2683 // Idea by https://github.com/karlhorky
2684 // Discussion: https://github.com/PrismJS/prism/issues/2594#issuecomment-710666928
2685
2686 var tag = Prism.languages.tsx.tag;
2687 tag.pattern = RegExp(/(^|[^\w$]|(?=<\/))/.source + '(?:' + tag.pattern.source + ')', tag.pattern.flags);
2688 tag.lookbehind = true;
2689})(Prism);
2690/* "prismjs/components/prism-wasm" */
2691
2692
2693Prism.languages.wasm = {
2694 'comment': [/\(;[\s\S]*?;\)/, {
2695 pattern: /;;.*/,
2696 greedy: true
2697 }],
2698 'string': {
2699 pattern: /"(?:\\[\s\S]|[^"\\])*"/,
2700 greedy: true
2701 },
2702 'keyword': [{
2703 pattern: /\b(?:align|offset)=/,
2704 inside: {
2705 'operator': /=/
2706 }
2707 }, {
2708 pattern: /\b(?:(?:f32|f64|i32|i64)(?:\.(?:abs|add|and|ceil|clz|const|convert_[su]\/i(?:32|64)|copysign|ctz|demote\/f64|div(?:_[su])?|eqz?|extend_[su]\/i32|floor|ge(?:_[su])?|gt(?:_[su])?|le(?:_[su])?|load(?:(?:8|16|32)_[su])?|lt(?:_[su])?|max|min|mul|nearest|neg?|or|popcnt|promote\/f32|reinterpret\/[fi](?:32|64)|rem_[su]|rot[lr]|shl|shr_[su]|store(?:8|16|32)?|sqrt|sub|trunc(?:_[su]\/f(?:32|64))?|wrap\/i64|xor))?|memory\.(?:grow|size))\b/,
2709 inside: {
2710 'punctuation': /\./
2711 }
2712 }, /\b(?:anyfunc|block|br(?:_if|_table)?|call(?:_indirect)?|data|drop|elem|else|end|export|func|get_(?:global|local)|global|if|import|local|loop|memory|module|mut|nop|offset|param|result|return|select|set_(?:global|local)|start|table|tee_local|then|type|unreachable)\b/],
2713 'variable': /\$[\w!#$%&'*+\-./:<=>?@\\^_`|~]+/i,
2714 'number': /[+-]?\b(?:\d(?:_?\d)*(?:\.\d(?:_?\d)*)?(?:[eE][+-]?\d(?:_?\d)*)?|0x[\da-fA-F](?:_?[\da-fA-F])*(?:\.[\da-fA-F](?:_?[\da-fA-D])*)?(?:[pP][+-]?\d(?:_?\d)*)?)\b|\binf\b|\bnan(?::0x[\da-fA-F](?:_?[\da-fA-D])*)?\b/,
2715 'punctuation': /[()]/
2716};
2717/* "prismjs/components/prism-yaml" */
2718
2719(function (Prism) {
2720 // https://yaml.org/spec/1.2/spec.html#c-ns-anchor-property
2721 // https://yaml.org/spec/1.2/spec.html#c-ns-alias-node
2722 var anchorOrAlias = /[*&][^\s[\]{},]+/; // https://yaml.org/spec/1.2/spec.html#c-ns-tag-property
2723
2724 var tag = /!(?:<[\w\-%#;/?:@&=+$,.!~*'()[\]]+>|(?:[a-zA-Z\d-]*!)?[\w\-%#;/?:@&=+$.~*'()]+)?/; // https://yaml.org/spec/1.2/spec.html#c-ns-properties(n,c)
2725
2726 var properties = '(?:' + tag.source + '(?:[ \t]+' + anchorOrAlias.source + ')?|' + anchorOrAlias.source + '(?:[ \t]+' + tag.source + ')?)'; // https://yaml.org/spec/1.2/spec.html#ns-plain(n,c)
2727 // This is a simplified version that doesn't support "#" and multiline keys
2728 // All these long scarry character classes are simplified versions of YAML's characters
2729
2730 var plainKey = /(?:[^\s\x00-\x08\x0e-\x1f!"#%&'*,\-:>?@[\]`{|}\x7f-\x84\x86-\x9f\ud800-\udfff\ufffe\uffff]|[?:-]<PLAIN>)(?:[ \t]*(?:(?![#:])<PLAIN>|:<PLAIN>))*/.source.replace(/<PLAIN>/g, function () {
2731 return /[^\s\x00-\x08\x0e-\x1f,[\]{}\x7f-\x84\x86-\x9f\ud800-\udfff\ufffe\uffff]/.source;
2732 });
2733 var string = /"(?:[^"\\\r\n]|\\.)*"|'(?:[^'\\\r\n]|\\.)*'/.source;
2734 /**
2735 *
2736 * @param {string} value
2737 * @param {string} [flags]
2738 * @returns {RegExp}
2739 */
2740
2741 function createValuePattern(value, flags) {
2742 flags = (flags || '').replace(/m/g, '') + 'm'; // add m flag
2743
2744 var pattern = /([:\-,[{]\s*(?:\s<<prop>>[ \t]+)?)(?:<<value>>)(?=[ \t]*(?:$|,|]|}|(?:[\r\n]\s*)?#))/.source.replace(/<<prop>>/g, function () {
2745 return properties;
2746 }).replace(/<<value>>/g, function () {
2747 return value;
2748 });
2749 return RegExp(pattern, flags);
2750 }
2751
2752 Prism.languages.yaml = {
2753 'scalar': {
2754 pattern: RegExp(/([\-:]\s*(?:\s<<prop>>[ \t]+)?[|>])[ \t]*(?:((?:\r?\n|\r)[ \t]+)\S[^\r\n]*(?:\2[^\r\n]+)*)/.source.replace(/<<prop>>/g, function () {
2755 return properties;
2756 })),
2757 lookbehind: true,
2758 alias: 'string'
2759 },
2760 'comment': /#.*/,
2761 'key': {
2762 pattern: RegExp(/((?:^|[:\-,[{\r\n?])[ \t]*(?:<<prop>>[ \t]+)?)<<key>>(?=\s*:\s)/.source.replace(/<<prop>>/g, function () {
2763 return properties;
2764 }).replace(/<<key>>/g, function () {
2765 return '(?:' + plainKey + '|' + string + ')';
2766 })),
2767 lookbehind: true,
2768 greedy: true,
2769 alias: 'atrule'
2770 },
2771 'directive': {
2772 pattern: /(^[ \t]*)%.+/m,
2773 lookbehind: true,
2774 alias: 'important'
2775 },
2776 'datetime': {
2777 pattern: createValuePattern(/\d{4}-\d\d?-\d\d?(?:[tT]|[ \t]+)\d\d?:\d{2}:\d{2}(?:\.\d*)?(?:[ \t]*(?:Z|[-+]\d\d?(?::\d{2})?))?|\d{4}-\d{2}-\d{2}|\d\d?:\d{2}(?::\d{2}(?:\.\d*)?)?/.source),
2778 lookbehind: true,
2779 alias: 'number'
2780 },
2781 'boolean': {
2782 pattern: createValuePattern(/true|false/.source, 'i'),
2783 lookbehind: true,
2784 alias: 'important'
2785 },
2786 'null': {
2787 pattern: createValuePattern(/null|~/.source, 'i'),
2788 lookbehind: true,
2789 alias: 'important'
2790 },
2791 'string': {
2792 pattern: createValuePattern(string),
2793 lookbehind: true,
2794 greedy: true
2795 },
2796 'number': {
2797 pattern: createValuePattern(/[+-]?(?:0x[\da-f]+|0o[0-7]+|(?:\d+(?:\.\d*)?|\.?\d+)(?:e[+-]?\d+)?|\.inf|\.nan)/.source, 'i'),
2798 lookbehind: true
2799 },
2800 'tag': tag,
2801 'important': anchorOrAlias,
2802 'punctuation': /---|[:[\]{}\-,|>?]|\.\.\./
2803 };
2804 Prism.languages.yml = Prism.languages.yaml;
2805})(Prism);
2806
2807export default Prism;