UNPKG

102 kBJavaScriptView Raw
1'use strict';
2
3/**
4 * Prism: Lightweight, robust, elegant syntax highlighting
5 * MIT license http://www.opensource.org/licenses/mit-license.php/
6 * @author Lea Verou http://lea.verou.me
7 */
8
9/**
10 * prism-react-renderer:
11 * This file has been modified to remove:
12 * - globals and window dependency
13 * - worker support
14 * - highlightAll and other element dependent methods
15 * - _.hooks helpers
16 * - UMD/node-specific hacks
17 * It has also been run through prettier
18 */
19var Prism = function () {
20 var uniqueId = 0;
21 var _ = {
22 util: {
23 encode: function (tokens) {
24 if (tokens instanceof Token) {
25 return new Token(tokens.type, _.util.encode(tokens.content), tokens.alias);
26 } else if (_.util.type(tokens) === "Array") {
27 return tokens.map(_.util.encode);
28 } else {
29 return tokens.replace(/&/g, "&amp;").replace(/</g, "&lt;").replace(/\u00a0/g, " ");
30 }
31 },
32 type: function (o) {
33 return Object.prototype.toString.call(o).match(/\[object (\w+)\]/)[1];
34 },
35 objId: function (obj) {
36 if (!obj["__id"]) {
37 Object.defineProperty(obj, "__id", {
38 value: ++uniqueId
39 });
40 }
41
42 return obj["__id"];
43 },
44 // Deep clone a language definition (e.g. to extend it)
45 clone: function (o, visited) {
46 var type = _.util.type(o);
47
48 visited = visited || {};
49
50 switch (type) {
51 case "Object":
52 if (visited[_.util.objId(o)]) {
53 return visited[_.util.objId(o)];
54 }
55
56 var clone = {};
57 visited[_.util.objId(o)] = clone;
58
59 for (var key in o) {
60 if (o.hasOwnProperty(key)) {
61 clone[key] = _.util.clone(o[key], visited);
62 }
63 }
64
65 return clone;
66
67 case "Array":
68 if (visited[_.util.objId(o)]) {
69 return visited[_.util.objId(o)];
70 }
71
72 var clone = [];
73 visited[_.util.objId(o)] = clone;
74 o.forEach(function (v, i) {
75 clone[i] = _.util.clone(v, visited);
76 });
77 return clone;
78 }
79
80 return o;
81 }
82 },
83 languages: {
84 extend: function (id, redef) {
85 var lang = _.util.clone(_.languages[id]);
86
87 for (var key in redef) {
88 lang[key] = redef[key];
89 }
90
91 return lang;
92 },
93
94 /**
95 * Insert a token before another token in a language literal
96 * As this needs to recreate the object (we cannot actually insert before keys in object literals),
97 * we cannot just provide an object, we need anobject and a key.
98 * @param inside The key (or language id) of the parent
99 * @param before The key to insert before. If not provided, the function appends instead.
100 * @param insert Object with the key/value pairs to insert
101 * @param root The object that contains `inside`. If equal to Prism.languages, it can be omitted.
102 */
103 insertBefore: function (inside, before, insert, root) {
104 root = root || _.languages;
105 var grammar = root[inside];
106
107 if (arguments.length == 2) {
108 insert = arguments[1];
109
110 for (var newToken in insert) {
111 if (insert.hasOwnProperty(newToken)) {
112 grammar[newToken] = insert[newToken];
113 }
114 }
115
116 return grammar;
117 }
118
119 var ret = {};
120
121 for (var token in grammar) {
122 if (grammar.hasOwnProperty(token)) {
123 if (token == before) {
124 for (var newToken in insert) {
125 if (insert.hasOwnProperty(newToken)) {
126 ret[newToken] = insert[newToken];
127 }
128 }
129 }
130
131 ret[token] = grammar[token];
132 }
133 } // Update references in other language definitions
134
135
136 _.languages.DFS(_.languages, function (key, value) {
137 if (value === root[inside] && key != inside) {
138 this[key] = ret;
139 }
140 });
141
142 return root[inside] = ret;
143 },
144 // Traverse a language definition with Depth First Search
145 DFS: function (o, callback, type, visited) {
146 visited = visited || {};
147
148 for (var i in o) {
149 if (o.hasOwnProperty(i)) {
150 callback.call(o, i, o[i], type || i);
151
152 if (_.util.type(o[i]) === "Object" && !visited[_.util.objId(o[i])]) {
153 visited[_.util.objId(o[i])] = true;
154
155 _.languages.DFS(o[i], callback, null, visited);
156 } else if (_.util.type(o[i]) === "Array" && !visited[_.util.objId(o[i])]) {
157 visited[_.util.objId(o[i])] = true;
158
159 _.languages.DFS(o[i], callback, i, visited);
160 }
161 }
162 }
163 }
164 },
165 plugins: {},
166 highlight: function (text, grammar, language) {
167 var env = {
168 code: text,
169 grammar: grammar,
170 language: language
171 };
172
173 _.hooks.run("before-tokenize", env);
174
175 env.tokens = _.tokenize(env.code, env.grammar);
176
177 _.hooks.run("after-tokenize", env);
178
179 return Token.stringify(_.util.encode(env.tokens), env.language);
180 },
181 matchGrammar: function (text, strarr, grammar, index, startPos, oneshot, target) {
182 var Token = _.Token;
183
184 for (var token in grammar) {
185 if (!grammar.hasOwnProperty(token) || !grammar[token]) {
186 continue;
187 }
188
189 if (token == target) {
190 return;
191 }
192
193 var patterns = grammar[token];
194 patterns = _.util.type(patterns) === "Array" ? patterns : [patterns];
195
196 for (var j = 0; j < patterns.length; ++j) {
197 var pattern = patterns[j],
198 inside = pattern.inside,
199 lookbehind = !!pattern.lookbehind,
200 greedy = !!pattern.greedy,
201 lookbehindLength = 0,
202 alias = pattern.alias;
203
204 if (greedy && !pattern.pattern.global) {
205 // Without the global flag, lastIndex won't work
206 var flags = pattern.pattern.toString().match(/[imuy]*$/)[0];
207 pattern.pattern = RegExp(pattern.pattern.source, flags + "g");
208 }
209
210 pattern = pattern.pattern || pattern; // Don’t cache length as it changes during the loop
211
212 for (var i = index, pos = startPos; i < strarr.length; pos += strarr[i].length, ++i) {
213 var str = strarr[i];
214
215 if (strarr.length > text.length) {
216 // Something went terribly wrong, ABORT, ABORT!
217 return;
218 }
219
220 if (str instanceof Token) {
221 continue;
222 }
223
224 if (greedy && i != strarr.length - 1) {
225 pattern.lastIndex = pos;
226 var match = pattern.exec(text);
227
228 if (!match) {
229 break;
230 }
231
232 var from = match.index + (lookbehind ? match[1].length : 0),
233 to = match.index + match[0].length,
234 k = i,
235 p = pos;
236
237 for (var len = strarr.length; k < len && (p < to || !strarr[k].type && !strarr[k - 1].greedy); ++k) {
238 p += strarr[k].length; // Move the index i to the element in strarr that is closest to from
239
240 if (from >= p) {
241 ++i;
242 pos = p;
243 }
244 } // If strarr[i] is a Token, then the match starts inside another Token, which is invalid
245
246
247 if (strarr[i] instanceof Token) {
248 continue;
249 } // Number of tokens to delete and replace with the new match
250
251
252 delNum = k - i;
253 str = text.slice(pos, p);
254 match.index -= pos;
255 } else {
256 pattern.lastIndex = 0;
257 var match = pattern.exec(str),
258 delNum = 1;
259 }
260
261 if (!match) {
262 if (oneshot) {
263 break;
264 }
265
266 continue;
267 }
268
269 if (lookbehind) {
270 lookbehindLength = match[1] ? match[1].length : 0;
271 }
272
273 var from = match.index + lookbehindLength,
274 match = match[0].slice(lookbehindLength),
275 to = from + match.length,
276 before = str.slice(0, from),
277 after = str.slice(to);
278 var args = [i, delNum];
279
280 if (before) {
281 ++i;
282 pos += before.length;
283 args.push(before);
284 }
285
286 var wrapped = new Token(token, inside ? _.tokenize(match, inside) : match, alias, match, greedy);
287 args.push(wrapped);
288
289 if (after) {
290 args.push(after);
291 }
292
293 Array.prototype.splice.apply(strarr, args);
294
295 if (delNum != 1) {
296 _.matchGrammar(text, strarr, grammar, i, pos, true, token);
297 }
298
299 if (oneshot) {
300 break;
301 }
302 }
303 }
304 }
305 },
306 hooks: {
307 add: function () {},
308 run: function (name, env) {}
309 },
310 tokenize: function (text, grammar, language) {
311 var strarr = [text];
312 var rest = grammar.rest;
313
314 if (rest) {
315 for (var token in rest) {
316 grammar[token] = rest[token];
317 }
318
319 delete grammar.rest;
320 }
321
322 _.matchGrammar(text, strarr, grammar, 0, 0, false);
323
324 return strarr;
325 }
326 };
327
328 var Token = _.Token = function (type, content, alias, matchedStr, greedy) {
329 this.type = type;
330 this.content = content;
331 this.alias = alias; // Copy of the full string this token was created from
332
333 this.length = (matchedStr || "").length | 0;
334 this.greedy = !!greedy;
335 };
336
337 Token.stringify = function (o, language, parent) {
338 if (typeof o == "string") {
339 return o;
340 }
341
342 if (_.util.type(o) === "Array") {
343 return o.map(function (element) {
344 return Token.stringify(element, language, o);
345 }).join("");
346 }
347
348 var env = {
349 type: o.type,
350 content: Token.stringify(o.content, language, parent),
351 tag: "span",
352 classes: ["token", o.type],
353 attributes: {},
354 language: language,
355 parent: parent
356 };
357
358 if (o.alias) {
359 var aliases = _.util.type(o.alias) === "Array" ? o.alias : [o.alias];
360 Array.prototype.push.apply(env.classes, aliases);
361 }
362
363 var attributes = Object.keys(env.attributes).map(function (name) {
364 return name + '="' + (env.attributes[name] || "").replace(/"/g, "&quot;") + '"';
365 }).join(" ");
366 return "<" + env.tag + ' class="' + env.classes.join(" ") + '"' + (attributes ? " " + attributes : "") + ">" + env.content + "</" + env.tag + ">";
367 };
368
369 return _;
370}();
371
372/* This content is auto-generated to include some prismjs language components: */
373
374/* "prismjs/components/prism-markup" */
375
376Prism.languages.markup = {
377 'comment': /<!--[\s\S]*?-->/,
378 'prolog': /<\?[\s\S]+?\?>/,
379 'doctype': {
380 // https://www.w3.org/TR/xml/#NT-doctypedecl
381 pattern: /<!DOCTYPE(?:[^>"'[\]]|"[^"]*"|'[^']*')+(?:\[(?:[^<"'\]]|"[^"]*"|'[^']*'|<(?!!--)|<!--(?:[^-]|-(?!->))*-->)*\]\s*)?>/i,
382 greedy: true,
383 inside: {
384 'internal-subset': {
385 pattern: /(\[)[\s\S]+(?=\]>$)/,
386 lookbehind: true,
387 greedy: true,
388 inside: null // see below
389
390 },
391 'string': {
392 pattern: /"[^"]*"|'[^']*'/,
393 greedy: true
394 },
395 'punctuation': /^<!|>$|[[\]]/,
396 'doctype-tag': /^DOCTYPE/,
397 'name': /[^\s<>'"]+/
398 }
399 },
400 'cdata': /<!\[CDATA\[[\s\S]*?]]>/i,
401 'tag': {
402 pattern: /<\/?(?!\d)[^\s>\/=$<%]+(?:\s(?:\s*[^\s>\/=]+(?:\s*=\s*(?:"[^"]*"|'[^']*'|[^\s'">=]+(?=[\s>]))|(?=[\s/>])))+)?\s*\/?>/,
403 greedy: true,
404 inside: {
405 'tag': {
406 pattern: /^<\/?[^\s>\/]+/,
407 inside: {
408 'punctuation': /^<\/?/,
409 'namespace': /^[^\s>\/:]+:/
410 }
411 },
412 'attr-value': {
413 pattern: /=\s*(?:"[^"]*"|'[^']*'|[^\s'">=]+)/,
414 inside: {
415 'punctuation': [{
416 pattern: /^=/,
417 alias: 'attr-equals'
418 }, /"|'/]
419 }
420 },
421 'punctuation': /\/?>/,
422 'attr-name': {
423 pattern: /[^\s>\/]+/,
424 inside: {
425 'namespace': /^[^\s>\/:]+:/
426 }
427 }
428 }
429 },
430 'entity': [{
431 pattern: /&[\da-z]{1,8};/i,
432 alias: 'named-entity'
433 }, /&#x?[\da-f]{1,8};/i]
434};
435Prism.languages.markup['tag'].inside['attr-value'].inside['entity'] = Prism.languages.markup['entity'];
436Prism.languages.markup['doctype'].inside['internal-subset'].inside = Prism.languages.markup; // Plugin to make entity title show the real entity, idea by Roman Komarov
437
438Prism.hooks.add('wrap', function (env) {
439 if (env.type === 'entity') {
440 env.attributes['title'] = env.content.replace(/&amp;/, '&');
441 }
442});
443Object.defineProperty(Prism.languages.markup.tag, 'addInlined', {
444 /**
445 * Adds an inlined language to markup.
446 *
447 * An example of an inlined language is CSS with `<style>` tags.
448 *
449 * @param {string} tagName The name of the tag that contains the inlined language. This name will be treated as
450 * case insensitive.
451 * @param {string} lang The language key.
452 * @example
453 * addInlined('style', 'css');
454 */
455 value: function addInlined(tagName, lang) {
456 var includedCdataInside = {};
457 includedCdataInside['language-' + lang] = {
458 pattern: /(^<!\[CDATA\[)[\s\S]+?(?=\]\]>$)/i,
459 lookbehind: true,
460 inside: Prism.languages[lang]
461 };
462 includedCdataInside['cdata'] = /^<!\[CDATA\[|\]\]>$/i;
463 var inside = {
464 'included-cdata': {
465 pattern: /<!\[CDATA\[[\s\S]*?\]\]>/i,
466 inside: includedCdataInside
467 }
468 };
469 inside['language-' + lang] = {
470 pattern: /[\s\S]+/,
471 inside: Prism.languages[lang]
472 };
473 var def = {};
474 def[tagName] = {
475 pattern: RegExp(/(<__[^>]*>)(?:<!\[CDATA\[(?:[^\]]|\](?!\]>))*\]\]>|(?!<!\[CDATA\[)[\s\S])*?(?=<\/__>)/.source.replace(/__/g, function () {
476 return tagName;
477 }), 'i'),
478 lookbehind: true,
479 greedy: true,
480 inside: inside
481 };
482 Prism.languages.insertBefore('markup', 'cdata', def);
483 }
484});
485Prism.languages.html = Prism.languages.markup;
486Prism.languages.mathml = Prism.languages.markup;
487Prism.languages.svg = Prism.languages.markup;
488Prism.languages.xml = Prism.languages.extend('markup', {});
489Prism.languages.ssml = Prism.languages.xml;
490Prism.languages.atom = Prism.languages.xml;
491Prism.languages.rss = Prism.languages.xml;
492/* "prismjs/components/prism-bash" */
493
494(function (Prism) {
495 // $ set | grep '^[A-Z][^[:space:]]*=' | cut -d= -f1 | tr '\n' '|'
496 // + LC_ALL, RANDOM, REPLY, SECONDS.
497 // + make sure PS1..4 are here as they are not always set,
498 // - some useless things.
499 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';
500 var commandAfterHeredoc = {
501 pattern: /(^(["']?)\w+\2)[ \t]+\S.*/,
502 lookbehind: true,
503 alias: 'punctuation',
504 // this looks reasonably well in all themes
505 inside: null // see below
506
507 };
508 var insideString = {
509 'bash': commandAfterHeredoc,
510 'environment': {
511 pattern: RegExp("\\$" + envVars),
512 alias: 'constant'
513 },
514 'variable': [// [0]: Arithmetic Environment
515 {
516 pattern: /\$?\(\([\s\S]+?\)\)/,
517 greedy: true,
518 inside: {
519 // If there is a $ sign at the beginning highlight $(( and )) as variable
520 'variable': [{
521 pattern: /(^\$\(\([\s\S]+)\)\)/,
522 lookbehind: true
523 }, /^\$\(\(/],
524 'number': /\b0x[\dA-Fa-f]+\b|(?:\b\d+(?:\.\d*)?|\B\.\d+)(?:[Ee]-?\d+)?/,
525 // Operators according to https://www.gnu.org/software/bash/manual/bashref.html#Shell-Arithmetic
526 'operator': /--?|-=|\+\+?|\+=|!=?|~|\*\*?|\*=|\/=?|%=?|<<=?|>>=?|<=?|>=?|==?|&&?|&=|\^=?|\|\|?|\|=|\?|:/,
527 // If there is no $ sign at the beginning highlight (( and )) as punctuation
528 'punctuation': /\(\(?|\)\)?|,|;/
529 }
530 }, // [1]: Command Substitution
531 {
532 pattern: /\$\((?:\([^)]+\)|[^()])+\)|`[^`]+`/,
533 greedy: true,
534 inside: {
535 'variable': /^\$\(|^`|\)$|`$/
536 }
537 }, // [2]: Brace expansion
538 {
539 pattern: /\$\{[^}]+\}/,
540 greedy: true,
541 inside: {
542 'operator': /:[-=?+]?|[!\/]|##?|%%?|\^\^?|,,?/,
543 'punctuation': /[\[\]]/,
544 'environment': {
545 pattern: RegExp("(\\{)" + envVars),
546 lookbehind: true,
547 alias: 'constant'
548 }
549 }
550 }, /\$(?:\w+|[#?*!@$])/],
551 // Escape sequences from echo and printf's manuals, and escaped quotes.
552 '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})/
553 };
554 Prism.languages.bash = {
555 'shebang': {
556 pattern: /^#!\s*\/.*/,
557 alias: 'important'
558 },
559 'comment': {
560 pattern: /(^|[^"{\\$])#.*/,
561 lookbehind: true
562 },
563 'function-name': [// a) function foo {
564 // b) foo() {
565 // c) function foo() {
566 // but not “foo {”
567 {
568 // a) and c)
569 pattern: /(\bfunction\s+)\w+(?=(?:\s*\(?:\s*\))?\s*\{)/,
570 lookbehind: true,
571 alias: 'function'
572 }, {
573 // b)
574 pattern: /\b\w+(?=\s*\(\s*\)\s*\{)/,
575 alias: 'function'
576 }],
577 // Highlight variable names as variables in for and select beginnings.
578 'for-or-select': {
579 pattern: /(\b(?:for|select)\s+)\w+(?=\s+in\s)/,
580 alias: 'variable',
581 lookbehind: true
582 },
583 // Highlight variable names as variables in the left-hand part
584 // of assignments (“=” and “+=”).
585 'assign-left': {
586 pattern: /(^|[\s;|&]|[<>]\()\w+(?=\+?=)/,
587 inside: {
588 'environment': {
589 pattern: RegExp("(^|[\\s;|&]|[<>]\\()" + envVars),
590 lookbehind: true,
591 alias: 'constant'
592 }
593 },
594 alias: 'variable',
595 lookbehind: true
596 },
597 'string': [// Support for Here-documents https://en.wikipedia.org/wiki/Here_document
598 {
599 pattern: /((?:^|[^<])<<-?\s*)(\w+?)\s[\s\S]*?(?:\r?\n|\r)\2/,
600 lookbehind: true,
601 greedy: true,
602 inside: insideString
603 }, // Here-document with quotes around the tag
604 // → No expansion (so no “inside”).
605 {
606 pattern: /((?:^|[^<])<<-?\s*)(["'])(\w+)\2\s[\s\S]*?(?:\r?\n|\r)\3/,
607 lookbehind: true,
608 greedy: true,
609 inside: {
610 'bash': commandAfterHeredoc
611 }
612 }, // “Normal” string
613 {
614 pattern: /(^|[^\\](?:\\\\)*)(["'])(?:\\[\s\S]|\$\([^)]+\)|\$(?!\()|`[^`]+`|(?!\2)[^\\`$])*\2/,
615 lookbehind: true,
616 greedy: true,
617 inside: insideString
618 }],
619 'environment': {
620 pattern: RegExp("\\$?" + envVars),
621 alias: 'constant'
622 },
623 'variable': insideString.variable,
624 'function': {
625 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;|&])/,
626 lookbehind: true
627 },
628 'keyword': {
629 pattern: /(^|[\s;|&]|[<>]\()(?:if|then|else|elif|fi|for|while|in|case|esac|function|select|do|done|until)(?=$|[)\s;|&])/,
630 lookbehind: true
631 },
632 // https://www.gnu.org/software/bash/manual/html_node/Shell-Builtin-Commands.html
633 'builtin': {
634 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;|&])/,
635 lookbehind: true,
636 // Alias added to make those easier to distinguish from strings.
637 alias: 'class-name'
638 },
639 'boolean': {
640 pattern: /(^|[\s;|&]|[<>]\()(?:true|false)(?=$|[)\s;|&])/,
641 lookbehind: true
642 },
643 'file-descriptor': {
644 pattern: /\B&\d\b/,
645 alias: 'important'
646 },
647 'operator': {
648 // Lots of redirections here, but not just that.
649 pattern: /\d?<>|>\||\+=|==?|!=?|=~|<<[<-]?|[&\d]?>>|\d?[<>]&?|&[>&]?|\|[&|]?|<=?|>=?/,
650 inside: {
651 'file-descriptor': {
652 pattern: /^\d/,
653 alias: 'important'
654 }
655 }
656 },
657 'punctuation': /\$?\(\(?|\)\)?|\.\.|[{}[\];\\]/,
658 'number': {
659 pattern: /(^|\s)(?:[1-9]\d*|0)(?:[.,]\d+)?\b/,
660 lookbehind: true
661 }
662 };
663 commandAfterHeredoc.inside = Prism.languages.bash;
664 /* Patterns in command substitution. */
665
666 var toBeCopied = ['comment', 'function-name', 'for-or-select', 'assign-left', 'string', 'environment', 'function', 'keyword', 'builtin', 'boolean', 'file-descriptor', 'operator', 'punctuation', 'number'];
667 var inside = insideString.variable[1].inside;
668
669 for (var i = 0; i < toBeCopied.length; i++) {
670 inside[toBeCopied[i]] = Prism.languages.bash[toBeCopied[i]];
671 }
672
673 Prism.languages.shell = Prism.languages.bash;
674})(Prism);
675/* "prismjs/components/prism-clike" */
676
677
678Prism.languages.clike = {
679 'comment': [{
680 pattern: /(^|[^\\])\/\*[\s\S]*?(?:\*\/|$)/,
681 lookbehind: true,
682 greedy: true
683 }, {
684 pattern: /(^|[^\\:])\/\/.*/,
685 lookbehind: true,
686 greedy: true
687 }],
688 'string': {
689 pattern: /(["'])(?:\\(?:\r\n|[\s\S])|(?!\1)[^\\\r\n])*\1/,
690 greedy: true
691 },
692 'class-name': {
693 pattern: /(\b(?:class|interface|extends|implements|trait|instanceof|new)\s+|\bcatch\s+\()[\w.\\]+/i,
694 lookbehind: true,
695 inside: {
696 'punctuation': /[.\\]/
697 }
698 },
699 'keyword': /\b(?:if|else|while|do|for|return|in|instanceof|function|new|try|throw|catch|finally|null|break|continue)\b/,
700 'boolean': /\b(?:true|false)\b/,
701 'function': /\w+(?=\()/,
702 'number': /\b0x[\da-f]+\b|(?:\b\d+(?:\.\d*)?|\B\.\d+)(?:e[+-]?\d+)?/i,
703 'operator': /[<>]=?|[!=]=?=?|--?|\+\+?|&&?|\|\|?|[?*/~^%]/,
704 'punctuation': /[{}[\];(),.:]/
705};
706/* "prismjs/components/prism-c" */
707
708Prism.languages.c = Prism.languages.extend('clike', {
709 'comment': {
710 pattern: /\/\/(?:[^\r\n\\]|\\(?:\r\n?|\n|(?![\r\n])))*|\/\*[\s\S]*?(?:\*\/|$)/,
711 greedy: true
712 },
713 'class-name': {
714 pattern: /(\b(?:enum|struct)\s+(?:__attribute__\s*\(\([\s\S]*?\)\)\s*)?)\w+|\b[a-z]\w*_t\b/,
715 lookbehind: true
716 },
717 '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/,
718 'function': /[a-z_]\w*(?=\s*\()/i,
719 'number': /(?:\b0x(?:[\da-f]+(?:\.[\da-f]*)?|\.[\da-f]+)(?:p[+-]?\d+)?|(?:\b\d+(?:\.\d*)?|\B\.\d+)(?:e[+-]?\d+)?)[ful]{0,4}/i,
720 'operator': />>=?|<<=?|->|([-+&|:])\1|[?:~]|[-+*/%&|^!=<>]=?/
721});
722Prism.languages.insertBefore('c', 'string', {
723 'macro': {
724 // allow for multiline macro definitions
725 // spaces after the # character compile fine with gcc
726 pattern: /(^\s*)#\s*[a-z](?:[^\r\n\\/]|\/(?!\*)|\/\*(?:[^*]|\*(?!\/))*\*\/|\\(?:\r\n|[\s\S]))*/im,
727 lookbehind: true,
728 greedy: true,
729 alias: 'property',
730 inside: {
731 'string': [{
732 // highlight the path of the include statement as a string
733 pattern: /^(#\s*include\s*)<[^>]+>/,
734 lookbehind: true
735 }, Prism.languages.c['string']],
736 'comment': Prism.languages.c['comment'],
737 'macro-name': [{
738 pattern: /(^#\s*define\s+)\w+\b(?!\()/i,
739 lookbehind: true
740 }, {
741 pattern: /(^#\s*define\s+)\w+\b(?=\()/i,
742 lookbehind: true,
743 alias: 'function'
744 }],
745 // highlight macro directives as keywords
746 'directive': {
747 pattern: /^(#\s*)[a-z]+/,
748 lookbehind: true,
749 alias: 'keyword'
750 },
751 'directive-hash': /^#/,
752 'punctuation': /##|\\(?=[\r\n])/,
753 'expression': {
754 pattern: /\S[\s\S]*/,
755 inside: Prism.languages.c
756 }
757 }
758 },
759 // highlight predefined macros as constants
760 'constant': /\b(?:__FILE__|__LINE__|__DATE__|__TIME__|__TIMESTAMP__|__func__|EOF|NULL|SEEK_CUR|SEEK_END|SEEK_SET|stdin|stdout|stderr)\b/
761});
762delete Prism.languages.c['boolean'];
763/* "prismjs/components/prism-cpp" */
764
765(function (Prism) {
766 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/;
767 Prism.languages.cpp = Prism.languages.extend('c', {
768 'class-name': [{
769 pattern: RegExp(/(\b(?:class|concept|enum|struct|typename)\s+)(?!<keyword>)\w+/.source.replace(/<keyword>/g, function () {
770 return keyword.source;
771 })),
772 lookbehind: true
773 }, // This is intended to capture the class name of method implementations like:
774 // void foo::bar() const {}
775 // However! The `foo` in the above example could also be a namespace, so we only capture the class name if
776 // it starts with an uppercase letter. This approximation should give decent results.
777 /\b[A-Z]\w*(?=\s*::\s*\w+\s*\()/, // This will capture the class name before destructors like:
778 // Foo::~Foo() {}
779 /\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
780 // parameters, so it can't be a namespace (until C++ adds generic namespaces).
781 /\w+(?=\s*<(?:[^<>]|<(?:[^<>]|<[^<>]*>)*>)*>\s*::\s*\w+\s*\()/],
782 'keyword': keyword,
783 'number': {
784 pattern: /(?:\b0b[01']+|\b0x(?:[\da-f']+(?:\.[\da-f']*)?|\.[\da-f']+)(?:p[+-]?[\d']+)?|(?:\b[\d']+(?:\.[\d']*)?|\B\.[\d']+)(?:e[+-]?[\d']+)?)[ful]{0,4}/i,
785 greedy: true
786 },
787 'operator': />>=?|<<=?|->|([-+&|:])\1|[?:~]|<=>|[-+*/%&|^!=<>]=?|\b(?:and|and_eq|bitand|bitor|not|not_eq|or|or_eq|xor|xor_eq)\b/,
788 'boolean': /\b(?:true|false)\b/
789 });
790 Prism.languages.insertBefore('cpp', 'string', {
791 'raw-string': {
792 pattern: /R"([^()\\ ]{0,16})\([\s\S]*?\)\1"/,
793 alias: 'string',
794 greedy: true
795 }
796 });
797 Prism.languages.insertBefore('cpp', 'class-name', {
798 // the base clause is an optional list of parent classes
799 // https://en.cppreference.com/w/cpp/language/class
800 'base-clause': {
801 pattern: /(\b(?:class|struct)\s+\w+\s*:\s*)[^;{}"'\s]+(?:\s+[^;{}"'\s]+)*(?=\s*[;{])/,
802 lookbehind: true,
803 greedy: true,
804 inside: Prism.languages.extend('cpp', {})
805 }
806 });
807 Prism.languages.insertBefore('inside', 'operator', {
808 // All untokenized words that are not namespaces should be class names
809 'class-name': /\b[a-z_]\w*\b(?!\s*::)/i
810 }, Prism.languages.cpp['base-clause']);
811})(Prism);
812/* "prismjs/components/prism-css" */
813
814
815(function (Prism) {
816 var string = /("|')(?:\\(?:\r\n|[\s\S])|(?!\1)[^\\\r\n])*\1/;
817 Prism.languages.css = {
818 'comment': /\/\*[\s\S]*?\*\//,
819 'atrule': {
820 pattern: /@[\w-](?:[^;{\s]|\s+(?![\s{]))*(?:;|(?=\s*\{))/,
821 inside: {
822 'rule': /^@[\w-]+/,
823 'selector-function-argument': {
824 pattern: /(\bselector\s*\(\s*(?![\s)]))(?:[^()\s]|\s+(?![\s)])|\((?:[^()]|\([^()]*\))*\))+(?=\s*\))/,
825 lookbehind: true,
826 alias: 'selector'
827 },
828 'keyword': {
829 pattern: /(^|[^\w-])(?:and|not|only|or)(?![\w-])/,
830 lookbehind: true
831 } // See rest below
832
833 }
834 },
835 'url': {
836 // https://drafts.csswg.org/css-values-3/#urls
837 pattern: RegExp('\\burl\\((?:' + string.source + '|' + /(?:[^\\\r\n()"']|\\[\s\S])*/.source + ')\\)', 'i'),
838 greedy: true,
839 inside: {
840 'function': /^url/i,
841 'punctuation': /^\(|\)$/,
842 'string': {
843 pattern: RegExp('^' + string.source + '$'),
844 alias: 'url'
845 }
846 }
847 },
848 'selector': RegExp('[^{}\\s](?:[^{};"\'\\s]|\\s+(?![\\s{])|' + string.source + ')*(?=\\s*\\{)'),
849 'string': {
850 pattern: string,
851 greedy: true
852 },
853 'property': /(?!\s)[-_a-z\xA0-\uFFFF](?:(?!\s)[-\w\xA0-\uFFFF])*(?=\s*:)/i,
854 'important': /!important\b/i,
855 'function': /[-a-z0-9]+(?=\()/i,
856 'punctuation': /[(){};:,]/
857 };
858 Prism.languages.css['atrule'].inside.rest = Prism.languages.css;
859 var markup = Prism.languages.markup;
860
861 if (markup) {
862 markup.tag.addInlined('style', 'css');
863 Prism.languages.insertBefore('inside', 'attr-value', {
864 'style-attr': {
865 pattern: /(^|["'\s])style\s*=\s*(?:"[^"]*"|'[^']*')/i,
866 lookbehind: true,
867 inside: {
868 'attr-value': {
869 pattern: /=\s*(?:"[^"]*"|'[^']*'|[^\s'">=]+)/,
870 inside: {
871 'style': {
872 pattern: /(["'])[\s\S]+(?=["']$)/,
873 lookbehind: true,
874 alias: 'language-css',
875 inside: Prism.languages.css
876 },
877 'punctuation': [{
878 pattern: /^=/,
879 alias: 'attr-equals'
880 }, /"|'/]
881 }
882 },
883 'attr-name': /^style/i
884 }
885 }
886 }, markup.tag);
887 }
888})(Prism);
889/* "prismjs/components/prism-css-extras" */
890
891
892(function (Prism) {
893 var string = /("|')(?:\\(?:\r\n|[\s\S])|(?!\1)[^\\\r\n])*\1/;
894 var selectorInside;
895 Prism.languages.css.selector = {
896 pattern: Prism.languages.css.selector,
897 inside: selectorInside = {
898 'pseudo-element': /:(?:after|before|first-letter|first-line|selection)|::[-\w]+/,
899 'pseudo-class': /:[-\w]+/,
900 'class': /\.[-\w]+/,
901 'id': /#[-\w]+/,
902 'attribute': {
903 pattern: RegExp('\\[(?:[^[\\]"\']|' + string.source + ')*\\]'),
904 greedy: true,
905 inside: {
906 'punctuation': /^\[|\]$/,
907 'case-sensitivity': {
908 pattern: /(\s)[si]$/i,
909 lookbehind: true,
910 alias: 'keyword'
911 },
912 'namespace': {
913 pattern: /^(\s*)(?:(?!\s)[-*\w\xA0-\uFFFF])*\|(?!=)/,
914 lookbehind: true,
915 inside: {
916 'punctuation': /\|$/
917 }
918 },
919 'attr-name': {
920 pattern: /^(\s*)(?:(?!\s)[-\w\xA0-\uFFFF])+/,
921 lookbehind: true
922 },
923 'attr-value': [string, {
924 pattern: /(=\s*)(?:(?!\s)[-\w\xA0-\uFFFF])+(?=\s*$)/,
925 lookbehind: true
926 }],
927 'operator': /[|~*^$]?=/
928 }
929 },
930 'n-th': [{
931 pattern: /(\(\s*)[+-]?\d*[\dn](?:\s*[+-]\s*\d+)?(?=\s*\))/,
932 lookbehind: true,
933 inside: {
934 'number': /[\dn]+/,
935 'operator': /[+-]/
936 }
937 }, {
938 pattern: /(\(\s*)(?:even|odd)(?=\s*\))/i,
939 lookbehind: true
940 }],
941 'combinator': />|\+|~|\|\|/,
942 // the `tag` token has been existed and removed.
943 // because we can't find a perfect tokenize to match it.
944 // if you want to add it, please read https://github.com/PrismJS/prism/pull/2373 first.
945 'punctuation': /[(),]/
946 }
947 };
948 Prism.languages.css['atrule'].inside['selector-function-argument'].inside = selectorInside;
949 Prism.languages.insertBefore('css', 'property', {
950 'variable': {
951 pattern: /(^|[^-\w\xA0-\uFFFF])--(?!\s)[-_a-z\xA0-\uFFFF](?:(?!\s)[-\w\xA0-\uFFFF])*/i,
952 lookbehind: true
953 }
954 });
955 var unit = {
956 pattern: /(\b\d+)(?:%|[a-z]+\b)/,
957 lookbehind: true
958 }; // 123 -123 .123 -.123 12.3 -12.3
959
960 var number = {
961 pattern: /(^|[^\w.-])-?(?:\d+(?:\.\d+)?|\.\d+)/,
962 lookbehind: true
963 };
964 Prism.languages.insertBefore('css', 'function', {
965 'operator': {
966 pattern: /(\s)[+\-*\/](?=\s)/,
967 lookbehind: true
968 },
969 // CAREFUL!
970 // Previewers and Inline color use hexcode and color.
971 'hexcode': {
972 pattern: /\B#(?:[\da-f]{1,2}){3,4}\b/i,
973 alias: 'color'
974 },
975 '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, {
976 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,
977 inside: {
978 'unit': unit,
979 'number': number,
980 'function': /[\w-]+(?=\()/,
981 'punctuation': /[(),]/
982 }
983 }],
984 // it's important that there is no boundary assertion after the hex digits
985 'entity': /\\[\da-f]{1,8}/i,
986 'unit': unit,
987 'number': number
988 });
989})(Prism);
990/* "prismjs/components/prism-javascript" */
991
992
993Prism.languages.javascript = Prism.languages.extend('clike', {
994 'class-name': [Prism.languages.clike['class-name'], {
995 pattern: /(^|[^$\w\xA0-\uFFFF])(?!\s)[_$A-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*(?=\.(?:prototype|constructor))/,
996 lookbehind: true
997 }],
998 'keyword': [{
999 pattern: /((?:^|})\s*)(?:catch|finally)\b/,
1000 lookbehind: true
1001 }, {
1002 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/,
1003 lookbehind: true
1004 }],
1005 // Allow for all non-ASCII characters (See http://stackoverflow.com/a/2008444)
1006 'function': /#?(?!\s)[_$a-zA-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*(?=\s*(?:\.\s*(?:apply|bind|call)\s*)?\()/,
1007 '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)?)+)?/,
1008 'operator': /--|\+\+|\*\*=?|=>|&&=?|\|\|=?|[!=]==|<<=?|>>>?=?|[-+*/%&|^!=<>]=?|\.{3}|\?\?=?|\?\.?|[~:]/
1009});
1010Prism.languages.javascript['class-name'][0].pattern = /(\b(?:class|interface|extends|implements|instanceof|new)\s+)[\w.\\]+/;
1011Prism.languages.insertBefore('javascript', 'keyword', {
1012 'regex': {
1013 pattern: /((?:^|[^$\w\xA0-\uFFFF."'\])\s]|\b(?:return|yield))\s*)\/(?:\[(?:[^\]\\\r\n]|\\.)*]|\\.|[^/\\\[\r\n])+\/[gimyus]{0,6}(?=(?:\s|\/\*(?:[^*]|\*(?!\/))*\*\/)*(?:$|[\r\n,.;:})\]]|\/\/))/,
1014 lookbehind: true,
1015 greedy: true,
1016 inside: {
1017 'regex-source': {
1018 pattern: /^(\/)[\s\S]+(?=\/[a-z]*$)/,
1019 lookbehind: true,
1020 alias: 'language-regex',
1021 inside: Prism.languages.regex
1022 },
1023 'regex-flags': /[a-z]+$/,
1024 'regex-delimiter': /^\/|\/$/
1025 }
1026 },
1027 // This must be declared before keyword because we use "function" inside the look-forward
1028 'function-variable': {
1029 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*=>))/,
1030 alias: 'function'
1031 },
1032 'parameter': [{
1033 pattern: /(function(?:\s+(?!\s)[_$a-zA-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*)?\s*\(\s*)(?!\s)(?:[^()\s]|\s+(?![\s)])|\([^()]*\))+(?=\s*\))/,
1034 lookbehind: true,
1035 inside: Prism.languages.javascript
1036 }, {
1037 pattern: /(?!\s)[_$a-zA-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*(?=\s*=>)/i,
1038 inside: Prism.languages.javascript
1039 }, {
1040 pattern: /(\(\s*)(?!\s)(?:[^()\s]|\s+(?![\s)])|\([^()]*\))+(?=\s*\)\s*=>)/,
1041 lookbehind: true,
1042 inside: Prism.languages.javascript
1043 }, {
1044 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*\{)/,
1045 lookbehind: true,
1046 inside: Prism.languages.javascript
1047 }],
1048 'constant': /\b[A-Z](?:[A-Z_]|\dx?)*\b/
1049});
1050Prism.languages.insertBefore('javascript', 'string', {
1051 'template-string': {
1052 pattern: /`(?:\\[\s\S]|\${(?:[^{}]|{(?:[^{}]|{[^}]*})*})+}|(?!\${)[^\\`])*`/,
1053 greedy: true,
1054 inside: {
1055 'template-punctuation': {
1056 pattern: /^`|`$/,
1057 alias: 'string'
1058 },
1059 'interpolation': {
1060 pattern: /((?:^|[^\\])(?:\\{2})*)\${(?:[^{}]|{(?:[^{}]|{[^}]*})*})+}/,
1061 lookbehind: true,
1062 inside: {
1063 'interpolation-punctuation': {
1064 pattern: /^\${|}$/,
1065 alias: 'punctuation'
1066 },
1067 rest: Prism.languages.javascript
1068 }
1069 },
1070 'string': /[\s\S]+/
1071 }
1072 }
1073});
1074
1075if (Prism.languages.markup) {
1076 Prism.languages.markup.tag.addInlined('script', 'javascript');
1077}
1078
1079Prism.languages.js = Prism.languages.javascript;
1080/* "prismjs/components/prism-jsx" */
1081
1082(function (Prism) {
1083 var javascript = Prism.util.clone(Prism.languages.javascript);
1084 Prism.languages.jsx = Prism.languages.extend('markup', javascript);
1085 Prism.languages.jsx.tag.pattern = /<\/?(?:[\w.:-]+(?:\s+(?:[\w.:$-]+(?:=(?:"(?:\\[^]|[^\\"])*"|'(?:\\[^]|[^\\'])*'|[^\s{'">=]+|\{(?:\{(?:\{[^{}]*\}|[^{}])*\}|[^{}])+\}))?|\{\s*\.{3}\s*[a-z_$][\w$]*(?:\.[a-z_$][\w$]*)*\s*\}))*\s*\/?)?>/i;
1086 Prism.languages.jsx.tag.inside['tag'].pattern = /^<\/?[^\s>\/]*/i;
1087 Prism.languages.jsx.tag.inside['attr-value'].pattern = /=(?!\{)(?:"(?:\\[^]|[^\\"])*"|'(?:\\[^]|[^\\'])*'|[^\s'">]+)/i;
1088 Prism.languages.jsx.tag.inside['tag'].inside['class-name'] = /^[A-Z]\w*(?:\.[A-Z]\w*)*$/;
1089 Prism.languages.insertBefore('inside', 'attr-name', {
1090 'spread': {
1091 pattern: /\{\s*\.{3}\s*[a-z_$][\w$]*(?:\.[a-z_$][\w$]*)*\s*\}/,
1092 inside: {
1093 'punctuation': /\.{3}|[{}.]/,
1094 'attr-value': /\w+/
1095 }
1096 }
1097 }, Prism.languages.jsx.tag);
1098 Prism.languages.insertBefore('inside', 'attr-value', {
1099 'script': {
1100 // Allow for two levels of nesting
1101 pattern: /=(?:\{(?:\{(?:\{[^{}]*\}|[^{}])*\}|[^{}])+\})/i,
1102 inside: {
1103 'script-punctuation': {
1104 pattern: /^=(?={)/,
1105 alias: 'punctuation'
1106 },
1107 rest: Prism.languages.jsx
1108 },
1109 'alias': 'language-javascript'
1110 }
1111 }, Prism.languages.jsx.tag); // The following will handle plain text inside tags
1112
1113 var stringifyToken = function (token) {
1114 if (!token) {
1115 return '';
1116 }
1117
1118 if (typeof token === 'string') {
1119 return token;
1120 }
1121
1122 if (typeof token.content === 'string') {
1123 return token.content;
1124 }
1125
1126 return token.content.map(stringifyToken).join('');
1127 };
1128
1129 var walkTokens = function (tokens) {
1130 var openedTags = [];
1131
1132 for (var i = 0; i < tokens.length; i++) {
1133 var token = tokens[i];
1134 var notTagNorBrace = false;
1135
1136 if (typeof token !== 'string') {
1137 if (token.type === 'tag' && token.content[0] && token.content[0].type === 'tag') {
1138 // We found a tag, now find its kind
1139 if (token.content[0].content[0].content === '</') {
1140 // Closing tag
1141 if (openedTags.length > 0 && openedTags[openedTags.length - 1].tagName === stringifyToken(token.content[0].content[1])) {
1142 // Pop matching opening tag
1143 openedTags.pop();
1144 }
1145 } else {
1146 if (token.content[token.content.length - 1].content === '/>') ; else {
1147 // Opening tag
1148 openedTags.push({
1149 tagName: stringifyToken(token.content[0].content[1]),
1150 openedBraces: 0
1151 });
1152 }
1153 }
1154 } else if (openedTags.length > 0 && token.type === 'punctuation' && token.content === '{') {
1155 // Here we might have entered a JSX context inside a tag
1156 openedTags[openedTags.length - 1].openedBraces++;
1157 } else if (openedTags.length > 0 && openedTags[openedTags.length - 1].openedBraces > 0 && token.type === 'punctuation' && token.content === '}') {
1158 // Here we might have left a JSX context inside a tag
1159 openedTags[openedTags.length - 1].openedBraces--;
1160 } else {
1161 notTagNorBrace = true;
1162 }
1163 }
1164
1165 if (notTagNorBrace || typeof token === 'string') {
1166 if (openedTags.length > 0 && openedTags[openedTags.length - 1].openedBraces === 0) {
1167 // Here we are inside a tag, and not inside a JSX context.
1168 // That's plain text: drop any tokens matched.
1169 var plainText = stringifyToken(token); // And merge text with adjacent text
1170
1171 if (i < tokens.length - 1 && (typeof tokens[i + 1] === 'string' || tokens[i + 1].type === 'plain-text')) {
1172 plainText += stringifyToken(tokens[i + 1]);
1173 tokens.splice(i + 1, 1);
1174 }
1175
1176 if (i > 0 && (typeof tokens[i - 1] === 'string' || tokens[i - 1].type === 'plain-text')) {
1177 plainText = stringifyToken(tokens[i - 1]) + plainText;
1178 tokens.splice(i - 1, 1);
1179 i--;
1180 }
1181
1182 tokens[i] = new Prism.Token('plain-text', plainText, null, plainText);
1183 }
1184 }
1185
1186 if (token.content && typeof token.content !== 'string') {
1187 walkTokens(token.content);
1188 }
1189 }
1190 };
1191
1192 Prism.hooks.add('after-tokenize', function (env) {
1193 if (env.language !== 'jsx' && env.language !== 'tsx') {
1194 return;
1195 }
1196
1197 walkTokens(env.tokens);
1198 });
1199})(Prism);
1200/* "prismjs/components/prism-js-extras" */
1201
1202
1203(function (Prism) {
1204 Prism.languages.insertBefore('javascript', 'function-variable', {
1205 'method-variable': {
1206 pattern: RegExp('(\\.\\s*)' + Prism.languages.javascript['function-variable'].pattern.source),
1207 lookbehind: true,
1208 alias: ['function-variable', 'method', 'function', 'property-access']
1209 }
1210 });
1211 Prism.languages.insertBefore('javascript', 'function', {
1212 'method': {
1213 pattern: RegExp('(\\.\\s*)' + Prism.languages.javascript['function'].source),
1214 lookbehind: true,
1215 alias: ['function', 'property-access']
1216 }
1217 });
1218 Prism.languages.insertBefore('javascript', 'constant', {
1219 'known-class-name': [{
1220 // standard built-ins
1221 // https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects
1222 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/,
1223 alias: 'class-name'
1224 }, {
1225 // errors
1226 pattern: /\b(?:[A-Z]\w*)Error\b/,
1227 alias: 'class-name'
1228 }]
1229 });
1230 /**
1231 * Replaces the `<ID>` placeholder in the given pattern with a pattern for general JS identifiers.
1232 *
1233 * @param {string} source
1234 * @param {string} [flags]
1235 * @returns {RegExp}
1236 */
1237
1238 function withId(source, flags) {
1239 return RegExp(source.replace(/<ID>/g, function () {
1240 return /(?!\s)[_$a-zA-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*/.source;
1241 }), flags);
1242 }
1243
1244 Prism.languages.insertBefore('javascript', 'keyword', {
1245 'imports': {
1246 // https://tc39.es/ecma262/#sec-imports
1247 pattern: withId(/(\bimport\b\s*)(?:<ID>(?:\s*,\s*(?:\*\s*as\s+<ID>|\{[^{}]*\}))?|\*\s*as\s+<ID>|\{[^{}]*\})(?=\s*\bfrom\b)/.source),
1248 lookbehind: true,
1249 inside: Prism.languages.javascript
1250 },
1251 'exports': {
1252 // https://tc39.es/ecma262/#sec-exports
1253 pattern: withId(/(\bexport\b\s*)(?:\*(?:\s*as\s+<ID>)?(?=\s*\bfrom\b)|\{[^{}]*\})/.source),
1254 lookbehind: true,
1255 inside: Prism.languages.javascript
1256 }
1257 });
1258 Prism.languages.javascript['keyword'].unshift({
1259 pattern: /\b(?:as|default|export|from|import)\b/,
1260 alias: 'module'
1261 }, {
1262 pattern: /\b(?:await|break|catch|continue|do|else|for|finally|if|return|switch|throw|try|while|yield)\b/,
1263 alias: 'control-flow'
1264 }, {
1265 pattern: /\bnull\b/,
1266 alias: ['null', 'nil']
1267 }, {
1268 pattern: /\bundefined\b/,
1269 alias: 'nil'
1270 });
1271 Prism.languages.insertBefore('javascript', 'operator', {
1272 'spread': {
1273 pattern: /\.{3}/,
1274 alias: 'operator'
1275 },
1276 'arrow': {
1277 pattern: /=>/,
1278 alias: 'operator'
1279 }
1280 });
1281 Prism.languages.insertBefore('javascript', 'punctuation', {
1282 'property-access': {
1283 pattern: withId(/(\.\s*)#?<ID>/.source),
1284 lookbehind: true
1285 },
1286 'maybe-class-name': {
1287 pattern: /(^|[^$\w\xA0-\uFFFF])[A-Z][$\w\xA0-\uFFFF]+/,
1288 lookbehind: true
1289 },
1290 'dom': {
1291 // this contains only a few commonly used DOM variables
1292 pattern: /\b(?:document|location|navigator|performance|(?:local|session)Storage|window)\b/,
1293 alias: 'variable'
1294 },
1295 'console': {
1296 pattern: /\bconsole(?=\s*\.)/,
1297 alias: 'class-name'
1298 }
1299 }); // add 'maybe-class-name' to tokens which might be a class name
1300
1301 var maybeClassNameTokens = ['function', 'function-variable', 'method', 'method-variable', 'property-access'];
1302
1303 for (var i = 0; i < maybeClassNameTokens.length; i++) {
1304 var token = maybeClassNameTokens[i];
1305 var value = Prism.languages.javascript[token]; // convert regex to object
1306
1307 if (Prism.util.type(value) === 'RegExp') {
1308 value = Prism.languages.javascript[token] = {
1309 pattern: value
1310 };
1311 } // keep in mind that we don't support arrays
1312
1313
1314 var inside = value.inside || {};
1315 value.inside = inside;
1316 inside['maybe-class-name'] = /^[A-Z][\s\S]*/;
1317 }
1318})(Prism);
1319/* "prismjs/components/prism-coffeescript" */
1320
1321
1322(function (Prism) {
1323 // Ignore comments starting with { to privilege string interpolation highlighting
1324 var comment = /#(?!\{).+/,
1325 interpolation = {
1326 pattern: /#\{[^}]+\}/,
1327 alias: 'variable'
1328 };
1329 Prism.languages.coffeescript = Prism.languages.extend('javascript', {
1330 'comment': comment,
1331 'string': [// Strings are multiline
1332 {
1333 pattern: /'(?:\\[\s\S]|[^\\'])*'/,
1334 greedy: true
1335 }, {
1336 // Strings are multiline
1337 pattern: /"(?:\\[\s\S]|[^\\"])*"/,
1338 greedy: true,
1339 inside: {
1340 'interpolation': interpolation
1341 }
1342 }],
1343 '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/,
1344 'class-member': {
1345 pattern: /@(?!\d)\w+/,
1346 alias: 'variable'
1347 }
1348 });
1349 Prism.languages.insertBefore('coffeescript', 'comment', {
1350 'multiline-comment': {
1351 pattern: /###[\s\S]+?###/,
1352 alias: 'comment'
1353 },
1354 // Block regexp can contain comments and interpolation
1355 'block-regex': {
1356 pattern: /\/{3}[\s\S]*?\/{3}/,
1357 alias: 'regex',
1358 inside: {
1359 'comment': comment,
1360 'interpolation': interpolation
1361 }
1362 }
1363 });
1364 Prism.languages.insertBefore('coffeescript', 'string', {
1365 'inline-javascript': {
1366 pattern: /`(?:\\[\s\S]|[^\\`])*`/,
1367 inside: {
1368 'delimiter': {
1369 pattern: /^`|`$/,
1370 alias: 'punctuation'
1371 },
1372 'script': {
1373 pattern: /[\s\S]+/,
1374 alias: 'language-javascript',
1375 inside: Prism.languages.javascript
1376 }
1377 }
1378 },
1379 // Block strings
1380 'multiline-string': [{
1381 pattern: /'''[\s\S]*?'''/,
1382 greedy: true,
1383 alias: 'string'
1384 }, {
1385 pattern: /"""[\s\S]*?"""/,
1386 greedy: true,
1387 alias: 'string',
1388 inside: {
1389 interpolation: interpolation
1390 }
1391 }]
1392 });
1393 Prism.languages.insertBefore('coffeescript', 'keyword', {
1394 // Object property
1395 'property': /(?!\d)\w+(?=\s*:(?!:))/
1396 });
1397 delete Prism.languages.coffeescript['template-string'];
1398 Prism.languages.coffee = Prism.languages.coffeescript;
1399})(Prism);
1400/* "prismjs/components/prism-diff" */
1401
1402
1403(function (Prism) {
1404 Prism.languages.diff = {
1405 'coord': [// Match all kinds of coord lines (prefixed by "+++", "---" or "***").
1406 /^(?:\*{3}|-{3}|\+{3}).*$/m, // Match "@@ ... @@" coord lines in unified diff.
1407 /^@@.*@@$/m, // Match coord lines in normal diff (starts with a number).
1408 /^\d.*$/m] // deleted, inserted, unchanged, diff
1409
1410 };
1411 /**
1412 * A map from the name of a block to its line prefix.
1413 *
1414 * @type {Object<string, string>}
1415 */
1416
1417 var PREFIXES = {
1418 'deleted-sign': '-',
1419 'deleted-arrow': '<',
1420 'inserted-sign': '+',
1421 'inserted-arrow': '>',
1422 'unchanged': ' ',
1423 'diff': '!'
1424 }; // add a token for each prefix
1425
1426 Object.keys(PREFIXES).forEach(function (name) {
1427 var prefix = PREFIXES[name];
1428 var alias = [];
1429
1430 if (!/^\w+$/.test(name)) {
1431 // "deleted-sign" -> "deleted"
1432 alias.push(/\w+/.exec(name)[0]);
1433 }
1434
1435 if (name === "diff") {
1436 alias.push("bold");
1437 }
1438
1439 Prism.languages.diff[name] = {
1440 pattern: RegExp('^(?:[' + prefix + '].*(?:\r\n?|\n|(?![\\s\\S])))+', 'm'),
1441 alias: alias,
1442 inside: {
1443 'line': {
1444 pattern: /(.)(?=[\s\S]).*(?:\r\n?|\n)?/,
1445 lookbehind: true
1446 },
1447 'prefix': {
1448 pattern: /[\s\S]/,
1449 alias: /\w+/.exec(name)[0]
1450 }
1451 }
1452 };
1453 }); // make prefixes available to Diff plugin
1454
1455 Object.defineProperty(Prism.languages.diff, 'PREFIXES', {
1456 value: PREFIXES
1457 });
1458})(Prism);
1459/* "prismjs/components/prism-git" */
1460
1461
1462Prism.languages.git = {
1463 /*
1464 * A simple one line comment like in a git status command
1465 * For instance:
1466 * $ git status
1467 * # On branch infinite-scroll
1468 * # Your branch and 'origin/sharedBranches/frontendTeam/infinite-scroll' have diverged,
1469 * # and have 1 and 2 different commits each, respectively.
1470 * nothing to commit (working directory clean)
1471 */
1472 'comment': /^#.*/m,
1473
1474 /*
1475 * Regexp to match the changed lines in a git diff output. Check the example below.
1476 */
1477 'deleted': /^[-–].*/m,
1478 'inserted': /^\+.*/m,
1479
1480 /*
1481 * a string (double and simple quote)
1482 */
1483 'string': /("|')(?:\\.|(?!\1)[^\\\r\n])*\1/m,
1484
1485 /*
1486 * a git command. It starts with a random prompt finishing by a $, then "git" then some other parameters
1487 * For instance:
1488 * $ git add file.txt
1489 */
1490 'command': {
1491 pattern: /^.*\$ git .*$/m,
1492 inside: {
1493 /*
1494 * A git command can contain a parameter starting by a single or a double dash followed by a string
1495 * For instance:
1496 * $ git diff --cached
1497 * $ git log -p
1498 */
1499 'parameter': /\s--?\w+/m
1500 }
1501 },
1502
1503 /*
1504 * Coordinates displayed in a git diff command
1505 * For instance:
1506 * $ git diff
1507 * diff --git file.txt file.txt
1508 * index 6214953..1d54a52 100644
1509 * --- file.txt
1510 * +++ file.txt
1511 * @@ -1 +1,2 @@
1512 * -Here's my tetx file
1513 * +Here's my text file
1514 * +And this is the second line
1515 */
1516 'coord': /^@@.*@@$/m,
1517
1518 /*
1519 * Match a "commit [SHA1]" line in a git log output.
1520 * For instance:
1521 * $ git log
1522 * commit a11a14ef7e26f2ca62d4b35eac455ce636d0dc09
1523 * Author: lgiraudel
1524 * Date: Mon Feb 17 11:18:34 2014 +0100
1525 *
1526 * Add of a new line
1527 */
1528 'commit-sha1': /^commit \w{40}$/m
1529};
1530/* "prismjs/components/prism-go" */
1531
1532Prism.languages.go = Prism.languages.extend('clike', {
1533 'string': {
1534 pattern: /(["'`])(?:\\[\s\S]|(?!\1)[^\\])*\1/,
1535 greedy: true
1536 },
1537 '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/,
1538 'boolean': /\b(?:_|iota|nil|true|false)\b/,
1539 'number': /(?:\b0x[a-f\d]+|(?:\b\d+(?:\.\d*)?|\B\.\d+)(?:e[-+]?\d+)?)i?/i,
1540 'operator': /[*\/%^!=]=?|\+[=+]?|-[=-]?|\|[=|]?|&(?:=|&|\^=?)?|>(?:>=?|=)?|<(?:<=?|=|-)?|:=|\.\.\./,
1541 '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/
1542});
1543delete Prism.languages.go['class-name'];
1544/* "prismjs/components/prism-graphql" */
1545
1546Prism.languages.graphql = {
1547 'comment': /#.*/,
1548 'description': {
1549 pattern: /(?:"""(?:[^"]|(?!""")")*"""|"(?:\\.|[^\\"\r\n])*")(?=\s*[a-z_])/i,
1550 greedy: true,
1551 alias: 'string',
1552 inside: {
1553 'language-markdown': {
1554 pattern: /(^"(?:"")?)(?!\1)[\s\S]+(?=\1$)/,
1555 lookbehind: true,
1556 inside: Prism.languages.markdown
1557 }
1558 }
1559 },
1560 'string': {
1561 pattern: /"""(?:[^"]|(?!""")")*"""|"(?:\\.|[^\\"\r\n])*"/,
1562 greedy: true
1563 },
1564 'number': /(?:\B-|\b)\d+(?:\.\d+)?(?:e[+-]?\d+)?\b/i,
1565 'boolean': /\b(?:true|false)\b/,
1566 'variable': /\$[a-z_]\w*/i,
1567 'directive': {
1568 pattern: /@[a-z_]\w*/i,
1569 alias: 'function'
1570 },
1571 'attr-name': {
1572 pattern: /[a-z_]\w*(?=\s*(?:\((?:[^()"]|"(?:\\.|[^\\"\r\n])*")*\))?:)/i,
1573 greedy: true
1574 },
1575 'class-name': {
1576 pattern: /(\b(?:enum|implements|interface|on|scalar|type|union)\s+|&\s*)[a-zA-Z_]\w*/,
1577 lookbehind: true
1578 },
1579 'fragment': {
1580 pattern: /(\bfragment\s+|\.{3}\s*(?!on\b))[a-zA-Z_]\w*/,
1581 lookbehind: true,
1582 alias: 'function'
1583 },
1584 'keyword': /\b(?:directive|enum|extend|fragment|implements|input|interface|mutation|on|query|repeatable|scalar|schema|subscription|type|union)\b/,
1585 'operator': /[!=|&]|\.{3}/,
1586 'punctuation': /[!(){}\[\]:=,]/,
1587 'constant': /\b(?!ID\b)[A-Z][A-Z_\d]*\b/
1588};
1589/* "prismjs/components/prism-markup-templating" */
1590
1591(function (Prism) {
1592 /**
1593 * Returns the placeholder for the given language id and index.
1594 *
1595 * @param {string} language
1596 * @param {string|number} index
1597 * @returns {string}
1598 */
1599 function getPlaceholder(language, index) {
1600 return '___' + language.toUpperCase() + index + '___';
1601 }
1602
1603 Object.defineProperties(Prism.languages['markup-templating'] = {}, {
1604 buildPlaceholders: {
1605 /**
1606 * Tokenize all inline templating expressions matching `placeholderPattern`.
1607 *
1608 * If `replaceFilter` is provided, only matches of `placeholderPattern` for which `replaceFilter` returns
1609 * `true` will be replaced.
1610 *
1611 * @param {object} env The environment of the `before-tokenize` hook.
1612 * @param {string} language The language id.
1613 * @param {RegExp} placeholderPattern The matches of this pattern will be replaced by placeholders.
1614 * @param {(match: string) => boolean} [replaceFilter]
1615 */
1616 value: function (env, language, placeholderPattern, replaceFilter) {
1617 if (env.language !== language) {
1618 return;
1619 }
1620
1621 var tokenStack = env.tokenStack = [];
1622 env.code = env.code.replace(placeholderPattern, function (match) {
1623 if (typeof replaceFilter === 'function' && !replaceFilter(match)) {
1624 return match;
1625 }
1626
1627 var i = tokenStack.length;
1628 var placeholder; // Check for existing strings
1629
1630 while (env.code.indexOf(placeholder = getPlaceholder(language, i)) !== -1) {
1631 ++i;
1632 } // Create a sparse array
1633
1634
1635 tokenStack[i] = match;
1636 return placeholder;
1637 }); // Switch the grammar to markup
1638
1639 env.grammar = Prism.languages.markup;
1640 }
1641 },
1642 tokenizePlaceholders: {
1643 /**
1644 * Replace placeholders with proper tokens after tokenizing.
1645 *
1646 * @param {object} env The environment of the `after-tokenize` hook.
1647 * @param {string} language The language id.
1648 */
1649 value: function (env, language) {
1650 if (env.language !== language || !env.tokenStack) {
1651 return;
1652 } // Switch the grammar back
1653
1654
1655 env.grammar = Prism.languages[language];
1656 var j = 0;
1657 var keys = Object.keys(env.tokenStack);
1658
1659 function walkTokens(tokens) {
1660 for (var i = 0; i < tokens.length; i++) {
1661 // all placeholders are replaced already
1662 if (j >= keys.length) {
1663 break;
1664 }
1665
1666 var token = tokens[i];
1667
1668 if (typeof token === 'string' || token.content && typeof token.content === 'string') {
1669 var k = keys[j];
1670 var t = env.tokenStack[k];
1671 var s = typeof token === 'string' ? token : token.content;
1672 var placeholder = getPlaceholder(language, k);
1673 var index = s.indexOf(placeholder);
1674
1675 if (index > -1) {
1676 ++j;
1677 var before = s.substring(0, index);
1678 var middle = new Prism.Token(language, Prism.tokenize(t, env.grammar), 'language-' + language, t);
1679 var after = s.substring(index + placeholder.length);
1680 var replacement = [];
1681
1682 if (before) {
1683 replacement.push.apply(replacement, walkTokens([before]));
1684 }
1685
1686 replacement.push(middle);
1687
1688 if (after) {
1689 replacement.push.apply(replacement, walkTokens([after]));
1690 }
1691
1692 if (typeof token === 'string') {
1693 tokens.splice.apply(tokens, [i, 1].concat(replacement));
1694 } else {
1695 token.content = replacement;
1696 }
1697 }
1698 } else if (token.content
1699 /* && typeof token.content !== 'string' */
1700 ) {
1701 walkTokens(token.content);
1702 }
1703 }
1704
1705 return tokens;
1706 }
1707
1708 walkTokens(env.tokens);
1709 }
1710 }
1711 });
1712})(Prism);
1713/* "prismjs/components/prism-handlebars" */
1714
1715
1716(function (Prism) {
1717 Prism.languages.handlebars = {
1718 'comment': /\{\{![\s\S]*?\}\}/,
1719 'delimiter': {
1720 pattern: /^\{\{\{?|\}\}\}?$/i,
1721 alias: 'punctuation'
1722 },
1723 'string': /(["'])(?:\\.|(?!\1)[^\\\r\n])*\1/,
1724 'number': /\b0x[\dA-Fa-f]+\b|(?:\b\d+(?:\.\d*)?|\B\.\d+)(?:[Ee][+-]?\d+)?/,
1725 'boolean': /\b(?:true|false)\b/,
1726 'block': {
1727 pattern: /^(\s*(?:~\s*)?)[#\/]\S+?(?=\s*(?:~\s*)?$|\s)/i,
1728 lookbehind: true,
1729 alias: 'keyword'
1730 },
1731 'brackets': {
1732 pattern: /\[[^\]]+\]/,
1733 inside: {
1734 punctuation: /\[|\]/,
1735 variable: /[\s\S]+/
1736 }
1737 },
1738 'punctuation': /[!"#%&':()*+,.\/;<=>@\[\\\]^`{|}~]/,
1739 'variable': /[^!"#%&'()*+,\/;<=>@\[\\\]^`{|}~\s]+/
1740 };
1741 Prism.hooks.add('before-tokenize', function (env) {
1742 var handlebarsPattern = /\{\{\{[\s\S]+?\}\}\}|\{\{[\s\S]+?\}\}/g;
1743 Prism.languages['markup-templating'].buildPlaceholders(env, 'handlebars', handlebarsPattern);
1744 });
1745 Prism.hooks.add('after-tokenize', function (env) {
1746 Prism.languages['markup-templating'].tokenizePlaceholders(env, 'handlebars');
1747 });
1748})(Prism);
1749/* "prismjs/components/prism-json" */
1750// https://www.json.org/json-en.html
1751
1752
1753Prism.languages.json = {
1754 'property': {
1755 pattern: /"(?:\\.|[^\\"\r\n])*"(?=\s*:)/,
1756 greedy: true
1757 },
1758 'string': {
1759 pattern: /"(?:\\.|[^\\"\r\n])*"(?!\s*:)/,
1760 greedy: true
1761 },
1762 'comment': {
1763 pattern: /\/\/.*|\/\*[\s\S]*?(?:\*\/|$)/,
1764 greedy: true
1765 },
1766 'number': /-?\b\d+(?:\.\d+)?(?:e[+-]?\d+)?\b/i,
1767 'punctuation': /[{}[\],]/,
1768 'operator': /:/,
1769 'boolean': /\b(?:true|false)\b/,
1770 'null': {
1771 pattern: /\bnull\b/,
1772 alias: 'keyword'
1773 }
1774};
1775Prism.languages.webmanifest = Prism.languages.json;
1776/* "prismjs/components/prism-less" */
1777
1778/* FIXME :
1779 :extend() is not handled specifically : its highlighting is buggy.
1780 Mixin usage must be inside a ruleset to be highlighted.
1781 At-rules (e.g. import) containing interpolations are buggy.
1782 Detached rulesets are highlighted as at-rules.
1783 A comment before a mixin usage prevents the latter to be properly highlighted.
1784 */
1785
1786Prism.languages.less = Prism.languages.extend('css', {
1787 'comment': [/\/\*[\s\S]*?\*\//, {
1788 pattern: /(^|[^\\])\/\/.*/,
1789 lookbehind: true
1790 }],
1791 'atrule': {
1792 pattern: /@[\w-](?:\((?:[^(){}]|\([^(){}]*\))*\)|[^(){};\s]|\s+(?!\s))*?(?=\s*\{)/,
1793 inside: {
1794 'punctuation': /[:()]/
1795 }
1796 },
1797 // selectors and mixins are considered the same
1798 'selector': {
1799 pattern: /(?:@\{[\w-]+\}|[^{};\s@])(?:@\{[\w-]+\}|\((?:[^(){}]|\([^(){}]*\))*\)|[^(){};@\s]|\s+(?!\s))*?(?=\s*\{)/,
1800 inside: {
1801 // mixin parameters
1802 'variable': /@+[\w-]+/
1803 }
1804 },
1805 'property': /(?:@\{[\w-]+\}|[\w-])+(?:\+_?)?(?=\s*:)/i,
1806 'operator': /[+\-*\/]/
1807});
1808Prism.languages.insertBefore('less', 'property', {
1809 'variable': [// Variable declaration (the colon must be consumed!)
1810 {
1811 pattern: /@[\w-]+\s*:/,
1812 inside: {
1813 "punctuation": /:/
1814 }
1815 }, // Variable usage
1816 /@@?[\w-]+/],
1817 'mixin-usage': {
1818 pattern: /([{;]\s*)[.#](?!\d)[\w-].*?(?=[(;])/,
1819 lookbehind: true,
1820 alias: 'function'
1821 }
1822});
1823/* "prismjs/components/prism-makefile" */
1824
1825Prism.languages.makefile = {
1826 'comment': {
1827 pattern: /(^|[^\\])#(?:\\(?:\r\n|[\s\S])|[^\\\r\n])*/,
1828 lookbehind: true
1829 },
1830 'string': {
1831 pattern: /(["'])(?:\\(?:\r\n|[\s\S])|(?!\1)[^\\\r\n])*\1/,
1832 greedy: true
1833 },
1834 // Built-in target names
1835 'builtin': /\.[A-Z][^:#=\s]+(?=\s*:(?!=))/,
1836 // Targets
1837 'symbol': {
1838 pattern: /^(?:[^:=\s]|[ \t]+(?![\s:]))+(?=\s*:(?!=))/m,
1839 inside: {
1840 'variable': /\$+(?:(?!\$)[^(){}:#=\s]+|(?=[({]))/
1841 }
1842 },
1843 'variable': /\$+(?:(?!\$)[^(){}:#=\s]+|\([@*%<^+?][DF]\)|(?=[({]))/,
1844 'keyword': [// Directives
1845 /-include\b|\b(?:define|else|endef|endif|export|ifn?def|ifn?eq|include|override|private|sinclude|undefine|unexport|vpath)\b/, // Functions
1846 {
1847 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])/,
1848 lookbehind: true
1849 }],
1850 'operator': /(?:::|[?:+!])?=|[|@]/,
1851 'punctuation': /[:;(){}]/
1852};
1853/* "prismjs/components/prism-markdown" */
1854
1855(function (Prism) {
1856 // Allow only one line break
1857 var inner = /(?:\\.|[^\\\n\r]|(?:\n|\r\n?)(?!\n|\r\n?))/.source;
1858 /**
1859 * This function is intended for the creation of the bold or italic pattern.
1860 *
1861 * This also adds a lookbehind group to the given pattern to ensure that the pattern is not backslash-escaped.
1862 *
1863 * _Note:_ Keep in mind that this adds a capturing group.
1864 *
1865 * @param {string} pattern
1866 * @returns {RegExp}
1867 */
1868
1869 function createInline(pattern) {
1870 pattern = pattern.replace(/<inner>/g, function () {
1871 return inner;
1872 });
1873 return RegExp(/((?:^|[^\\])(?:\\{2})*)/.source + '(?:' + pattern + ')');
1874 }
1875
1876 var tableCell = /(?:\\.|``(?:[^`\r\n]|`(?!`))+``|`[^`\r\n]+`|[^\\|\r\n`])+/.source;
1877 var tableRow = /\|?__(?:\|__)+\|?(?:(?:\n|\r\n?)|(?![\s\S]))/.source.replace(/__/g, function () {
1878 return tableCell;
1879 });
1880 var tableLine = /\|?[ \t]*:?-{3,}:?[ \t]*(?:\|[ \t]*:?-{3,}:?[ \t]*)+\|?(?:\n|\r\n?)/.source;
1881 Prism.languages.markdown = Prism.languages.extend('markup', {});
1882 Prism.languages.insertBefore('markdown', 'prolog', {
1883 'front-matter-block': {
1884 pattern: /(^(?:\s*[\r\n])?)---(?!.)[\s\S]*?[\r\n]---(?!.)/,
1885 lookbehind: true,
1886 greedy: true,
1887 inside: {
1888 'punctuation': /^---|---$/,
1889 'font-matter': {
1890 pattern: /\S+(?:\s+\S+)*/,
1891 alias: ['yaml', 'language-yaml'],
1892 inside: Prism.languages.yaml
1893 }
1894 }
1895 },
1896 'blockquote': {
1897 // > ...
1898 pattern: /^>(?:[\t ]*>)*/m,
1899 alias: 'punctuation'
1900 },
1901 'table': {
1902 pattern: RegExp('^' + tableRow + tableLine + '(?:' + tableRow + ')*', 'm'),
1903 inside: {
1904 'table-data-rows': {
1905 pattern: RegExp('^(' + tableRow + tableLine + ')(?:' + tableRow + ')*$'),
1906 lookbehind: true,
1907 inside: {
1908 'table-data': {
1909 pattern: RegExp(tableCell),
1910 inside: Prism.languages.markdown
1911 },
1912 'punctuation': /\|/
1913 }
1914 },
1915 'table-line': {
1916 pattern: RegExp('^(' + tableRow + ')' + tableLine + '$'),
1917 lookbehind: true,
1918 inside: {
1919 'punctuation': /\||:?-{3,}:?/
1920 }
1921 },
1922 'table-header-row': {
1923 pattern: RegExp('^' + tableRow + '$'),
1924 inside: {
1925 'table-header': {
1926 pattern: RegExp(tableCell),
1927 alias: 'important',
1928 inside: Prism.languages.markdown
1929 },
1930 'punctuation': /\|/
1931 }
1932 }
1933 }
1934 },
1935 'code': [{
1936 // Prefixed by 4 spaces or 1 tab and preceded by an empty line
1937 pattern: /((?:^|\n)[ \t]*\n|(?:^|\r\n?)[ \t]*\r\n?)(?: {4}|\t).+(?:(?:\n|\r\n?)(?: {4}|\t).+)*/,
1938 lookbehind: true,
1939 alias: 'keyword'
1940 }, {
1941 // `code`
1942 // ``code``
1943 pattern: /``.+?``|`[^`\r\n]+`/,
1944 alias: 'keyword'
1945 }, {
1946 // ```optional language
1947 // code block
1948 // ```
1949 pattern: /^```[\s\S]*?^```$/m,
1950 greedy: true,
1951 inside: {
1952 'code-block': {
1953 pattern: /^(```.*(?:\n|\r\n?))[\s\S]+?(?=(?:\n|\r\n?)^```$)/m,
1954 lookbehind: true
1955 },
1956 'code-language': {
1957 pattern: /^(```).+/,
1958 lookbehind: true
1959 },
1960 'punctuation': /```/
1961 }
1962 }],
1963 'title': [{
1964 // title 1
1965 // =======
1966 // title 2
1967 // -------
1968 pattern: /\S.*(?:\n|\r\n?)(?:==+|--+)(?=[ \t]*$)/m,
1969 alias: 'important',
1970 inside: {
1971 punctuation: /==+$|--+$/
1972 }
1973 }, {
1974 // # title 1
1975 // ###### title 6
1976 pattern: /(^\s*)#.+/m,
1977 lookbehind: true,
1978 alias: 'important',
1979 inside: {
1980 punctuation: /^#+|#+$/
1981 }
1982 }],
1983 'hr': {
1984 // ***
1985 // ---
1986 // * * *
1987 // -----------
1988 pattern: /(^\s*)([*-])(?:[\t ]*\2){2,}(?=\s*$)/m,
1989 lookbehind: true,
1990 alias: 'punctuation'
1991 },
1992 'list': {
1993 // * item
1994 // + item
1995 // - item
1996 // 1. item
1997 pattern: /(^\s*)(?:[*+-]|\d+\.)(?=[\t ].)/m,
1998 lookbehind: true,
1999 alias: 'punctuation'
2000 },
2001 'url-reference': {
2002 // [id]: http://example.com "Optional title"
2003 // [id]: http://example.com 'Optional title'
2004 // [id]: http://example.com (Optional title)
2005 // [id]: <http://example.com> "Optional title"
2006 pattern: /!?\[[^\]]+\]:[\t ]+(?:\S+|<(?:\\.|[^>\\])+>)(?:[\t ]+(?:"(?:\\.|[^"\\])*"|'(?:\\.|[^'\\])*'|\((?:\\.|[^)\\])*\)))?/,
2007 inside: {
2008 'variable': {
2009 pattern: /^(!?\[)[^\]]+/,
2010 lookbehind: true
2011 },
2012 'string': /(?:"(?:\\.|[^"\\])*"|'(?:\\.|[^'\\])*'|\((?:\\.|[^)\\])*\))$/,
2013 'punctuation': /^[\[\]!:]|[<>]/
2014 },
2015 alias: 'url'
2016 },
2017 'bold': {
2018 // **strong**
2019 // __strong__
2020 // allow one nested instance of italic text using the same delimiter
2021 pattern: createInline(/\b__(?:(?!_)<inner>|_(?:(?!_)<inner>)+_)+__\b|\*\*(?:(?!\*)<inner>|\*(?:(?!\*)<inner>)+\*)+\*\*/.source),
2022 lookbehind: true,
2023 greedy: true,
2024 inside: {
2025 'content': {
2026 pattern: /(^..)[\s\S]+(?=..$)/,
2027 lookbehind: true,
2028 inside: {} // see below
2029
2030 },
2031 'punctuation': /\*\*|__/
2032 }
2033 },
2034 'italic': {
2035 // *em*
2036 // _em_
2037 // allow one nested instance of bold text using the same delimiter
2038 pattern: createInline(/\b_(?:(?!_)<inner>|__(?:(?!_)<inner>)+__)+_\b|\*(?:(?!\*)<inner>|\*\*(?:(?!\*)<inner>)+\*\*)+\*/.source),
2039 lookbehind: true,
2040 greedy: true,
2041 inside: {
2042 'content': {
2043 pattern: /(^.)[\s\S]+(?=.$)/,
2044 lookbehind: true,
2045 inside: {} // see below
2046
2047 },
2048 'punctuation': /[*_]/
2049 }
2050 },
2051 'strike': {
2052 // ~~strike through~~
2053 // ~strike~
2054 pattern: createInline(/(~~?)(?:(?!~)<inner>)+?\2/.source),
2055 lookbehind: true,
2056 greedy: true,
2057 inside: {
2058 'content': {
2059 pattern: /(^~~?)[\s\S]+(?=\1$)/,
2060 lookbehind: true,
2061 inside: {} // see below
2062
2063 },
2064 'punctuation': /~~?/
2065 }
2066 },
2067 'url': {
2068 // [example](http://example.com "Optional title")
2069 // [example][id]
2070 // [example] [id]
2071 pattern: createInline(/!?\[(?:(?!\])<inner>)+\](?:\([^\s)]+(?:[\t ]+"(?:\\.|[^"\\])*")?\)|[ \t]?\[(?:(?!\])<inner>)+\])/.source),
2072 lookbehind: true,
2073 greedy: true,
2074 inside: {
2075 'operator': /^!/,
2076 'content': {
2077 pattern: /(^\[)[^\]]+(?=\])/,
2078 lookbehind: true,
2079 inside: {} // see below
2080
2081 },
2082 'variable': {
2083 pattern: /(^\][ \t]?\[)[^\]]+(?=\]$)/,
2084 lookbehind: true
2085 },
2086 'url': {
2087 pattern: /(^\]\()[^\s)]+/,
2088 lookbehind: true
2089 },
2090 'string': {
2091 pattern: /(^[ \t]+)"(?:\\.|[^"\\])*"(?=\)$)/,
2092 lookbehind: true
2093 }
2094 }
2095 }
2096 });
2097 ['url', 'bold', 'italic', 'strike'].forEach(function (token) {
2098 ['url', 'bold', 'italic', 'strike'].forEach(function (inside) {
2099 if (token !== inside) {
2100 Prism.languages.markdown[token].inside.content.inside[inside] = Prism.languages.markdown[inside];
2101 }
2102 });
2103 });
2104 Prism.hooks.add('after-tokenize', function (env) {
2105 if (env.language !== 'markdown' && env.language !== 'md') {
2106 return;
2107 }
2108
2109 function walkTokens(tokens) {
2110 if (!tokens || typeof tokens === 'string') {
2111 return;
2112 }
2113
2114 for (var i = 0, l = tokens.length; i < l; i++) {
2115 var token = tokens[i];
2116
2117 if (token.type !== 'code') {
2118 walkTokens(token.content);
2119 continue;
2120 }
2121 /*
2122 * Add the correct `language-xxxx` class to this code block. Keep in mind that the `code-language` token
2123 * is optional. But the grammar is defined so that there is only one case we have to handle:
2124 *
2125 * token.content = [
2126 * <span class="punctuation">```</span>,
2127 * <span class="code-language">xxxx</span>,
2128 * '\n', // exactly one new lines (\r or \n or \r\n)
2129 * <span class="code-block">...</span>,
2130 * '\n', // exactly one new lines again
2131 * <span class="punctuation">```</span>
2132 * ];
2133 */
2134
2135
2136 var codeLang = token.content[1];
2137 var codeBlock = token.content[3];
2138
2139 if (codeLang && codeBlock && codeLang.type === 'code-language' && codeBlock.type === 'code-block' && typeof codeLang.content === 'string') {
2140 // this might be a language that Prism does not support
2141 // do some replacements to support C++, C#, and F#
2142 var lang = codeLang.content.replace(/\b#/g, 'sharp').replace(/\b\+\+/g, 'pp'); // only use the first word
2143
2144 lang = (/[a-z][\w-]*/i.exec(lang) || [''])[0].toLowerCase();
2145 var alias = 'language-' + lang; // add alias
2146
2147 if (!codeBlock.alias) {
2148 codeBlock.alias = [alias];
2149 } else if (typeof codeBlock.alias === 'string') {
2150 codeBlock.alias = [codeBlock.alias, alias];
2151 } else {
2152 codeBlock.alias.push(alias);
2153 }
2154 }
2155 }
2156 }
2157
2158 walkTokens(env.tokens);
2159 });
2160 Prism.hooks.add('wrap', function (env) {
2161 if (env.type !== 'code-block') {
2162 return;
2163 }
2164
2165 var codeLang = '';
2166
2167 for (var i = 0, l = env.classes.length; i < l; i++) {
2168 var cls = env.classes[i];
2169 var match = /language-(.+)/.exec(cls);
2170
2171 if (match) {
2172 codeLang = match[1];
2173 break;
2174 }
2175 }
2176
2177 var grammar = Prism.languages[codeLang];
2178
2179 if (!grammar) {
2180 if (codeLang && codeLang !== 'none' && Prism.plugins.autoloader) {
2181 var id = 'md-' + new Date().valueOf() + '-' + Math.floor(Math.random() * 1e16);
2182 env.attributes['id'] = id;
2183 Prism.plugins.autoloader.loadLanguages(codeLang, function () {
2184 var ele = document.getElementById(id);
2185
2186 if (ele) {
2187 ele.innerHTML = Prism.highlight(ele.textContent, Prism.languages[codeLang], codeLang);
2188 }
2189 });
2190 }
2191 } else {
2192 // reverse Prism.util.encode
2193 var code = env.content.replace(/&lt;/g, '<').replace(/&amp;/g, '&');
2194 env.content = Prism.highlight(code, grammar, codeLang);
2195 }
2196 });
2197 Prism.languages.md = Prism.languages.markdown;
2198})(Prism);
2199/* "prismjs/components/prism-objectivec" */
2200
2201
2202Prism.languages.objectivec = Prism.languages.extend('c', {
2203 'string': /("|')(?:\\(?:\r\n|[\s\S])|(?!\1)[^\\\r\n])*\1|@"(?:\\(?:\r\n|[\s\S])|[^"\\\r\n])*"/,
2204 '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/,
2205 'operator': /-[->]?|\+\+?|!=?|<<?=?|>>?=?|==?|&&?|\|\|?|[~^%?*\/@]/
2206});
2207delete Prism.languages.objectivec['class-name'];
2208Prism.languages.objc = Prism.languages.objectivec;
2209/* "prismjs/components/prism-ocaml" */
2210
2211Prism.languages.ocaml = {
2212 'comment': /\(\*[\s\S]*?\*\)/,
2213 'string': [{
2214 pattern: /"(?:\\.|[^\\\r\n"])*"/,
2215 greedy: true
2216 }, {
2217 pattern: /(['`])(?:\\(?:\d+|x[\da-f]+|.)|(?!\1)[^\\\r\n])\1/i,
2218 greedy: true
2219 }],
2220 'number': /\b(?:0x[\da-f][\da-f_]+|(?:0[bo])?\d[\d_]*(?:\.[\d_]*)?(?:e[+-]?[\d_]+)?)/i,
2221 'directive': {
2222 pattern: /\B#\w+/,
2223 alias: 'important'
2224 },
2225 'label': {
2226 pattern: /\B~\w+/,
2227 alias: 'function'
2228 },
2229 'type-variable': {
2230 pattern: /\B'\w+/,
2231 alias: 'function'
2232 },
2233 'variant': {
2234 pattern: /`\w+/,
2235 alias: 'variable'
2236 },
2237 'module': {
2238 pattern: /\b[A-Z]\w+/,
2239 alias: 'variable'
2240 },
2241 // For the list of keywords and operators,
2242 // see: http://caml.inria.fr/pub/docs/manual-ocaml/lex.html#sec84
2243 '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/,
2244 'boolean': /\b(?:false|true)\b/,
2245 // Custom operators are allowed
2246 'operator': /:=|[=<>@^|&+\-*\/$%!?~][!$%&*+\-.\/:<=>?@^|~]*|\b(?:and|asr|land|lor|lsl|lsr|lxor|mod|or)\b/,
2247 'punctuation': /[(){}\[\]|.,:;]|\b_\b/
2248};
2249/* "prismjs/components/prism-python" */
2250
2251Prism.languages.python = {
2252 'comment': {
2253 pattern: /(^|[^\\])#.*/,
2254 lookbehind: true
2255 },
2256 'string-interpolation': {
2257 pattern: /(?:f|rf|fr)(?:("""|''')[\s\S]*?\1|("|')(?:\\.|(?!\2)[^\\\r\n])*\2)/i,
2258 greedy: true,
2259 inside: {
2260 'interpolation': {
2261 // "{" <expression> <optional "!s", "!r", or "!a"> <optional ":" format specifier> "}"
2262 pattern: /((?:^|[^{])(?:{{)*){(?!{)(?:[^{}]|{(?!{)(?:[^{}]|{(?!{)(?:[^{}])+})+})+}/,
2263 lookbehind: true,
2264 inside: {
2265 'format-spec': {
2266 pattern: /(:)[^:(){}]+(?=}$)/,
2267 lookbehind: true
2268 },
2269 'conversion-option': {
2270 pattern: /![sra](?=[:}]$)/,
2271 alias: 'punctuation'
2272 },
2273 rest: null
2274 }
2275 },
2276 'string': /[\s\S]+/
2277 }
2278 },
2279 'triple-quoted-string': {
2280 pattern: /(?:[rub]|rb|br)?("""|''')[\s\S]*?\1/i,
2281 greedy: true,
2282 alias: 'string'
2283 },
2284 'string': {
2285 pattern: /(?:[rub]|rb|br)?("|')(?:\\.|(?!\1)[^\\\r\n])*\1/i,
2286 greedy: true
2287 },
2288 'function': {
2289 pattern: /((?:^|\s)def[ \t]+)[a-zA-Z_]\w*(?=\s*\()/g,
2290 lookbehind: true
2291 },
2292 'class-name': {
2293 pattern: /(\bclass\s+)\w+/i,
2294 lookbehind: true
2295 },
2296 'decorator': {
2297 pattern: /(^\s*)@\w+(?:\.\w+)*/im,
2298 lookbehind: true,
2299 alias: ['annotation', 'punctuation'],
2300 inside: {
2301 'punctuation': /\./
2302 }
2303 },
2304 '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/,
2305 '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/,
2306 'boolean': /\b(?:True|False|None)\b/,
2307 'number': /(?:\b(?=\d)|\B(?=\.))(?:0[bo])?(?:(?:\d|0x[\da-f])[\da-f]*(?:\.\d*)?|\.\d+)(?:e[+-]?\d+)?j?\b/i,
2308 'operator': /[-+%=]=?|!=|\*\*?=?|\/\/?=?|<[<=>]?|>[=>]?|[&|^~]/,
2309 'punctuation': /[{}[\];(),.:]/
2310};
2311Prism.languages.python['string-interpolation'].inside['interpolation'].inside.rest = Prism.languages.python;
2312Prism.languages.py = Prism.languages.python;
2313/* "prismjs/components/prism-reason" */
2314
2315Prism.languages.reason = Prism.languages.extend('clike', {
2316 'string': {
2317 pattern: /"(?:\\(?:\r\n|[\s\S])|[^\\\r\n"])*"/,
2318 greedy: true
2319 },
2320 // 'class-name' must be matched *after* 'constructor' defined below
2321 'class-name': /\b[A-Z]\w*/,
2322 '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/,
2323 'operator': /\.{3}|:[:=]|\|>|->|=(?:==?|>)?|<=?|>=?|[|^?'#!~`]|[+\-*\/]\.?|\b(?:mod|land|lor|lxor|lsl|lsr|asr)\b/
2324});
2325Prism.languages.insertBefore('reason', 'class-name', {
2326 'character': {
2327 pattern: /'(?:\\x[\da-f]{2}|\\o[0-3][0-7][0-7]|\\\d{3}|\\.|[^'\\\r\n])'/,
2328 alias: 'string'
2329 },
2330 'constructor': {
2331 // Negative look-ahead prevents from matching things like String.capitalize
2332 pattern: /\b[A-Z]\w*\b(?!\s*\.)/,
2333 alias: 'variable'
2334 },
2335 'label': {
2336 pattern: /\b[a-z]\w*(?=::)/,
2337 alias: 'symbol'
2338 }
2339}); // We can't match functions property, so let's not even try.
2340
2341delete Prism.languages.reason.function;
2342/* "prismjs/components/prism-sass" */
2343
2344(function (Prism) {
2345 Prism.languages.sass = Prism.languages.extend('css', {
2346 // Sass comments don't need to be closed, only indented
2347 'comment': {
2348 pattern: /^([ \t]*)\/[\/*].*(?:(?:\r?\n|\r)\1[ \t].+)*/m,
2349 lookbehind: true
2350 }
2351 });
2352 Prism.languages.insertBefore('sass', 'atrule', {
2353 // We want to consume the whole line
2354 'atrule-line': {
2355 // Includes support for = and + shortcuts
2356 pattern: /^(?:[ \t]*)[@+=].+/m,
2357 inside: {
2358 'atrule': /(?:@[\w-]+|[+=])/m
2359 }
2360 }
2361 });
2362 delete Prism.languages.sass.atrule;
2363 var variable = /\$[-\w]+|#\{\$[-\w]+\}/;
2364 var operator = [/[+*\/%]|[=!]=|<=?|>=?|\b(?:and|or|not)\b/, {
2365 pattern: /(\s+)-(?=\s)/,
2366 lookbehind: true
2367 }];
2368 Prism.languages.insertBefore('sass', 'property', {
2369 // We want to consume the whole line
2370 'variable-line': {
2371 pattern: /^[ \t]*\$.+/m,
2372 inside: {
2373 'punctuation': /:/,
2374 'variable': variable,
2375 'operator': operator
2376 }
2377 },
2378 // We want to consume the whole line
2379 'property-line': {
2380 pattern: /^[ \t]*(?:[^:\s]+ *:.*|:[^:\s].*)/m,
2381 inside: {
2382 'property': [/[^:\s]+(?=\s*:)/, {
2383 pattern: /(:)[^:\s]+/,
2384 lookbehind: true
2385 }],
2386 'punctuation': /:/,
2387 'variable': variable,
2388 'operator': operator,
2389 'important': Prism.languages.sass.important
2390 }
2391 }
2392 });
2393 delete Prism.languages.sass.property;
2394 delete Prism.languages.sass.important; // Now that whole lines for other patterns are consumed,
2395 // what's left should be selectors
2396
2397 Prism.languages.insertBefore('sass', 'punctuation', {
2398 'selector': {
2399 pattern: /([ \t]*)\S(?:,[^,\r\n]+|[^,\r\n]*)(?:,[^,\r\n]+)*(?:,(?:\r?\n|\r)\1[ \t]+\S(?:,[^,\r\n]+|[^,\r\n]*)(?:,[^,\r\n]+)*)*/,
2400 lookbehind: true
2401 }
2402 });
2403})(Prism);
2404/* "prismjs/components/prism-scss" */
2405
2406
2407Prism.languages.scss = Prism.languages.extend('css', {
2408 'comment': {
2409 pattern: /(^|[^\\])(?:\/\*[\s\S]*?\*\/|\/\/.*)/,
2410 lookbehind: true
2411 },
2412 'atrule': {
2413 pattern: /@[\w-](?:\([^()]+\)|[^()\s]|\s+(?!\s))*?(?=\s+[{;])/,
2414 inside: {
2415 'rule': /@[\w-]+/ // See rest below
2416
2417 }
2418 },
2419 // url, compassified
2420 'url': /(?:[-a-z]+-)?url(?=\()/i,
2421 // CSS selector regex is not appropriate for Sass
2422 // since there can be lot more things (var, @ directive, nesting..)
2423 // a selector must start at the end of a property or after a brace (end of other rules or nesting)
2424 // it can contain some characters that aren't used for defining rules or end of selector, & (parent selector), or interpolated variable
2425 // 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
2426 // can "pass" as a selector- e.g: proper#{$erty})
2427 // this one was hard to do, so please be careful if you edit this one :)
2428 'selector': {
2429 // Initial look-ahead is used to prevent matching of blank selectors
2430 pattern: /(?=\S)[^@;{}()]?(?:[^@;{}()\s]|\s+(?!\s)|#\{\$[-\w]+\})+(?=\s*\{(?:\}|\s|[^}][^:{}]*[:{][^}]+))/m,
2431 inside: {
2432 'parent': {
2433 pattern: /&/,
2434 alias: 'important'
2435 },
2436 'placeholder': /%[-\w]+/,
2437 'variable': /\$[-\w]+|#\{\$[-\w]+\}/
2438 }
2439 },
2440 'property': {
2441 pattern: /(?:[-\w]|\$[-\w]|#\{\$[-\w]+\})+(?=\s*:)/,
2442 inside: {
2443 'variable': /\$[-\w]+|#\{\$[-\w]+\}/
2444 }
2445 }
2446});
2447Prism.languages.insertBefore('scss', 'atrule', {
2448 'keyword': [/@(?:if|else(?: if)?|forward|for|each|while|import|use|extend|debug|warn|mixin|include|function|return|content)\b/i, {
2449 pattern: /( +)(?:from|through)(?= )/,
2450 lookbehind: true
2451 }]
2452});
2453Prism.languages.insertBefore('scss', 'important', {
2454 // var and interpolated vars
2455 'variable': /\$[-\w]+|#\{\$[-\w]+\}/
2456});
2457Prism.languages.insertBefore('scss', 'function', {
2458 'module-modifier': {
2459 pattern: /\b(?:as|with|show|hide)\b/i,
2460 alias: 'keyword'
2461 },
2462 'placeholder': {
2463 pattern: /%[-\w]+/,
2464 alias: 'selector'
2465 },
2466 'statement': {
2467 pattern: /\B!(?:default|optional)\b/i,
2468 alias: 'keyword'
2469 },
2470 'boolean': /\b(?:true|false)\b/,
2471 'null': {
2472 pattern: /\bnull\b/,
2473 alias: 'keyword'
2474 },
2475 'operator': {
2476 pattern: /(\s)(?:[-+*\/%]|[=!]=|<=?|>=?|and|or|not)(?=\s)/,
2477 lookbehind: true
2478 }
2479});
2480Prism.languages.scss['atrule'].inside.rest = Prism.languages.scss;
2481/* "prismjs/components/prism-sql" */
2482
2483Prism.languages.sql = {
2484 'comment': {
2485 pattern: /(^|[^\\])(?:\/\*[\s\S]*?\*\/|(?:--|\/\/|#).*)/,
2486 lookbehind: true
2487 },
2488 'variable': [{
2489 pattern: /@(["'`])(?:\\[\s\S]|(?!\1)[^\\])+\1/,
2490 greedy: true
2491 }, /@[\w.$]+/],
2492 'string': {
2493 pattern: /(^|[^@\\])("|')(?:\\[\s\S]|(?!\2)[^\\]|\2\2)*\2/,
2494 greedy: true,
2495 lookbehind: true
2496 },
2497 'function': /\b(?:AVG|COUNT|FIRST|FORMAT|LAST|LCASE|LEN|MAX|MID|MIN|MOD|NOW|ROUND|SUM|UCASE)(?=\s*\()/i,
2498 // Should we highlight user defined functions too?
2499 '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,
2500 'boolean': /\b(?:TRUE|FALSE|NULL)\b/i,
2501 'number': /\b0x[\da-f]+\b|\b\d+(?:\.\d*)?|\B\.\d+\b/i,
2502 'operator': /[-+*\/=%^~]|&&?|\|\|?|!=?|<(?:=>?|<|>)?|>[>=]?|\b(?:AND|BETWEEN|IN|LIKE|NOT|OR|IS|DIV|REGEXP|RLIKE|SOUNDS LIKE|XOR)\b/i,
2503 'punctuation': /[;[\]()`,.]/
2504};
2505/* "prismjs/components/prism-stylus" */
2506
2507(function (Prism) {
2508 var unit = {
2509 pattern: /(\b\d+)(?:%|[a-z]+)/,
2510 lookbehind: true
2511 }; // 123 -123 .123 -.123 12.3 -12.3
2512
2513 var number = {
2514 pattern: /(^|[^\w.-])-?(?:\d+(?:\.\d+)?|\.\d+)/,
2515 lookbehind: true
2516 };
2517 var inside = {
2518 'comment': {
2519 pattern: /(^|[^\\])(?:\/\*[\s\S]*?\*\/|\/\/.*)/,
2520 lookbehind: true
2521 },
2522 'url': {
2523 pattern: /url\((["']?).*?\1\)/i,
2524 greedy: true
2525 },
2526 'string': {
2527 pattern: /("|')(?:(?!\1)[^\\\r\n]|\\(?:\r\n|[\s\S]))*\1/,
2528 greedy: true
2529 },
2530 'interpolation': null,
2531 // See below
2532 'func': null,
2533 // See below
2534 'important': /\B!(?:important|optional)\b/i,
2535 'keyword': {
2536 pattern: /(^|\s+)(?:(?:if|else|for|return|unless)(?=\s+|$)|@[\w-]+)/,
2537 lookbehind: true
2538 },
2539 'hexcode': /#[\da-f]{3,6}/i,
2540 '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, {
2541 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,
2542 inside: {
2543 'unit': unit,
2544 'number': number,
2545 'function': /[\w-]+(?=\()/,
2546 'punctuation': /[(),]/
2547 }
2548 }],
2549 'entity': /\\[\da-f]{1,8}/i,
2550 'unit': unit,
2551 'boolean': /\b(?:true|false)\b/,
2552 'operator': [// We want non-word chars around "-" because it is
2553 // accepted in property names.
2554 /~|[+!\/%<>?=]=?|[-:]=|\*[*=]?|\.{2,3}|&&|\|\||\B-\B|\b(?:and|in|is(?: a| defined| not|nt)?|not|or)\b/],
2555 'number': number,
2556 'punctuation': /[{}()\[\];:,]/
2557 };
2558 inside['interpolation'] = {
2559 pattern: /\{[^\r\n}:]+\}/,
2560 alias: 'variable',
2561 inside: {
2562 'delimiter': {
2563 pattern: /^{|}$/,
2564 alias: 'punctuation'
2565 },
2566 rest: inside
2567 }
2568 };
2569 inside['func'] = {
2570 pattern: /[\w-]+\([^)]*\).*/,
2571 inside: {
2572 'function': /^[^(]+/,
2573 rest: inside
2574 }
2575 };
2576 Prism.languages.stylus = {
2577 'atrule-declaration': {
2578 pattern: /(^\s*)@.+/m,
2579 lookbehind: true,
2580 inside: {
2581 'atrule': /^@[\w-]+/,
2582 rest: inside
2583 }
2584 },
2585 'variable-declaration': {
2586 pattern: /(^[ \t]*)[\w$-]+\s*.?=[ \t]*(?:\{[^{}]*\}|\S.*|$)/m,
2587 lookbehind: true,
2588 inside: {
2589 'variable': /^\S+/,
2590 rest: inside
2591 }
2592 },
2593 'statement': {
2594 pattern: /(^[ \t]*)(?:if|else|for|return|unless)[ \t].+/m,
2595 lookbehind: true,
2596 inside: {
2597 'keyword': /^\S+/,
2598 rest: inside
2599 }
2600 },
2601 // A property/value pair cannot end with a comma or a brace
2602 // It cannot have indented content unless it ended with a semicolon
2603 'property-declaration': {
2604 pattern: /((?:^|\{)([ \t]*))(?:[\w-]|\{[^}\r\n]+\})+(?:\s*:\s*|[ \t]+)(?!\s)[^{\r\n]*(?:;|[^{\r\n,](?=$)(?!(?:\r?\n|\r)(?:\{|\2[ \t]+)))/m,
2605 lookbehind: true,
2606 inside: {
2607 'property': {
2608 pattern: /^[^\s:]+/,
2609 inside: {
2610 'interpolation': inside.interpolation
2611 }
2612 },
2613 rest: inside
2614 }
2615 },
2616 // A selector can contain parentheses only as part of a pseudo-element
2617 // It can span multiple lines.
2618 // It must end with a comma or an accolade or have indented content.
2619 'selector': {
2620 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,
2621 lookbehind: true,
2622 inside: {
2623 'interpolation': inside.interpolation,
2624 'comment': inside.comment,
2625 'punctuation': /[{},]/
2626 }
2627 },
2628 'func': inside.func,
2629 'string': inside.string,
2630 'comment': {
2631 pattern: /(^|[^\\])(?:\/\*[\s\S]*?\*\/|\/\/.*)/,
2632 lookbehind: true,
2633 greedy: true
2634 },
2635 'interpolation': inside.interpolation,
2636 'punctuation': /[{}()\[\];:.]/
2637 };
2638})(Prism);
2639/* "prismjs/components/prism-typescript" */
2640
2641
2642(function (Prism) {
2643 Prism.languages.typescript = Prism.languages.extend('javascript', {
2644 'class-name': {
2645 pattern: /(\b(?:class|extends|implements|instanceof|interface|new|type)\s+)(?!keyof\b)(?!\s)[_$a-zA-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*(?:\s*<(?:[^<>]|<(?:[^<>]|<[^<>]*>)*>)*>)?/,
2646 lookbehind: true,
2647 greedy: true,
2648 inside: null // see below
2649
2650 },
2651 // From JavaScript Prism keyword list and TypeScript language spec: https://github.com/Microsoft/TypeScript/blob/master/doc/spec.md#221-reserved-words
2652 '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/,
2653 'builtin': /\b(?:string|Function|any|number|boolean|Array|symbol|console|Promise|unknown|never)\b/
2654 }); // doesn't work with TS because TS is too complex
2655
2656 delete Prism.languages.typescript['parameter']; // a version of typescript specifically for highlighting types
2657
2658 var typeInside = Prism.languages.extend('typescript', {});
2659 delete typeInside['class-name'];
2660 Prism.languages.typescript['class-name'].inside = typeInside;
2661 Prism.languages.insertBefore('typescript', 'function', {
2662 'generic-function': {
2663 // e.g. foo<T extends "bar" | "baz">( ...
2664 pattern: /#?(?!\s)[_$a-zA-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*\s*<(?:[^<>]|<(?:[^<>]|<[^<>]*>)*>)*>(?=\s*\()/,
2665 greedy: true,
2666 inside: {
2667 'function': /^#?(?!\s)[_$a-zA-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*/,
2668 'generic': {
2669 pattern: /<[\s\S]+/,
2670 // everything after the first <
2671 alias: 'class-name',
2672 inside: typeInside
2673 }
2674 }
2675 }
2676 });
2677 Prism.languages.ts = Prism.languages.typescript;
2678})(Prism);
2679/* "prismjs/components/prism-tsx" */
2680
2681
2682(function (Prism) {
2683 var typescript = Prism.util.clone(Prism.languages.typescript);
2684 Prism.languages.tsx = Prism.languages.extend('jsx', typescript); // This will prevent collisions between TSX tags and TS generic types.
2685 // Idea by https://github.com/karlhorky
2686 // Discussion: https://github.com/PrismJS/prism/issues/2594#issuecomment-710666928
2687
2688 var tag = Prism.languages.tsx.tag;
2689 tag.pattern = RegExp(/(^|[^\w$]|(?=<\/))/.source + '(?:' + tag.pattern.source + ')', tag.pattern.flags);
2690 tag.lookbehind = true;
2691})(Prism);
2692/* "prismjs/components/prism-wasm" */
2693
2694
2695Prism.languages.wasm = {
2696 'comment': [/\(;[\s\S]*?;\)/, {
2697 pattern: /;;.*/,
2698 greedy: true
2699 }],
2700 'string': {
2701 pattern: /"(?:\\[\s\S]|[^"\\])*"/,
2702 greedy: true
2703 },
2704 'keyword': [{
2705 pattern: /\b(?:align|offset)=/,
2706 inside: {
2707 'operator': /=/
2708 }
2709 }, {
2710 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/,
2711 inside: {
2712 'punctuation': /\./
2713 }
2714 }, /\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/],
2715 'variable': /\$[\w!#$%&'*+\-./:<=>?@\\^_`|~]+/i,
2716 '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/,
2717 'punctuation': /[()]/
2718};
2719/* "prismjs/components/prism-yaml" */
2720
2721(function (Prism) {
2722 // https://yaml.org/spec/1.2/spec.html#c-ns-anchor-property
2723 // https://yaml.org/spec/1.2/spec.html#c-ns-alias-node
2724 var anchorOrAlias = /[*&][^\s[\]{},]+/; // https://yaml.org/spec/1.2/spec.html#c-ns-tag-property
2725
2726 var tag = /!(?:<[\w\-%#;/?:@&=+$,.!~*'()[\]]+>|(?:[a-zA-Z\d-]*!)?[\w\-%#;/?:@&=+$.~*'()]+)?/; // https://yaml.org/spec/1.2/spec.html#c-ns-properties(n,c)
2727
2728 var properties = '(?:' + tag.source + '(?:[ \t]+' + anchorOrAlias.source + ')?|' + anchorOrAlias.source + '(?:[ \t]+' + tag.source + ')?)'; // https://yaml.org/spec/1.2/spec.html#ns-plain(n,c)
2729 // This is a simplified version that doesn't support "#" and multiline keys
2730 // All these long scarry character classes are simplified versions of YAML's characters
2731
2732 var plainKey = /(?:[^\s\x00-\x08\x0e-\x1f!"#%&'*,\-:>?@[\]`{|}\x7f-\x84\x86-\x9f\ud800-\udfff\ufffe\uffff]|[?:-]<PLAIN>)(?:[ \t]*(?:(?![#:])<PLAIN>|:<PLAIN>))*/.source.replace(/<PLAIN>/g, function () {
2733 return /[^\s\x00-\x08\x0e-\x1f,[\]{}\x7f-\x84\x86-\x9f\ud800-\udfff\ufffe\uffff]/.source;
2734 });
2735 var string = /"(?:[^"\\\r\n]|\\.)*"|'(?:[^'\\\r\n]|\\.)*'/.source;
2736 /**
2737 *
2738 * @param {string} value
2739 * @param {string} [flags]
2740 * @returns {RegExp}
2741 */
2742
2743 function createValuePattern(value, flags) {
2744 flags = (flags || '').replace(/m/g, '') + 'm'; // add m flag
2745
2746 var pattern = /([:\-,[{]\s*(?:\s<<prop>>[ \t]+)?)(?:<<value>>)(?=[ \t]*(?:$|,|]|}|(?:[\r\n]\s*)?#))/.source.replace(/<<prop>>/g, function () {
2747 return properties;
2748 }).replace(/<<value>>/g, function () {
2749 return value;
2750 });
2751 return RegExp(pattern, flags);
2752 }
2753
2754 Prism.languages.yaml = {
2755 'scalar': {
2756 pattern: RegExp(/([\-:]\s*(?:\s<<prop>>[ \t]+)?[|>])[ \t]*(?:((?:\r?\n|\r)[ \t]+)\S[^\r\n]*(?:\2[^\r\n]+)*)/.source.replace(/<<prop>>/g, function () {
2757 return properties;
2758 })),
2759 lookbehind: true,
2760 alias: 'string'
2761 },
2762 'comment': /#.*/,
2763 'key': {
2764 pattern: RegExp(/((?:^|[:\-,[{\r\n?])[ \t]*(?:<<prop>>[ \t]+)?)<<key>>(?=\s*:\s)/.source.replace(/<<prop>>/g, function () {
2765 return properties;
2766 }).replace(/<<key>>/g, function () {
2767 return '(?:' + plainKey + '|' + string + ')';
2768 })),
2769 lookbehind: true,
2770 greedy: true,
2771 alias: 'atrule'
2772 },
2773 'directive': {
2774 pattern: /(^[ \t]*)%.+/m,
2775 lookbehind: true,
2776 alias: 'important'
2777 },
2778 'datetime': {
2779 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),
2780 lookbehind: true,
2781 alias: 'number'
2782 },
2783 'boolean': {
2784 pattern: createValuePattern(/true|false/.source, 'i'),
2785 lookbehind: true,
2786 alias: 'important'
2787 },
2788 'null': {
2789 pattern: createValuePattern(/null|~/.source, 'i'),
2790 lookbehind: true,
2791 alias: 'important'
2792 },
2793 'string': {
2794 pattern: createValuePattern(string),
2795 lookbehind: true,
2796 greedy: true
2797 },
2798 'number': {
2799 pattern: createValuePattern(/[+-]?(?:0x[\da-f]+|0o[0-7]+|(?:\d+(?:\.\d*)?|\.?\d+)(?:e[+-]?\d+)?|\.inf|\.nan)/.source, 'i'),
2800 lookbehind: true
2801 },
2802 'tag': tag,
2803 'important': anchorOrAlias,
2804 'punctuation': /---|[:[\]{}\-,|>?]|\.\.\./
2805 };
2806 Prism.languages.yml = Prism.languages.yaml;
2807})(Prism);
2808
2809module.exports = Prism;