vendor: 1,373 bytes, lines 1-30
1var __create = Object.create; 2var __defProp = Object.defineProperty; 3var __getOwnPropDesc = Object.getOwnPropertyDescriptor; 4var __getOwnPropNames = Object.getOwnPropertyNames; 5var __getProtoOf = Object.getPrototypeOf; 6var __hasOwnProp = Object.prototype.hasOwnProperty; 7var __commonJS = (cb, mod) => function __require() { 8 try { 9 return mod || (0, cb[__getOwnPropNames(cb)[0]])((mod = { exports: {} }).exports, mod), mod.exports; 10 } catch (e) { 11 throw mod = 0, e; 12 } 13}; 14var __copyProps = (to, from, except, desc) => { 15 if (from && typeof from === "object" || typeof from === "function") { 16 for (let key of __getOwnPropNames(from)) 17 if (!__hasOwnProp.call(to, key) && key !== except) 18 __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable }); 19 } 20 return to; 21}; 22var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps( 23 // If the importer is in node compatibility mode or this is not an ESM 24 // file that has been converted to a CommonJS file using a Babel- 25 // compatible transform (i.e. "__esModule" has not been set), then set 26 // "default" to the CommonJS "module.exports" for node compatibility. 27 isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target, 28 mod 29)); 30
vendor: 51,107 bytes, lines 31-1568
31// node_modules/highlight.js/lib/core.js 32var require_core = __commonJS({ 33 "node_modules/highlight.js/lib/core.js"(exports, module) { 34 function deepFreeze(obj) { 35 if (obj instanceof Map) { 36 obj.clear = obj.delete = obj.set = function() { 37 throw new Error("map is read-only"); 38 }; 39 } else if (obj instanceof Set) { 40 obj.add = obj.clear = obj.delete = function() { 41 throw new Error("set is read-only"); 42 }; 43 } 44 Object.freeze(obj); 45 Object.getOwnPropertyNames(obj).forEach((name) => { 46 const prop = obj[name]; 47 const type = typeof prop; 48 if ((type === "object" || type === "function") && !Object.isFrozen(prop)) { 49 deepFreeze(prop); 50 } 51 }); 52 return obj; 53 } 54 var Response = class { 55 /** 56 * @param {CompiledMode} mode 57 */ 58 constructor(mode) { 59 if (mode.data === void 0) mode.data = {}; 60 this.data = mode.data; 61 this.isMatchIgnored = false; 62 } 63 ignoreMatch() { 64 this.isMatchIgnored = true; 65 } 66 }; 67 function escapeHTML(value) { 68 return value.replace(/&/g, "&").replace(/</g, "<").replace(/>/g, ">").replace(/"/g, """).replace(/'/g, "'"); 69 } 70 function inherit$1(original, ...objects) { 71 const result = /* @__PURE__ */ Object.create(null); 72 for (const key in original) { 73 result[key] = original[key]; 74 } 75 objects.forEach(function(obj) { 76 for (const key in obj) { 77 result[key] = obj[key]; 78 } 79 }); 80 return ( 81 /** @type {T} */ 82 result 83 ); 84 } 85 var SPAN_CLOSE = "</span>"; 86 var emitsWrappingTags = (node) => { 87 return !!node.scope; 88 }; 89 var scopeToCSSClass = (name, { prefix }) => { 90 if (name.startsWith("language:")) { 91 return name.replace("language:", "language-"); 92 } 93 if (name.includes(".")) { 94 const pieces = name.split("."); 95 return [ 96 `${prefix}${pieces.shift()}`, 97 ...pieces.map((x, i) => `${x}${"_".repeat(i + 1)}`) 98 ].join(" "); 99 } 100 return `${prefix}${name}`; 101 }; 102 var HTMLRenderer = class { 103 /** 104 * Creates a new HTMLRenderer 105 * 106 * @param {Tree} parseTree - the parse tree (must support `walk` API) 107 * @param {{classPrefix: string}} options 108 */ 109 constructor(parseTree, options) { 110 this.buffer = ""; 111 this.classPrefix = options.classPrefix; 112 parseTree.walk(this); 113 } 114 /** 115 * Adds texts to the output stream 116 * 117 * @param {string} text */ 118 addText(text) { 119 this.buffer += escapeHTML(text); 120 } 121 /** 122 * Adds a node open to the output stream (if needed) 123 * 124 * @param {Node} node */ 125 openNode(node) { 126 if (!emitsWrappingTags(node)) return; 127 const className = scopeToCSSClass( 128 node.scope, 129 { prefix: this.classPrefix } 130 ); 131 this.span(className); 132 } 133 /** 134 * Adds a node close to the output stream (if needed) 135 * 136 * @param {Node} node */ 137 closeNode(node) { 138 if (!emitsWrappingTags(node)) return; 139 this.buffer += SPAN_CLOSE; 140 } 141 /** 142 * returns the accumulated buffer 143 */ 144 value() { 145 return this.buffer; 146 } 147 // helpers 148 /** 149 * Builds a span element 150 * 151 * @param {string} className */ 152 span(className) { 153 this.buffer += `<span class="${className}">`; 154 } 155 }; 156 var newNode = (opts = {}) => { 157 const result = { children: [] }; 158 Object.assign(result, opts); 159 return result; 160 }; 161 var TokenTree = class _TokenTree { 162 constructor() { 163 this.rootNode = newNode(); 164 this.stack = [this.rootNode]; 165 } 166 get top() { 167 return this.stack[this.stack.length - 1]; 168 } 169 get root() { 170 return this.rootNode; 171 } 172 /** @param {Node} node */ 173 add(node) { 174 this.top.children.push(node); 175 } 176 /** @param {string} scope */ 177 openNode(scope) { 178 const node = newNode({ scope }); 179 this.add(node); 180 this.stack.push(node); 181 } 182 closeNode() { 183 if (this.stack.length > 1) { 184 return this.stack.pop(); 185 } 186 return void 0; 187 } 188 closeAllNodes() { 189 while (this.closeNode()) ; 190 } 191 toJSON() { 192 return JSON.stringify(this.rootNode, null, 4); 193 } 194 /** 195 * @typedef { import("./html_renderer").Renderer } Renderer 196 * @param {Renderer} builder 197 */ 198 walk(builder) { 199 return this.constructor._walk(builder, this.rootNode); 200 } 201 /** 202 * @param {Renderer} builder 203 * @param {Node} node 204 */ 205 static _walk(builder, node) { 206 if (typeof node === "string") { 207 builder.addText(node); 208 } else if (node.children) { 209 builder.openNode(node); 210 node.children.forEach((child) => this._walk(builder, child)); 211 builder.closeNode(node); 212 } 213 return builder; 214 } 215 /** 216 * @param {Node} node 217 */ 218 static _collapse(node) { 219 if (typeof node === "string") return; 220 if (!node.children) return; 221 if (node.children.every((el) => typeof el === "string")) { 222 node.children = [node.children.join("")]; 223 } else { 224 node.children.forEach((child) => { 225 _TokenTree._collapse(child); 226 }); 227 } 228 } 229 }; 230 var TokenTreeEmitter = class extends TokenTree { 231 /** 232 * @param {*} options 233 */ 234 constructor(options) { 235 super(); 236 this.options = options; 237 } 238 /** 239 * @param {string} text 240 */ 241 addText(text) { 242 if (text === "") { 243 return; 244 } 245 this.add(text); 246 } 247 /** @param {string} scope */ 248 startScope(scope) { 249 this.openNode(scope); 250 } 251 endScope() { 252 this.closeNode(); 253 } 254 /** 255 * @param {Emitter & {root: DataNode}} emitter 256 * @param {string} name 257 */ 258 __addSublanguage(emitter, name) { 259 const node = emitter.root; 260 if (name) node.scope = `language:${name}`; 261 this.add(node); 262 } 263 toHTML() { 264 const renderer = new HTMLRenderer(this, this.options); 265 return renderer.value(); 266 } 267 finalize() { 268 this.closeAllNodes(); 269 return true; 270 } 271 }; 272 function source(re) { 273 if (!re) return null; 274 if (typeof re === "string") return re; 275 return re.source; 276 } 277 function lookahead(re) { 278 return concat("(?=", re, ")"); 279 } 280 function anyNumberOfTimes(re) { 281 return concat("(?:", re, ")*"); 282 } 283 function optional(re) { 284 return concat("(?:", re, ")?"); 285 } 286 function concat(...args) { 287 const joined = args.map((x) => source(x)).join(""); 288 return joined; 289 } 290 function stripOptionsFromArgs(args) { 291 const opts = args[args.length - 1]; 292 if (typeof opts === "object" && opts.constructor === Object) { 293 args.splice(args.length - 1, 1); 294 return opts; 295 } else { 296 return {}; 297 } 298 } 299 function either(...args) { 300 const opts = stripOptionsFromArgs(args); 301 const joined = "(" + (opts.capture ? "" : "?:") + args.map((x) => source(x)).join("|") + ")"; 302 return joined; 303 } 304 function countMatchGroups(re) { 305 return new RegExp(re.toString() + "|").exec("").length - 1; 306 } 307 function startsWith(re, lexeme) { 308 const match = re && re.exec(lexeme); 309 return match && match.index === 0; 310 } 311 var BACKREF_RE = /\[(?:[^\\\]]|\\.)*\]|\(\??|\\([1-9][0-9]*)|\\./; 312 function _rewriteBackreferences(regexps, { joinWith }) { 313 let numCaptures = 0; 314 return regexps.map((regex) => { 315 numCaptures += 1; 316 const offset = numCaptures; 317 let re = source(regex); 318 let out = ""; 319 while (re.length > 0) { 320 const match = BACKREF_RE.exec(re); 321 if (!match) { 322 out += re; 323 break; 324 } 325 out += re.substring(0, match.index); 326 re = re.substring(match.index + match[0].length); 327 if (match[0][0] === "\\" && match[1]) { 328 out += "\\" + String(Number(match[1]) + offset); 329 } else { 330 out += match[0]; 331 if (match[0] === "(") { 332 numCaptures++; 333 } 334 } 335 } 336 return out; 337 }).map((re) => `(${re})`).join(joinWith); 338 } 339 var MATCH_NOTHING_RE = /\b\B/; 340 var IDENT_RE2 = "[a-zA-Z]\\w*"; 341 var UNDERSCORE_IDENT_RE = "[a-zA-Z_]\\w*"; 342 var NUMBER_RE = "\\b\\d+(\\.\\d+)?"; 343 var C_NUMBER_RE = "(-?)(\\b0[xX][a-fA-F0-9]+|(\\b\\d+(\\.\\d*)?|\\.\\d+)([eE][-+]?\\d+)?)"; 344 var BINARY_NUMBER_RE = "\\b(0b[01]+)"; 345 var RE_STARTERS_RE = "!|!=|!==|%|%=|&|&&|&=|\\*|\\*=|\\+|\\+=|,|-|-=|/=|/|:|;|<<|<<=|<=|<|===|==|=|>>>=|>>=|>=|>>>|>>|>|\\?|\\[|\\{|\\(|\\^|\\^=|\\||\\|=|\\|\\||~"; 346 var SHEBANG = (opts = {}) => { 347 const beginShebang = /^#![ ]*\//; 348 if (opts.binary) { 349 opts.begin = concat( 350 beginShebang, 351 /.*\b/, 352 opts.binary, 353 /\b.*/ 354 ); 355 } 356 return inherit$1({ 357 scope: "meta", 358 begin: beginShebang, 359 end: /$/, 360 relevance: 0, 361 /** @type {ModeCallback} */ 362 "on:begin": (m, resp) => { 363 if (m.index !== 0) resp.ignoreMatch(); 364 } 365 }, opts); 366 }; 367 var BACKSLASH_ESCAPE = { 368 begin: "\\\\[\\s\\S]", 369 relevance: 0 370 }; 371 var APOS_STRING_MODE = { 372 scope: "string", 373 begin: "'", 374 end: "'", 375 illegal: "\\n", 376 contains: [BACKSLASH_ESCAPE] 377 }; 378 var QUOTE_STRING_MODE = { 379 scope: "string", 380 begin: '"', 381 end: '"', 382 illegal: "\\n", 383 contains: [BACKSLASH_ESCAPE] 384 }; 385 var PHRASAL_WORDS_MODE = { 386 begin: /\b(a|an|the|are|I'm|isn't|don't|doesn't|won't|but|just|should|pretty|simply|enough|gonna|going|wtf|so|such|will|you|your|they|like|more)\b/ 387 }; 388 var COMMENT = function(begin, end, modeOptions = {}) { 389 const mode = inherit$1( 390 { 391 scope: "comment", 392 begin, 393 end, 394 contains: [] 395 }, 396 modeOptions 397 ); 398 mode.contains.push({ 399 scope: "doctag", 400 // hack to avoid the space from being included. the space is necessary to 401 // match here to prevent the plain text rule below from gobbling up doctags 402 begin: "[ ]*(?=(TODO|FIXME|NOTE|BUG|OPTIMIZE|HACK|XXX):)", 403 end: /(TODO|FIXME|NOTE|BUG|OPTIMIZE|HACK|XXX):/, 404 excludeBegin: true, 405 relevance: 0 406 }); 407 const ENGLISH_WORD = either( 408 // list of common 1 and 2 letter words in English 409 "I", 410 "a", 411 "is", 412 "so", 413 "us", 414 "to", 415 "at", 416 "if", 417 "in", 418 "it", 419 "on", 420 // note: this is not an exhaustive list of contractions, just popular ones 421 /[A-Za-z]+['](d|ve|re|ll|t|s|n)/, 422 // contractions - can't we'd they're let's, etc 423 /[A-Za-z]+[-][a-z]+/, 424 // `no-way`, etc. 425 /[A-Za-z][a-z]{2,}/ 426 // allow capitalized words at beginning of sentences 427 ); 428 mode.contains.push( 429 { 430 // TODO: how to include ", (, ) without breaking grammars that use these for 431 // comment delimiters? 432 // begin: /[ ]+([()"]?([A-Za-z'-]{3,}|is|a|I|so|us|[tT][oO]|at|if|in|it|on)[.]?[()":]?([.][ ]|[ ]|\))){3}/ 433 // --- 434 // this tries to find sequences of 3 english words in a row (without any 435 // "programming" type syntax) this gives us a strong signal that we've 436 // TRULY found a comment - vs perhaps scanning with the wrong language. 437 // It's possible to find something that LOOKS like the start of the 438 // comment - but then if there is no readable text - good chance it is a 439 // false match and not a comment. 440 // 441 // for a visual example please see: 442 // https://github.com/highlightjs/highlight.js/issues/2827 443 begin: concat( 444 /[ ]+/, 445 // necessary to prevent us gobbling up doctags like /* @author Bob Mcgill */ 446 "(", 447 ENGLISH_WORD, 448 /[.]?[:]?([.][ ]|[ ])/, 449 "){3}" 450 ) 451 // look for 3 words in a row 452 } 453 ); 454 return mode; 455 }; 456 var C_LINE_COMMENT_MODE = COMMENT("//", "$"); 457 var C_BLOCK_COMMENT_MODE = COMMENT("/\\*", "\\*/"); 458 var HASH_COMMENT_MODE = COMMENT("#", "$"); 459 var NUMBER_MODE = { 460 scope: "number", 461 begin: NUMBER_RE, 462 relevance: 0 463 }; 464 var C_NUMBER_MODE = { 465 scope: "number", 466 begin: C_NUMBER_RE, 467 relevance: 0 468 }; 469 var BINARY_NUMBER_MODE = { 470 scope: "number", 471 begin: BINARY_NUMBER_RE, 472 relevance: 0 473 }; 474 var REGEXP_MODE = { 475 scope: "regexp", 476 begin: /\/(?=[^/\n]*\/)/, 477 end: /\/[gimuy]*/, 478 contains: [ 479 BACKSLASH_ESCAPE, 480 { 481 begin: /\[/, 482 end: /\]/, 483 relevance: 0, 484 contains: [BACKSLASH_ESCAPE] 485 } 486 ] 487 }; 488 var TITLE_MODE = { 489 scope: "title", 490 begin: IDENT_RE2, 491 relevance: 0 492 }; 493 var UNDERSCORE_TITLE_MODE = { 494 scope: "title", 495 begin: UNDERSCORE_IDENT_RE, 496 relevance: 0 497 }; 498 var METHOD_GUARD = { 499 // excludes method names from keyword processing 500 begin: "\\.\\s*" + UNDERSCORE_IDENT_RE, 501 relevance: 0 502 }; 503 var END_SAME_AS_BEGIN = function(mode) { 504 return Object.assign( 505 mode, 506 { 507 /** @type {ModeCallback} */ 508 "on:begin": (m, resp) => { 509 resp.data._beginMatch = m[1]; 510 }, 511 /** @type {ModeCallback} */ 512 "on:end": (m, resp) => { 513 if (resp.data._beginMatch !== m[1]) resp.ignoreMatch(); 514 } 515 } 516 ); 517 }; 518 var MODES = /* @__PURE__ */ Object.freeze({ 519 __proto__: null, 520 APOS_STRING_MODE, 521 BACKSLASH_ESCAPE, 522 BINARY_NUMBER_MODE, 523 BINARY_NUMBER_RE, 524 COMMENT, 525 C_BLOCK_COMMENT_MODE, 526 C_LINE_COMMENT_MODE, 527 C_NUMBER_MODE, 528 C_NUMBER_RE, 529 END_SAME_AS_BEGIN, 530 HASH_COMMENT_MODE, 531 IDENT_RE: IDENT_RE2, 532 MATCH_NOTHING_RE, 533 METHOD_GUARD, 534 NUMBER_MODE, 535 NUMBER_RE, 536 PHRASAL_WORDS_MODE, 537 QUOTE_STRING_MODE, 538 REGEXP_MODE, 539 RE_STARTERS_RE, 540 SHEBANG, 541 TITLE_MODE, 542 UNDERSCORE_IDENT_RE, 543 UNDERSCORE_TITLE_MODE 544 }); 545 function skipIfHasPrecedingDot(match, response) { 546 const before = match.input[match.index - 1]; 547 if (before === ".") { 548 response.ignoreMatch(); 549 } 550 } 551 function scopeClassName(mode, _parent) { 552 if (mode.className !== void 0) { 553 mode.scope = mode.className; 554 delete mode.className; 555 } 556 } 557 function beginKeywords(mode, parent) { 558 if (!parent) return; 559 if (!mode.beginKeywords) return; 560 mode.begin = "\\b(" + mode.beginKeywords.split(" ").join("|") + ")(?!\\.)(?=\\b|\\s)"; 561 mode.__beforeBegin = skipIfHasPrecedingDot; 562 mode.keywords = mode.keywords || mode.beginKeywords; 563 delete mode.beginKeywords; 564 if (mode.relevance === void 0) mode.relevance = 0; 565 } 566 function compileIllegal(mode, _parent) { 567 if (!Array.isArray(mode.illegal)) return; 568 mode.illegal = either(...mode.illegal); 569 } 570 function compileMatch(mode, _parent) { 571 if (!mode.match) return; 572 if (mode.begin || mode.end) throw new Error("begin & end are not supported with match"); 573 mode.begin = mode.match; 574 delete mode.match; 575 } 576 function compileRelevance(mode, _parent) { 577 if (mode.relevance === void 0) mode.relevance = 1; 578 } 579 var beforeMatchExt = (mode, parent) => { 580 if (!mode.beforeMatch) return; 581 if (mode.starts) throw new Error("beforeMatch cannot be used with starts"); 582 const originalMode = Object.assign({}, mode); 583 Object.keys(mode).forEach((key) => { 584 delete mode[key]; 585 }); 586 mode.keywords = originalMode.keywords; 587 mode.begin = concat(originalMode.beforeMatch, lookahead(originalMode.begin)); 588 mode.starts = { 589 relevance: 0, 590 contains: [ 591 Object.assign(originalMode, { endsParent: true }) 592 ] 593 }; 594 mode.relevance = 0; 595 delete originalMode.beforeMatch; 596 }; 597 var COMMON_KEYWORDS = [ 598 "of", 599 "and", 600 "for", 601 "in", 602 "not", 603 "or", 604 "if", 605 "then", 606 "parent", 607 // common variable name 608 "list", 609 // common variable name 610 "value" 611 // common variable name 612 ]; 613 var DEFAULT_KEYWORD_SCOPE = "keyword"; 614 function compileKeywords(rawKeywords, caseInsensitive, scopeName = DEFAULT_KEYWORD_SCOPE) { 615 const compiledKeywords = /* @__PURE__ */ Object.create(null); 616 if (typeof rawKeywords === "string") { 617 compileList(scopeName, rawKeywords.split(" ")); 618 } else if (Array.isArray(rawKeywords)) { 619 compileList(scopeName, rawKeywords); 620 } else { 621 Object.keys(rawKeywords).forEach(function(scopeName2) { 622 Object.assign( 623 compiledKeywords, 624 compileKeywords(rawKeywords[scopeName2], caseInsensitive, scopeName2) 625 ); 626 }); 627 } 628 return compiledKeywords; 629 function compileList(scopeName2, keywordList) { 630 if (caseInsensitive) { 631 keywordList = keywordList.map((x) => x.toLowerCase()); 632 } 633 keywordList.forEach(function(keyword) { 634 const pair = keyword.split("|"); 635 compiledKeywords[pair[0]] = [scopeName2, scoreForKeyword(pair[0], pair[1])]; 636 }); 637 } 638 } 639 function scoreForKeyword(keyword, providedScore) { 640 if (providedScore) { 641 return Number(providedScore); 642 } 643 return commonKeyword(keyword) ? 0 : 1; 644 } 645 function commonKeyword(keyword) { 646 return COMMON_KEYWORDS.includes(keyword.toLowerCase()); 647 } 648 var seenDeprecations = {}; 649 var error = (message) => { 650 console.error(message); 651 }; 652 var warn = (message, ...args) => { 653 console.log(`WARN: ${message}`, ...args); 654 }; 655 var deprecated = (version2, message) => { 656 if (seenDeprecations[`${version2}/${message}`]) return; 657 console.log(`Deprecated as of ${version2}. ${message}`); 658 seenDeprecations[`${version2}/${message}`] = true; 659 }; 660 var MultiClassError = new Error(); 661 function remapScopeNames(mode, regexes, { key }) { 662 let offset = 0; 663 const scopeNames = mode[key]; 664 const emit = {}; 665 const positions = {}; 666 for (let i = 1; i <= regexes.length; i++) { 667 positions[i + offset] = scopeNames[i]; 668 emit[i + offset] = true; 669 offset += countMatchGroups(regexes[i - 1]); 670 } 671 mode[key] = positions; 672 mode[key]._emit = emit; 673 mode[key]._multi = true; 674 } 675 function beginMultiClass(mode) { 676 if (!Array.isArray(mode.begin)) return; 677 if (mode.skip || mode.excludeBegin || mode.returnBegin) { 678 error("skip, excludeBegin, returnBegin not compatible with beginScope: {}"); 679 throw MultiClassError; 680 } 681 if (typeof mode.beginScope !== "object" || mode.beginScope === null) { 682 error("beginScope must be object"); 683 throw MultiClassError; 684 } 685 remapScopeNames(mode, mode.begin, { key: "beginScope" }); 686 mode.begin = _rewriteBackreferences(mode.begin, { joinWith: "" }); 687 } 688 function endMultiClass(mode) { 689 if (!Array.isArray(mode.end)) return; 690 if (mode.skip || mode.excludeEnd || mode.returnEnd) { 691 error("skip, excludeEnd, returnEnd not compatible with endScope: {}"); 692 throw MultiClassError; 693 } 694 if (typeof mode.endScope !== "object" || mode.endScope === null) { 695 error("endScope must be object"); 696 throw MultiClassError; 697 } 698 remapScopeNames(mode, mode.end, { key: "endScope" }); 699 mode.end = _rewriteBackreferences(mode.end, { joinWith: "" }); 700 } 701 function scopeSugar(mode) { 702 if (mode.scope && typeof mode.scope === "object" && mode.scope !== null) { 703 mode.beginScope = mode.scope; 704 delete mode.scope; 705 } 706 } 707 function MultiClass(mode) { 708 scopeSugar(mode); 709 if (typeof mode.beginScope === "string") { 710 mode.beginScope = { _wrap: mode.beginScope }; 711 } 712 if (typeof mode.endScope === "string") { 713 mode.endScope = { _wrap: mode.endScope }; 714 } 715 beginMultiClass(mode); 716 endMultiClass(mode); 717 } 718 function compileLanguage(language) { 719 function langRe(value, global) { 720 return new RegExp( 721 source(value), 722 "m" + (language.case_insensitive ? "i" : "") + (language.unicodeRegex ? "u" : "") + (global ? "g" : "") 723 ); 724 } 725 class MultiRegex { 726 constructor() { 727 this.matchIndexes = {}; 728 this.regexes = []; 729 this.matchAt = 1; 730 this.position = 0; 731 } 732 // @ts-ignore 733 addRule(re, opts) { 734 opts.position = this.position++; 735 this.matchIndexes[this.matchAt] = opts; 736 this.regexes.push([opts, re]); 737 this.matchAt += countMatchGroups(re) + 1; 738 } 739 compile() { 740 if (this.regexes.length === 0) { 741 this.exec = () => null; 742 } 743 const terminators = this.regexes.map((el) => el[1]); 744 this.matcherRe = langRe(_rewriteBackreferences(terminators, { joinWith: "|" }), true); 745 this.lastIndex = 0; 746 } 747 /** @param {string} s */ 748 exec(s) { 749 this.matcherRe.lastIndex = this.lastIndex; 750 const match = this.matcherRe.exec(s); 751 if (!match) { 752 return null; 753 } 754 const i = match.findIndex((el, i2) => i2 > 0 && el !== void 0); 755 const matchData = this.matchIndexes[i]; 756 match.splice(0, i); 757 return Object.assign(match, matchData); 758 } 759 } 760 class ResumableMultiRegex { 761 constructor() { 762 this.rules = []; 763 this.multiRegexes = []; 764 this.count = 0; 765 this.lastIndex = 0; 766 this.regexIndex = 0; 767 } 768 // @ts-ignore 769 getMatcher(index) { 770 if (this.multiRegexes[index]) return this.multiRegexes[index]; 771 const matcher = new MultiRegex(); 772 this.rules.slice(index).forEach(([re, opts]) => matcher.addRule(re, opts)); 773 matcher.compile(); 774 this.multiRegexes[index] = matcher; 775 return matcher; 776 } 777 resumingScanAtSamePosition() { 778 return this.regexIndex !== 0; 779 } 780 considerAll() { 781 this.regexIndex = 0; 782 } 783 // @ts-ignore 784 addRule(re, opts) { 785 this.rules.push([re, opts]); 786 if (opts.type === "begin") this.count++; 787 } 788 /** @param {string} s */ 789 exec(s) { 790 const m = this.getMatcher(this.regexIndex); 791 m.lastIndex = this.lastIndex; 792 let result = m.exec(s); 793 if (this.resumingScanAtSamePosition()) { 794 if (result && result.index === this.lastIndex) ; 795 else { 796 const m2 = this.getMatcher(0); 797 m2.lastIndex = this.lastIndex + 1; 798 result = m2.exec(s); 799 } 800 } 801 if (result) { 802 this.regexIndex += result.position + 1; 803 if (this.regexIndex === this.count) { 804 this.considerAll(); 805 } 806 } 807 return result; 808 } 809 } 810 function buildModeRegex(mode) { 811 const mm = new ResumableMultiRegex(); 812 mode.contains.forEach((term) => mm.addRule(term.begin, { rule: term, type: "begin" })); 813 if (mode.terminatorEnd) { 814 mm.addRule(mode.terminatorEnd, { type: "end" }); 815 } 816 if (mode.illegal) { 817 mm.addRule(mode.illegal, { type: "illegal" }); 818 } 819 return mm; 820 } 821 function compileMode(mode, parent) { 822 const cmode = ( 823 /** @type CompiledMode */ 824 mode 825 ); 826 if (mode.isCompiled) return cmode; 827 [ 828 scopeClassName, 829 // do this early so compiler extensions generally don't have to worry about 830 // the distinction between match/begin 831 compileMatch, 832 MultiClass, 833 beforeMatchExt 834 ].forEach((ext) => ext(mode, parent)); 835 language.compilerExtensions.forEach((ext) => ext(mode, parent)); 836 mode.__beforeBegin = null; 837 [ 838 beginKeywords, 839 // do this later so compiler extensions that come earlier have access to the 840 // raw array if they wanted to perhaps manipulate it, etc. 841 compileIllegal, 842 // default to 1 relevance if not specified 843 compileRelevance 844 ].forEach((ext) => ext(mode, parent)); 845 mode.isCompiled = true; 846 let keywordPattern = null; 847 if (typeof mode.keywords === "object" && mode.keywords.$pattern) { 848 mode.keywords = Object.assign({}, mode.keywords); 849 keywordPattern = mode.keywords.$pattern; 850 delete mode.keywords.$pattern; 851 } 852 keywordPattern = keywordPattern || /\w+/; 853 if (mode.keywords) { 854 mode.keywords = compileKeywords(mode.keywords, language.case_insensitive); 855 } 856 cmode.keywordPatternRe = langRe(keywordPattern, true); 857 if (parent) { 858 if (!mode.begin) mode.begin = /\B|\b/; 859 cmode.beginRe = langRe(cmode.begin); 860 if (!mode.end && !mode.endsWithParent) mode.end = /\B|\b/; 861 if (mode.end) cmode.endRe = langRe(cmode.end); 862 cmode.terminatorEnd = source(cmode.end) || ""; 863 if (mode.endsWithParent && parent.terminatorEnd) { 864 cmode.terminatorEnd += (mode.end ? "|" : "") + parent.terminatorEnd; 865 } 866 } 867 if (mode.illegal) cmode.illegalRe = langRe( 868 /** @type {RegExp | string} */ 869 mode.illegal 870 ); 871 if (!mode.contains) mode.contains = []; 872 mode.contains = [].concat(...mode.contains.map(function(c) { 873 return expandOrCloneMode(c === "self" ? mode : c); 874 })); 875 mode.contains.forEach(function(c) { 876 compileMode( 877 /** @type Mode */ 878 c, 879 cmode 880 ); 881 }); 882 if (mode.starts) { 883 compileMode(mode.starts, parent); 884 } 885 cmode.matcher = buildModeRegex(cmode); 886 return cmode; 887 } 888 if (!language.compilerExtensions) language.compilerExtensions = []; 889 if (language.contains && language.contains.includes("self")) { 890 throw new Error("ERR: contains `self` is not supported at the top-level of a language. See documentation."); 891 } 892 language.classNameAliases = inherit$1(language.classNameAliases || {}); 893 return compileMode( 894 /** @type Mode */ 895 language 896 ); 897 } 898 function dependencyOnParent(mode) { 899 if (!mode) return false; 900 return mode.endsWithParent || dependencyOnParent(mode.starts); 901 } 902 function expandOrCloneMode(mode) { 903 if (mode.variants && !mode.cachedVariants) { 904 mode.cachedVariants = mode.variants.map(function(variant) { 905 return inherit$1(mode, { variants: null }, variant); 906 }); 907 } 908 if (mode.cachedVariants) { 909 return mode.cachedVariants; 910 } 911 if (dependencyOnParent(mode)) { 912 return inherit$1(mode, { starts: mode.starts ? inherit$1(mode.starts) : null }); 913 } 914 if (Object.isFrozen(mode)) { 915 return inherit$1(mode); 916 } 917 return mode; 918 } 919 var version = "11.11.1"; 920 var HTMLInjectionError = class extends Error { 921 constructor(reason, html) { 922 super(reason); 923 this.name = "HTMLInjectionError"; 924 this.html = html; 925 } 926 }; 927 var escape = escapeHTML; 928 var inherit = inherit$1; 929 var NO_MATCH = /* @__PURE__ */ Symbol("nomatch"); 930 var MAX_KEYWORD_HITS = 7; 931 var HLJS = function(hljs) { 932 const languages = /* @__PURE__ */ Object.create(null); 933 const aliases = /* @__PURE__ */ Object.create(null); 934 const plugins = []; 935 let SAFE_MODE = true; 936 const LANGUAGE_NOT_FOUND = "Could not find the language '{}', did you forget to load/include a language module?"; 937 const PLAINTEXT_LANGUAGE = { disableAutodetect: true, name: "Plain text", contains: [] }; 938 let options = { 939 ignoreUnescapedHTML: false, 940 throwUnescapedHTML: false, 941 noHighlightRe: /^(no-?highlight)$/i, 942 languageDetectRe: /\blang(?:uage)?-([\w-]+)\b/i, 943 classPrefix: "hljs-", 944 cssSelector: "pre code", 945 languages: null, 946 // beta configuration options, subject to change, welcome to discuss 947 // https://github.com/highlightjs/highlight.js/issues/1086 948 __emitter: TokenTreeEmitter 949 }; 950 function shouldNotHighlight(languageName) { 951 return options.noHighlightRe.test(languageName); 952 } 953 function blockLanguage(block) { 954 let classes = block.className + " "; 955 classes += block.parentNode ? block.parentNode.className : ""; 956 const match = options.languageDetectRe.exec(classes); 957 if (match) { 958 const language = getLanguage(match[1]); 959 if (!language) { 960 warn(LANGUAGE_NOT_FOUND.replace("{}", match[1])); 961 warn("Falling back to no-highlight mode for this block.", block); 962 } 963 return language ? match[1] : "no-highlight"; 964 } 965 return classes.split(/\s+/).find((_class) => shouldNotHighlight(_class) || getLanguage(_class)); 966 } 967 function highlight2(codeOrLanguageName, optionsOrCode, ignoreIllegals) { 968 let code = ""; 969 let languageName = ""; 970 if (typeof optionsOrCode === "object") { 971 code = codeOrLanguageName; 972 ignoreIllegals = optionsOrCode.ignoreIllegals; 973 languageName = optionsOrCode.language; 974 } else { 975 deprecated("10.7.0", "highlight(lang, code, ...args) has been deprecated."); 976 deprecated("10.7.0", "Please use highlight(code, options) instead.\nhttps://github.com/highlightjs/highlight.js/issues/2277"); 977 languageName = codeOrLanguageName; 978 code = optionsOrCode; 979 } 980 if (ignoreIllegals === void 0) { 981 ignoreIllegals = true; 982 } 983 const context = { 984 code, 985 language: languageName 986 }; 987 fire("before:highlight", context); 988 const result = context.result ? context.result : _highlight(context.language, context.code, ignoreIllegals); 989 result.code = context.code; 990 fire("after:highlight", result); 991 return result; 992 } 993 function _highlight(languageName, codeToHighlight, ignoreIllegals, continuation) { 994 const keywordHits = /* @__PURE__ */ Object.create(null); 995 function keywordData(mode, matchText) { 996 return mode.keywords[matchText]; 997 } 998 function processKeywords() { 999 if (!top.keywords) { 1000 emitter.addText(modeBuffer); 1001 return; 1002 } 1003 let lastIndex = 0; 1004 top.keywordPatternRe.lastIndex = 0; 1005 let match = top.keywordPatternRe.exec(modeBuffer); 1006 let buf = ""; 1007 while (match) { 1008 buf += modeBuffer.substring(lastIndex, match.index); 1009 const word = language.case_insensitive ? match[0].toLowerCase() : match[0]; 1010 const data = keywordData(top, word); 1011 if (data) { 1012 const [kind, keywordRelevance] = data; 1013 emitter.addText(buf); 1014 buf = ""; 1015 keywordHits[word] = (keywordHits[word] || 0) + 1; 1016 if (keywordHits[word] <= MAX_KEYWORD_HITS) relevance += keywordRelevance; 1017 if (kind.startsWith("_")) { 1018 buf += match[0]; 1019 } else { 1020 const cssClass = language.classNameAliases[kind] || kind; 1021 emitKeyword(match[0], cssClass); 1022 } 1023 } else { 1024 buf += match[0]; 1025 } 1026 lastIndex = top.keywordPatternRe.lastIndex; 1027 match = top.keywordPatternRe.exec(modeBuffer); 1028 } 1029 buf += modeBuffer.substring(lastIndex); 1030 emitter.addText(buf); 1031 } 1032 function processSubLanguage() { 1033 if (modeBuffer === "") return; 1034 let result2 = null; 1035 if (typeof top.subLanguage === "string") { 1036 if (!languages[top.subLanguage]) { 1037 emitter.addText(modeBuffer); 1038 return; 1039 } 1040 result2 = _highlight(top.subLanguage, modeBuffer, true, continuations[top.subLanguage]); 1041 continuations[top.subLanguage] = /** @type {CompiledMode} */ 1042 result2._top; 1043 } else { 1044 result2 = highlightAuto(modeBuffer, top.subLanguage.length ? top.subLanguage : null); 1045 } 1046 if (top.relevance > 0) { 1047 relevance += result2.relevance; 1048 } 1049 emitter.__addSublanguage(result2._emitter, result2.language); 1050 } 1051 function processBuffer() { 1052 if (top.subLanguage != null) { 1053 processSubLanguage(); 1054 } else { 1055 processKeywords(); 1056 } 1057 modeBuffer = ""; 1058 } 1059 function emitKeyword(keyword, scope) { 1060 if (keyword === "") return; 1061 emitter.startScope(scope); 1062 emitter.addText(keyword); 1063 emitter.endScope(); 1064 } 1065 function emitMultiClass(scope, match) { 1066 let i = 1; 1067 const max = match.length - 1; 1068 while (i <= max) { 1069 if (!scope._emit[i]) { 1070 i++; 1071 continue; 1072 } 1073 const klass = language.classNameAliases[scope[i]] || scope[i]; 1074 const text = match[i]; 1075 if (klass) { 1076 emitKeyword(text, klass); 1077 } else { 1078 modeBuffer = text; 1079 processKeywords(); 1080 modeBuffer = ""; 1081 } 1082 i++; 1083 } 1084 } 1085 function startNewMode(mode, match) { 1086 if (mode.scope && typeof mode.scope === "string") { 1087 emitter.openNode(language.classNameAliases[mode.scope] || mode.scope); 1088 } 1089 if (mode.beginScope) { 1090 if (mode.beginScope._wrap) { 1091 emitKeyword(modeBuffer, language.classNameAliases[mode.beginScope._wrap] || mode.beginScope._wrap); 1092 modeBuffer = ""; 1093 } else if (mode.beginScope._multi) { 1094 emitMultiClass(mode.beginScope, match); 1095 modeBuffer = ""; 1096 } 1097 } 1098 top = Object.create(mode, { parent: { value: top } }); 1099 return top; 1100 } 1101 function endOfMode(mode, match, matchPlusRemainder) { 1102 let matched = startsWith(mode.endRe, matchPlusRemainder); 1103 if (matched) { 1104 if (mode["on:end"]) { 1105 const resp = new Response(mode); 1106 mode["on:end"](match, resp); 1107 if (resp.isMatchIgnored) matched = false; 1108 } 1109 if (matched) { 1110 while (mode.endsParent && mode.parent) { 1111 mode = mode.parent; 1112 } 1113 return mode; 1114 } 1115 } 1116 if (mode.endsWithParent) { 1117 return endOfMode(mode.parent, match, matchPlusRemainder); 1118 } 1119 } 1120 function doIgnore(lexeme) { 1121 if (top.matcher.regexIndex === 0) { 1122 modeBuffer += lexeme[0]; 1123 return 1; 1124 } else { 1125 resumeScanAtSamePosition = true; 1126 return 0; 1127 } 1128 } 1129 function doBeginMatch(match) { 1130 const lexeme = match[0]; 1131 const newMode = match.rule; 1132 const resp = new Response(newMode); 1133 const beforeCallbacks = [newMode.__beforeBegin, newMode["on:begin"]]; 1134 for (const cb of beforeCallbacks) { 1135 if (!cb) continue; 1136 cb(match, resp); 1137 if (resp.isMatchIgnored) return doIgnore(lexeme); 1138 } 1139 if (newMode.skip) { 1140 modeBuffer += lexeme; 1141 } else { 1142 if (newMode.excludeBegin) { 1143 modeBuffer += lexeme; 1144 } 1145 processBuffer(); 1146 if (!newMode.returnBegin && !newMode.excludeBegin) { 1147 modeBuffer = lexeme; 1148 } 1149 } 1150 startNewMode(newMode, match); 1151 return newMode.returnBegin ? 0 : lexeme.length; 1152 } 1153 function doEndMatch(match) { 1154 const lexeme = match[0]; 1155 const matchPlusRemainder = codeToHighlight.substring(match.index); 1156 const endMode = endOfMode(top, match, matchPlusRemainder); 1157 if (!endMode) { 1158 return NO_MATCH; 1159 } 1160 const origin = top; 1161 if (top.endScope && top.endScope._wrap) { 1162 processBuffer(); 1163 emitKeyword(lexeme, top.endScope._wrap); 1164 } else if (top.endScope && top.endScope._multi) { 1165 processBuffer(); 1166 emitMultiClass(top.endScope, match); 1167 } else if (origin.skip) { 1168 modeBuffer += lexeme; 1169 } else { 1170 if (!(origin.returnEnd || origin.excludeEnd)) { 1171 modeBuffer += lexeme; 1172 } 1173 processBuffer(); 1174 if (origin.excludeEnd) { 1175 modeBuffer = lexeme; 1176 } 1177 } 1178 do { 1179 if (top.scope) { 1180 emitter.closeNode(); 1181 } 1182 if (!top.skip && !top.subLanguage) { 1183 relevance += top.relevance; 1184 } 1185 top = top.parent; 1186 } while (top !== endMode.parent); 1187 if (endMode.starts) { 1188 startNewMode(endMode.starts, match); 1189 } 1190 return origin.returnEnd ? 0 : lexeme.length; 1191 } 1192 function processContinuations() { 1193 const list = []; 1194 for (let current = top; current !== language; current = current.parent) { 1195 if (current.scope) { 1196 list.unshift(current.scope); 1197 } 1198 } 1199 list.forEach((item) => emitter.openNode(item)); 1200 } 1201 let lastMatch = {}; 1202 function processLexeme(textBeforeMatch, match) { 1203 const lexeme = match && match[0]; 1204 modeBuffer += textBeforeMatch; 1205 if (lexeme == null) { 1206 processBuffer(); 1207 return 0; 1208 } 1209 if (lastMatch.type === "begin" && match.type === "end" && lastMatch.index === match.index && lexeme === "") { 1210 modeBuffer += codeToHighlight.slice(match.index, match.index + 1); 1211 if (!SAFE_MODE) { 1212 const err = new Error(`0 width match regex (${languageName})`); 1213 err.languageName = languageName; 1214 err.badRule = lastMatch.rule; 1215 throw err; 1216 } 1217 return 1; 1218 } 1219 lastMatch = match; 1220 if (match.type === "begin") { 1221 return doBeginMatch(match); 1222 } else if (match.type === "illegal" && !ignoreIllegals) { 1223 const err = new Error('Illegal lexeme "' + lexeme + '" for mode "' + (top.scope || "<unnamed>") + '"'); 1224 err.mode = top; 1225 throw err; 1226 } else if (match.type === "end") { 1227 const processed = doEndMatch(match); 1228 if (processed !== NO_MATCH) { 1229 return processed; 1230 } 1231 } 1232 if (match.type === "illegal" && lexeme === "") { 1233 modeBuffer += "\n"; 1234 return 1; 1235 } 1236 if (iterations > 1e5 && iterations > match.index * 3) { 1237 const err = new Error("potential infinite loop, way more iterations than matches"); 1238 throw err; 1239 } 1240 modeBuffer += lexeme; 1241 return lexeme.length; 1242 } 1243 const language = getLanguage(languageName); 1244 if (!language) { 1245 error(LANGUAGE_NOT_FOUND.replace("{}", languageName)); 1246 throw new Error('Unknown language: "' + languageName + '"'); 1247 } 1248 const md = compileLanguage(language); 1249 let result = ""; 1250 let top = continuation || md; 1251 const continuations = {}; 1252 const emitter = new options.__emitter(options); 1253 processContinuations(); 1254 let modeBuffer = ""; 1255 let relevance = 0; 1256 let index = 0; 1257 let iterations = 0; 1258 let resumeScanAtSamePosition = false; 1259 try { 1260 if (!language.__emitTokens) { 1261 top.matcher.considerAll(); 1262 for (; ; ) { 1263 iterations++; 1264 if (resumeScanAtSamePosition) { 1265 resumeScanAtSamePosition = false; 1266 } else { 1267 top.matcher.considerAll(); 1268 } 1269 top.matcher.lastIndex = index; 1270 const match = top.matcher.exec(codeToHighlight); 1271 if (!match) break; 1272 const beforeMatch = codeToHighlight.substring(index, match.index); 1273 const processedCount = processLexeme(beforeMatch, match); 1274 index = match.index + processedCount; 1275 } 1276 processLexeme(codeToHighlight.substring(index)); 1277 } else { 1278 language.__emitTokens(codeToHighlight, emitter); 1279 } 1280 emitter.finalize(); 1281 result = emitter.toHTML(); 1282 return { 1283 language: languageName, 1284 value: result, 1285 relevance, 1286 illegal: false, 1287 _emitter: emitter, 1288 _top: top 1289 }; 1290 } catch (err) { 1291 if (err.message && err.message.includes("Illegal")) { 1292 return { 1293 language: languageName, 1294 value: escape(codeToHighlight), 1295 illegal: true, 1296 relevance: 0, 1297 _illegalBy: { 1298 message: err.message, 1299 index, 1300 context: codeToHighlight.slice(index - 100, index + 100), 1301 mode: err.mode, 1302 resultSoFar: result 1303 }, 1304 _emitter: emitter 1305 }; 1306 } else if (SAFE_MODE) { 1307 return { 1308 language: languageName, 1309 value: escape(codeToHighlight), 1310 illegal: false, 1311 relevance: 0, 1312 errorRaised: err, 1313 _emitter: emitter, 1314 _top: top 1315 }; 1316 } else { 1317 throw err; 1318 } 1319 } 1320 } 1321 function justTextHighlightResult(code) { 1322 const result = { 1323 value: escape(code), 1324 illegal: false, 1325 relevance: 0, 1326 _top: PLAINTEXT_LANGUAGE, 1327 _emitter: new options.__emitter(options) 1328 }; 1329 result._emitter.addText(code); 1330 return result; 1331 } 1332 function highlightAuto(code, languageSubset) { 1333 languageSubset = languageSubset || options.languages || Object.keys(languages); 1334 const plaintext = justTextHighlightResult(code); 1335 const results = languageSubset.filter(getLanguage).filter(autoDetection).map( 1336 (name) => _highlight(name, code, false) 1337 ); 1338 results.unshift(plaintext); 1339 const sorted = results.sort((a, b) => { 1340 if (a.relevance !== b.relevance) return b.relevance - a.relevance; 1341 if (a.language && b.language) { 1342 if (getLanguage(a.language).supersetOf === b.language) { 1343 return 1; 1344 } else if (getLanguage(b.language).supersetOf === a.language) { 1345 return -1; 1346 } 1347 } 1348 return 0; 1349 }); 1350 const [best, secondBest] = sorted; 1351 const result = best; 1352 result.secondBest = secondBest; 1353 return result; 1354 } 1355 function updateClassName(element, currentLang, resultLang) { 1356 const language = currentLang && aliases[currentLang] || resultLang; 1357 element.classList.add("hljs"); 1358 element.classList.add(`language-${language}`); 1359 } 1360 function highlightElement(element) { 1361 let node = null; 1362 const language = blockLanguage(element); 1363 if (shouldNotHighlight(language)) return; 1364 fire( 1365 "before:highlightElement", 1366 { el: element, language } 1367 ); 1368 if (element.dataset.highlighted) { 1369 console.log("Element previously highlighted. To highlight again, first unset `dataset.highlighted`.", element); 1370 return; 1371 } 1372 if (element.children.length > 0) { 1373 if (!options.ignoreUnescapedHTML) { 1374 console.warn("One of your code blocks includes unescaped HTML. This is a potentially serious security risk."); 1375 console.warn("https://github.com/highlightjs/highlight.js/wiki/security"); 1376 console.warn("The element with unescaped HTML:"); 1377 console.warn(element); 1378 } 1379 if (options.throwUnescapedHTML) { 1380 const err = new HTMLInjectionError( 1381 "One of your code blocks includes unescaped HTML.", 1382 element.innerHTML 1383 ); 1384 throw err; 1385 } 1386 } 1387 node = element; 1388 const text = node.textContent; 1389 const result = language ? highlight2(text, { language, ignoreIllegals: true }) : highlightAuto(text); 1390 element.innerHTML = result.value; 1391 element.dataset.highlighted = "yes"; 1392 updateClassName(element, language, result.language); 1393 element.result = { 1394 language: result.language, 1395 // TODO: remove with version 11.0 1396 re: result.relevance, 1397 relevance: result.relevance 1398 }; 1399 if (result.secondBest) { 1400 element.secondBest = { 1401 language: result.secondBest.language, 1402 relevance: result.secondBest.relevance 1403 }; 1404 } 1405 fire("after:highlightElement", { el: element, result, text }); 1406 } 1407 function configure(userOptions) { 1408 options = inherit(options, userOptions); 1409 } 1410 const initHighlighting = () => { 1411 highlightAll(); 1412 deprecated("10.6.0", "initHighlighting() deprecated. Use highlightAll() now."); 1413 }; 1414 function initHighlightingOnLoad() { 1415 highlightAll(); 1416 deprecated("10.6.0", "initHighlightingOnLoad() deprecated. Use highlightAll() now."); 1417 } 1418 let wantsHighlight = false; 1419 function highlightAll() { 1420 function boot() { 1421 highlightAll(); 1422 } 1423 if (document.readyState === "loading") { 1424 if (!wantsHighlight) { 1425 window.addEventListener("DOMContentLoaded", boot, false); 1426 } 1427 wantsHighlight = true; 1428 return; 1429 } 1430 const blocks = document.querySelectorAll(options.cssSelector); 1431 blocks.forEach(highlightElement); 1432 } 1433 function registerLanguage(languageName, languageDefinition) { 1434 let lang = null; 1435 try { 1436 lang = languageDefinition(hljs); 1437 } catch (error$1) { 1438 error("Language definition for '{}' could not be registered.".replace("{}", languageName)); 1439 if (!SAFE_MODE) { 1440 throw error$1; 1441 } else { 1442 error(error$1); 1443 } 1444 lang = PLAINTEXT_LANGUAGE; 1445 } 1446 if (!lang.name) lang.name = languageName; 1447 languages[languageName] = lang; 1448 lang.rawDefinition = languageDefinition.bind(null, hljs); 1449 if (lang.aliases) { 1450 registerAliases(lang.aliases, { languageName }); 1451 } 1452 } 1453 function unregisterLanguage(languageName) { 1454 delete languages[languageName]; 1455 for (const alias of Object.keys(aliases)) { 1456 if (aliases[alias] === languageName) { 1457 delete aliases[alias]; 1458 } 1459 } 1460 } 1461 function listLanguages() { 1462 return Object.keys(languages); 1463 } 1464 function getLanguage(name) { 1465 name = (name || "").toLowerCase(); 1466 return languages[name] || languages[aliases[name]]; 1467 } 1468 function registerAliases(aliasList, { languageName }) { 1469 if (typeof aliasList === "string") { 1470 aliasList = [aliasList]; 1471 } 1472 aliasList.forEach((alias) => { 1473 aliases[alias.toLowerCase()] = languageName; 1474 }); 1475 } 1476 function autoDetection(name) { 1477 const lang = getLanguage(name); 1478 return lang && !lang.disableAutodetect; 1479 } 1480 function upgradePluginAPI(plugin) { 1481 if (plugin["before:highlightBlock"] && !plugin["before:highlightElement"]) { 1482 plugin["before:highlightElement"] = (data) => { 1483 plugin["before:highlightBlock"]( 1484 Object.assign({ block: data.el }, data) 1485 ); 1486 }; 1487 } 1488 if (plugin["after:highlightBlock"] && !plugin["after:highlightElement"]) { 1489 plugin["after:highlightElement"] = (data) => { 1490 plugin["after:highlightBlock"]( 1491 Object.assign({ block: data.el }, data) 1492 ); 1493 }; 1494 } 1495 } 1496 function addPlugin(plugin) { 1497 upgradePluginAPI(plugin); 1498 plugins.push(plugin); 1499 } 1500 function removePlugin(plugin) { 1501 const index = plugins.indexOf(plugin); 1502 if (index !== -1) { 1503 plugins.splice(index, 1); 1504 } 1505 } 1506 function fire(event, args) { 1507 const cb = event; 1508 plugins.forEach(function(plugin) { 1509 if (plugin[cb]) { 1510 plugin[cb](args); 1511 } 1512 }); 1513 } 1514 function deprecateHighlightBlock(el) { 1515 deprecated("10.7.0", "highlightBlock will be removed entirely in v12.0"); 1516 deprecated("10.7.0", "Please use highlightElement now."); 1517 return highlightElement(el); 1518 } 1519 Object.assign(hljs, { 1520 highlight: highlight2, 1521 highlightAuto, 1522 highlightAll, 1523 highlightElement, 1524 // TODO: Remove with v12 API 1525 highlightBlock: deprecateHighlightBlock, 1526 configure, 1527 initHighlighting, 1528 initHighlightingOnLoad, 1529 registerLanguage, 1530 unregisterLanguage, 1531 listLanguages, 1532 getLanguage, 1533 registerAliases, 1534 autoDetection, 1535 inherit, 1536 addPlugin, 1537 removePlugin 1538 }); 1539 hljs.debugMode = function() { 1540 SAFE_MODE = false; 1541 }; 1542 hljs.safeMode = function() { 1543 SAFE_MODE = true; 1544 }; 1545 hljs.versionString = version; 1546 hljs.regex = { 1547 concat, 1548 lookahead, 1549 either, 1550 optional, 1551 anyNumberOfTimes 1552 }; 1553 for (const key in MODES) { 1554 if (typeof MODES[key] === "object") { 1555 deepFreeze(MODES[key]); 1556 } 1557 } 1558 Object.assign(hljs, MODES); 1559 return hljs; 1560 }; 1561 var highlight = HLJS({}); 1562 highlight.newInstance = () => HLJS({}); 1563 module.exports = highlight; 1564 highlight.HighlightJS = highlight; 1565 highlight.default = highlight; 1566 } 1567}); 1568
vendor: 127 bytes, lines 1569-1572
1569// node_modules/highlight.js/es/core.js 1570var import_core = __toESM(require_core(), 1); 1571var core_default = import_core.default; 1572
vendor: 6,208 bytes, lines 1573-1966
1573// node_modules/highlight.js/es/languages/bash.js 1574function bash(hljs) { 1575 const regex = hljs.regex; 1576 const VAR = {}; 1577 const BRACED_VAR = { 1578 begin: /\$\{/, 1579 end: /\}/, 1580 contains: [ 1581 "self", 1582 { 1583 begin: /:-/, 1584 contains: [VAR] 1585 } 1586 // default values 1587 ] 1588 }; 1589 Object.assign(VAR, { 1590 className: "variable", 1591 variants: [ 1592 { begin: regex.concat( 1593 /\$[\w\d#@][\w\d_]*/, 1594 // negative look-ahead tries to avoid matching patterns that are not 1595 // Perl at all like $ident$, @ident@, etc. 1596 `(?![\\w\\d])(?![$])` 1597 ) }, 1598 BRACED_VAR 1599 ] 1600 }); 1601 const SUBST = { 1602 className: "subst", 1603 begin: /\$\(/, 1604 end: /\)/, 1605 contains: [hljs.BACKSLASH_ESCAPE] 1606 }; 1607 const COMMENT = hljs.inherit( 1608 hljs.COMMENT(), 1609 { 1610 match: [ 1611 /(^|\s)/, 1612 /#.*$/ 1613 ], 1614 scope: { 1615 2: "comment" 1616 } 1617 } 1618 ); 1619 const HERE_DOC = { 1620 begin: /<<-?\s*(?=\w+)/, 1621 starts: { contains: [ 1622 hljs.END_SAME_AS_BEGIN({ 1623 begin: /(\w+)/, 1624 end: /(\w+)/, 1625 className: "string" 1626 }) 1627 ] } 1628 }; 1629 const QUOTE_STRING = { 1630 className: "string", 1631 begin: /"/, 1632 end: /"/, 1633 contains: [ 1634 hljs.BACKSLASH_ESCAPE, 1635 VAR, 1636 SUBST 1637 ] 1638 }; 1639 SUBST.contains.push(QUOTE_STRING); 1640 const ESCAPED_QUOTE = { 1641 match: /\\"/ 1642 }; 1643 const APOS_STRING = { 1644 className: "string", 1645 begin: /'/, 1646 end: /'/ 1647 }; 1648 const ESCAPED_APOS = { 1649 match: /\\'/ 1650 }; 1651 const ARITHMETIC = { 1652 begin: /\$?\(\(/, 1653 end: /\)\)/, 1654 contains: [ 1655 { 1656 begin: /\d+#[0-9a-f]+/, 1657 className: "number" 1658 }, 1659 hljs.NUMBER_MODE, 1660 VAR 1661 ] 1662 }; 1663 const SH_LIKE_SHELLS = [ 1664 "fish", 1665 "bash", 1666 "zsh", 1667 "sh", 1668 "csh", 1669 "ksh", 1670 "tcsh", 1671 "dash", 1672 "scsh" 1673 ]; 1674 const KNOWN_SHEBANG = hljs.SHEBANG({ 1675 binary: `(${SH_LIKE_SHELLS.join("|")})`, 1676 relevance: 10 1677 }); 1678 const FUNCTION = { 1679 className: "function", 1680 begin: /\w[\w\d_]*\s*\(\s*\)\s*\{/, 1681 returnBegin: true, 1682 contains: [hljs.inherit(hljs.TITLE_MODE, { begin: /\w[\w\d_]*/ })], 1683 relevance: 0 1684 }; 1685 const KEYWORDS2 = [ 1686 "if", 1687 "then", 1688 "else", 1689 "elif", 1690 "fi", 1691 "time", 1692 "for", 1693 "while", 1694 "until", 1695 "in", 1696 "do", 1697 "done", 1698 "case", 1699 "esac", 1700 "coproc", 1701 "function", 1702 "select" 1703 ]; 1704 const LITERALS2 = [ 1705 "true", 1706 "false" 1707 ]; 1708 const PATH_MODE = { match: /(\/[a-z._-]+)+/ }; 1709 const SHELL_BUILT_INS = [ 1710 "break", 1711 "cd", 1712 "continue", 1713 "eval", 1714 "exec", 1715 "exit", 1716 "export", 1717 "getopts", 1718 "hash", 1719 "pwd", 1720 "readonly", 1721 "return", 1722 "shift", 1723 "test", 1724 "times", 1725 "trap", 1726 "umask", 1727 "unset" 1728 ]; 1729 const BASH_BUILT_INS = [ 1730 "alias", 1731 "bind", 1732 "builtin", 1733 "caller", 1734 "command", 1735 "declare", 1736 "echo", 1737 "enable", 1738 "help", 1739 "let", 1740 "local", 1741 "logout", 1742 "mapfile", 1743 "printf", 1744 "read", 1745 "readarray", 1746 "source", 1747 "sudo", 1748 "type", 1749 "typeset", 1750 "ulimit", 1751 "unalias" 1752 ]; 1753 const ZSH_BUILT_INS = [ 1754 "autoload", 1755 "bg", 1756 "bindkey", 1757 "bye", 1758 "cap", 1759 "chdir", 1760 "clone", 1761 "comparguments", 1762 "compcall", 1763 "compctl", 1764 "compdescribe", 1765 "compfiles", 1766 "compgroups", 1767 "compquote", 1768 "comptags", 1769 "comptry", 1770 "compvalues", 1771 "dirs", 1772 "disable", 1773 "disown", 1774 "echotc", 1775 "echoti", 1776 "emulate", 1777 "fc", 1778 "fg", 1779 "float", 1780 "functions", 1781 "getcap", 1782 "getln", 1783 "history", 1784 "integer", 1785 "jobs", 1786 "kill", 1787 "limit", 1788 "log", 1789 "noglob", 1790 "popd", 1791 "print", 1792 "pushd", 1793 "pushln", 1794 "rehash", 1795 "sched", 1796 "setcap", 1797 "setopt", 1798 "stat", 1799 "suspend", 1800 "ttyctl", 1801 "unfunction", 1802 "unhash", 1803 "unlimit", 1804 "unsetopt", 1805 "vared", 1806 "wait", 1807 "whence", 1808 "where", 1809 "which", 1810 "zcompile", 1811 "zformat", 1812 "zftp", 1813 "zle", 1814 "zmodload", 1815 "zparseopts", 1816 "zprof", 1817 "zpty", 1818 "zregexparse", 1819 "zsocket", 1820 "zstyle", 1821 "ztcp" 1822 ]; 1823 const GNU_CORE_UTILS = [ 1824 "chcon", 1825 "chgrp", 1826 "chown", 1827 "chmod", 1828 "cp", 1829 "dd", 1830 "df", 1831 "dir", 1832 "dircolors", 1833 "ln", 1834 "ls", 1835 "mkdir", 1836 "mkfifo", 1837 "mknod", 1838 "mktemp", 1839 "mv", 1840 "realpath", 1841 "rm", 1842 "rmdir", 1843 "shred", 1844 "sync", 1845 "touch", 1846 "truncate", 1847 "vdir", 1848 "b2sum", 1849 "base32", 1850 "base64", 1851 "cat", 1852 "cksum", 1853 "comm", 1854 "csplit", 1855 "cut", 1856 "expand", 1857 "fmt", 1858 "fold", 1859 "head", 1860 "join", 1861 "md5sum", 1862 "nl", 1863 "numfmt", 1864 "od", 1865 "paste", 1866 "ptx", 1867 "pr", 1868 "sha1sum", 1869 "sha224sum", 1870 "sha256sum", 1871 "sha384sum", 1872 "sha512sum", 1873 "shuf", 1874 "sort", 1875 "split", 1876 "sum", 1877 "tac", 1878 "tail", 1879 "tr", 1880 "tsort", 1881 "unexpand", 1882 "uniq", 1883 "wc", 1884 "arch", 1885 "basename", 1886 "chroot", 1887 "date", 1888 "dirname", 1889 "du", 1890 "echo", 1891 "env", 1892 "expr", 1893 "factor", 1894 // "false", // keyword literal already 1895 "groups", 1896 "hostid", 1897 "id", 1898 "link", 1899 "logname", 1900 "nice", 1901 "nohup", 1902 "nproc", 1903 "pathchk", 1904 "pinky", 1905 "printenv", 1906 "printf", 1907 "pwd", 1908 "readlink", 1909 "runcon", 1910 "seq", 1911 "sleep", 1912 "stat", 1913 "stdbuf", 1914 "stty", 1915 "tee", 1916 "test", 1917 "timeout", 1918 // "true", // keyword literal already 1919 "tty", 1920 "uname", 1921 "unlink", 1922 "uptime", 1923 "users", 1924 "who", 1925 "whoami", 1926 "yes" 1927 ]; 1928 return { 1929 name: "Bash", 1930 aliases: [ 1931 "sh", 1932 "zsh" 1933 ], 1934 keywords: { 1935 $pattern: /\b[a-z][a-z0-9._-]+\b/, 1936 keyword: KEYWORDS2, 1937 literal: LITERALS2, 1938 built_in: [ 1939 ...SHELL_BUILT_INS, 1940 ...BASH_BUILT_INS, 1941 // Shell modifiers 1942 "set", 1943 "shopt", 1944 ...ZSH_BUILT_INS, 1945 ...GNU_CORE_UTILS 1946 ] 1947 }, 1948 contains: [ 1949 KNOWN_SHEBANG, 1950 // to catch known shells and boost relevancy 1951 hljs.SHEBANG(), 1952 // to catch unknown shells but still highlight the shebang 1953 FUNCTION, 1954 ARITHMETIC, 1955 COMMENT, 1956 HERE_DOC, 1957 PATH_MODE, 1958 QUOTE_STRING, 1959 ESCAPED_QUOTE, 1960 APOS_STRING, 1961 ESCAPED_APOS, 1962 VAR 1963 ] 1964 }; 1965} 1966
vendor: 3,053 bytes, lines 1967-2120
1967// node_modules/highlight.js/es/languages/go.js 1968function go(hljs) { 1969 const LITERALS2 = [ 1970 "true", 1971 "false", 1972 "iota", 1973 "nil" 1974 ]; 1975 const BUILT_INS2 = [ 1976 "append", 1977 "cap", 1978 "close", 1979 "complex", 1980 "copy", 1981 "imag", 1982 "len", 1983 "make", 1984 "new", 1985 "panic", 1986 "print", 1987 "println", 1988 "real", 1989 "recover", 1990 "delete" 1991 ]; 1992 const TYPES2 = [ 1993 "bool", 1994 "byte", 1995 "complex64", 1996 "complex128", 1997 "error", 1998 "float32", 1999 "float64", 2000 "int8", 2001 "int16", 2002 "int32", 2003 "int64", 2004 "string", 2005 "uint8", 2006 "uint16", 2007 "uint32", 2008 "uint64", 2009 "int", 2010 "uint", 2011 "uintptr", 2012 "rune" 2013 ]; 2014 const KWS = [ 2015 "break", 2016 "case", 2017 "chan", 2018 "const", 2019 "continue", 2020 "default", 2021 "defer", 2022 "else", 2023 "fallthrough", 2024 "for", 2025 "func", 2026 "go", 2027 "goto", 2028 "if", 2029 "import", 2030 "interface", 2031 "map", 2032 "package", 2033 "range", 2034 "return", 2035 "select", 2036 "struct", 2037 "switch", 2038 "type", 2039 "var" 2040 ]; 2041 const KEYWORDS2 = { 2042 keyword: KWS, 2043 type: TYPES2, 2044 literal: LITERALS2, 2045 built_in: BUILT_INS2 2046 }; 2047 return { 2048 name: "Go", 2049 aliases: ["golang"], 2050 keywords: KEYWORDS2, 2051 illegal: "</", 2052 contains: [ 2053 hljs.C_LINE_COMMENT_MODE, 2054 hljs.C_BLOCK_COMMENT_MODE, 2055 { 2056 className: "string", 2057 variants: [ 2058 hljs.QUOTE_STRING_MODE, 2059 hljs.APOS_STRING_MODE, 2060 { 2061 begin: "`", 2062 end: "`" 2063 } 2064 ] 2065 }, 2066 { 2067 className: "number", 2068 variants: [ 2069 { 2070 match: /-?\b0[xX]\.[a-fA-F0-9](_?[a-fA-F0-9])*[pP][+-]?\d(_?\d)*i?/, 2071 // hex without a present digit before . (making a digit afterwards required) 2072 relevance: 0 2073 }, 2074 { 2075 match: /-?\b0[xX](_?[a-fA-F0-9])+((\.([a-fA-F0-9](_?[a-fA-F0-9])*)?)?[pP][+-]?\d(_?\d)*)?i?/, 2076 // hex with a present digit before . (making a digit afterwards optional) 2077 relevance: 0 2078 }, 2079 { 2080 match: /-?\b0[oO](_?[0-7])*i?/, 2081 // leading 0o octal 2082 relevance: 0 2083 }, 2084 { 2085 match: /-?\.\d(_?\d)*([eE][+-]?\d(_?\d)*)?i?/, 2086 // decimal without a present digit before . (making a digit afterwards required) 2087 relevance: 0 2088 }, 2089 { 2090 match: /-?\b\d(_?\d)*(\.(\d(_?\d)*)?)?([eE][+-]?\d(_?\d)*)?i?/, 2091 // decimal with a present digit before . (making a digit afterwards optional) 2092 relevance: 0 2093 } 2094 ] 2095 }, 2096 { 2097 begin: /:=/ 2098 // relevance booster 2099 }, 2100 { 2101 className: "function", 2102 beginKeywords: "func", 2103 end: "\\s*(\\{|$)", 2104 excludeEnd: true, 2105 contains: [ 2106 hljs.TITLE_MODE, 2107 { 2108 className: "params", 2109 begin: /\(/, 2110 end: /\)/, 2111 endsParent: true, 2112 keywords: KEYWORDS2, 2113 illegal: /["']/ 2114 } 2115 ] 2116 } 2117 ] 2118 }; 2119} 2120
vendor: 1,860 bytes, lines 2121-2208
2121// node_modules/highlight.js/es/languages/http.js 2122function http(hljs) { 2123 const regex = hljs.regex; 2124 const VERSION = "HTTP/([32]|1\\.[01])"; 2125 const HEADER_NAME = /[A-Za-z][A-Za-z0-9-]*/; 2126 const HEADER = { 2127 className: "attribute", 2128 begin: regex.concat("^", HEADER_NAME, "(?=\\:\\s)"), 2129 starts: { contains: [ 2130 { 2131 className: "punctuation", 2132 begin: /: /, 2133 relevance: 0, 2134 starts: { 2135 end: "$", 2136 relevance: 0 2137 } 2138 } 2139 ] } 2140 }; 2141 const HEADERS_AND_BODY = [ 2142 HEADER, 2143 { 2144 begin: "\\n\\n", 2145 starts: { 2146 subLanguage: [], 2147 endsWithParent: true 2148 } 2149 } 2150 ]; 2151 return { 2152 name: "HTTP", 2153 aliases: ["https"], 2154 illegal: /\S/, 2155 contains: [ 2156 // response 2157 { 2158 begin: "^(?=" + VERSION + " \\d{3})", 2159 end: /$/, 2160 contains: [ 2161 { 2162 className: "meta", 2163 begin: VERSION 2164 }, 2165 { 2166 className: "number", 2167 begin: "\\b\\d{3}\\b" 2168 } 2169 ], 2170 starts: { 2171 end: /\b\B/, 2172 illegal: /\S/, 2173 contains: HEADERS_AND_BODY 2174 } 2175 }, 2176 // request 2177 { 2178 begin: "(?=^[A-Z]+ (.*?) " + VERSION + "$)", 2179 end: /$/, 2180 contains: [ 2181 { 2182 className: "string", 2183 begin: " ", 2184 end: " ", 2185 excludeBegin: true, 2186 excludeEnd: true 2187 }, 2188 { 2189 className: "meta", 2190 begin: VERSION 2191 }, 2192 { 2193 className: "keyword", 2194 begin: "[A-Z]+" 2195 } 2196 ], 2197 starts: { 2198 end: /\b\B/, 2199 illegal: /\S/, 2200 contains: HEADERS_AND_BODY 2201 } 2202 }, 2203 // to allow headers to work even without a preamble 2204 hljs.inherit(HEADER, { relevance: 0 }) 2205 ] 2206 }; 2207} 2208
vendor: 5,719 bytes, lines 2209-2462
2209// node_modules/highlight.js/es/languages/java.js 2210var decimalDigits = "[0-9](_*[0-9])*"; 2211var frac = `\\.(${decimalDigits})`; 2212var hexDigits = "[0-9a-fA-F](_*[0-9a-fA-F])*"; 2213var NUMERIC = { 2214 className: "number", 2215 variants: [ 2216 // DecimalFloatingPointLiteral 2217 // including ExponentPart 2218 { begin: `(\\b(${decimalDigits})((${frac})|\\.)?|(${frac}))[eE][+-]?(${decimalDigits})[fFdD]?\\b` }, 2219 // excluding ExponentPart 2220 { begin: `\\b(${decimalDigits})((${frac})[fFdD]?\\b|\\.([fFdD]\\b)?)` }, 2221 { begin: `(${frac})[fFdD]?\\b` }, 2222 { begin: `\\b(${decimalDigits})[fFdD]\\b` }, 2223 // HexadecimalFloatingPointLiteral 2224 { begin: `\\b0[xX]((${hexDigits})\\.?|(${hexDigits})?\\.(${hexDigits}))[pP][+-]?(${decimalDigits})[fFdD]?\\b` }, 2225 // DecimalIntegerLiteral 2226 { begin: "\\b(0|[1-9](_*[0-9])*)[lL]?\\b" }, 2227 // HexIntegerLiteral 2228 { begin: `\\b0[xX](${hexDigits})[lL]?\\b` }, 2229 // OctalIntegerLiteral 2230 { begin: "\\b0(_*[0-7])*[lL]?\\b" }, 2231 // BinaryIntegerLiteral 2232 { begin: "\\b0[bB][01](_*[01])*[lL]?\\b" } 2233 ], 2234 relevance: 0 2235}; 2236function recurRegex(re, substitution, depth) { 2237 if (depth === -1) return ""; 2238 return re.replace(substitution, (_) => { 2239 return recurRegex(re, substitution, depth - 1); 2240 }); 2241} 2242function java(hljs) { 2243 const regex = hljs.regex; 2244 const JAVA_IDENT_RE = "[\xC0-\u02B8a-zA-Z_$][\xC0-\u02B8a-zA-Z_$0-9]*"; 2245 const GENERIC_IDENT_RE = JAVA_IDENT_RE + recurRegex("(?:<" + JAVA_IDENT_RE + "~~~(?:\\s*,\\s*" + JAVA_IDENT_RE + "~~~)*>)?", /~~~/g, 2); 2246 const MAIN_KEYWORDS = [ 2247 "synchronized", 2248 "abstract", 2249 "private", 2250 "var", 2251 "static", 2252 "if", 2253 "const ", 2254 "for", 2255 "while", 2256 "strictfp", 2257 "finally", 2258 "protected", 2259 "import", 2260 "native", 2261 "final", 2262 "void", 2263 "enum", 2264 "else", 2265 "break", 2266 "transient", 2267 "catch", 2268 "instanceof", 2269 "volatile", 2270 "case", 2271 "assert", 2272 "package", 2273 "default", 2274 "public", 2275 "try", 2276 "switch", 2277 "continue", 2278 "throws", 2279 "protected", 2280 "public", 2281 "private", 2282 "module", 2283 "requires", 2284 "exports", 2285 "do", 2286 "sealed", 2287 "yield", 2288 "permits", 2289 "goto", 2290 "when" 2291 ]; 2292 const BUILT_INS2 = [ 2293 "super", 2294 "this" 2295 ]; 2296 const LITERALS2 = [ 2297 "false", 2298 "true", 2299 "null" 2300 ]; 2301 const TYPES2 = [ 2302 "char", 2303 "boolean", 2304 "long", 2305 "float", 2306 "int", 2307 "byte", 2308 "short", 2309 "double" 2310 ]; 2311 const KEYWORDS2 = { 2312 keyword: MAIN_KEYWORDS, 2313 literal: LITERALS2, 2314 type: TYPES2, 2315 built_in: BUILT_INS2 2316 }; 2317 const ANNOTATION = { 2318 className: "meta", 2319 begin: "@" + JAVA_IDENT_RE, 2320 contains: [ 2321 { 2322 begin: /\(/, 2323 end: /\)/, 2324 contains: ["self"] 2325 // allow nested () inside our annotation 2326 } 2327 ] 2328 }; 2329 const PARAMS = { 2330 className: "params", 2331 begin: /\(/, 2332 end: /\)/, 2333 keywords: KEYWORDS2, 2334 relevance: 0, 2335 contains: [hljs.C_BLOCK_COMMENT_MODE], 2336 endsParent: true 2337 }; 2338 return { 2339 name: "Java", 2340 aliases: ["jsp"], 2341 keywords: KEYWORDS2, 2342 illegal: /<\/|#/, 2343 contains: [ 2344 hljs.COMMENT( 2345 "/\\*\\*", 2346 "\\*/", 2347 { 2348 relevance: 0, 2349 contains: [ 2350 { 2351 // eat up @'s in emails to prevent them to be recognized as doctags 2352 begin: /\w+@/, 2353 relevance: 0 2354 }, 2355 { 2356 className: "doctag", 2357 begin: "@[A-Za-z]+" 2358 } 2359 ] 2360 } 2361 ), 2362 // relevance boost 2363 { 2364 begin: /import java\.[a-z]+\./, 2365 keywords: "import", 2366 relevance: 2 2367 }, 2368 hljs.C_LINE_COMMENT_MODE, 2369 hljs.C_BLOCK_COMMENT_MODE, 2370 { 2371 begin: /"""/, 2372 end: /"""/, 2373 className: "string", 2374 contains: [hljs.BACKSLASH_ESCAPE] 2375 }, 2376 hljs.APOS_STRING_MODE, 2377 hljs.QUOTE_STRING_MODE, 2378 { 2379 match: [ 2380 /\b(?:class|interface|enum|extends|implements|new)/, 2381 /\s+/, 2382 JAVA_IDENT_RE 2383 ], 2384 className: { 2385 1: "keyword", 2386 3: "title.class" 2387 } 2388 }, 2389 { 2390 // Exceptions for hyphenated keywords 2391 match: /non-sealed/, 2392 scope: "keyword" 2393 }, 2394 { 2395 begin: [ 2396 regex.concat(/(?!else)/, JAVA_IDENT_RE), 2397 /\s+/, 2398 JAVA_IDENT_RE, 2399 /\s+/, 2400 /=(?!=)/ 2401 ], 2402 className: { 2403 1: "type", 2404 3: "variable", 2405 5: "operator" 2406 } 2407 }, 2408 { 2409 begin: [ 2410 /record/, 2411 /\s+/, 2412 JAVA_IDENT_RE 2413 ], 2414 className: { 2415 1: "keyword", 2416 3: "title.class" 2417 }, 2418 contains: [ 2419 PARAMS, 2420 hljs.C_LINE_COMMENT_MODE, 2421 hljs.C_BLOCK_COMMENT_MODE 2422 ] 2423 }, 2424 { 2425 // Expression keywords prevent 'keyword Name(...)' from being 2426 // recognized as a function definition 2427 beginKeywords: "new throw return else", 2428 relevance: 0 2429 }, 2430 { 2431 begin: [ 2432 "(?:" + GENERIC_IDENT_RE + "\\s+)", 2433 hljs.UNDERSCORE_IDENT_RE, 2434 /\s*(?=\()/ 2435 ], 2436 className: { 2: "title.function" }, 2437 keywords: KEYWORDS2, 2438 contains: [ 2439 { 2440 className: "params", 2441 begin: /\(/, 2442 end: /\)/, 2443 keywords: KEYWORDS2, 2444 relevance: 0, 2445 contains: [ 2446 ANNOTATION, 2447 hljs.APOS_STRING_MODE, 2448 hljs.QUOTE_STRING_MODE, 2449 NUMERIC, 2450 hljs.C_BLOCK_COMMENT_MODE 2451 ] 2452 }, 2453 hljs.C_LINE_COMMENT_MODE, 2454 hljs.C_BLOCK_COMMENT_MODE 2455 ] 2456 }, 2457 NUMERIC, 2458 ANNOTATION 2459 ] 2460 }; 2461} 2462
vendor: 16,124 bytes, lines 2463-3163
2463// node_modules/highlight.js/es/languages/javascript.js 2464var IDENT_RE = "[A-Za-z$_][0-9A-Za-z$_]*"; 2465var KEYWORDS = [ 2466 "as", 2467 // for exports 2468 "in", 2469 "of", 2470 "if", 2471 "for", 2472 "while", 2473 "finally", 2474 "var", 2475 "new", 2476 "function", 2477 "do", 2478 "return", 2479 "void", 2480 "else", 2481 "break", 2482 "catch", 2483 "instanceof", 2484 "with", 2485 "throw", 2486 "case", 2487 "default", 2488 "try", 2489 "switch", 2490 "continue", 2491 "typeof", 2492 "delete", 2493 "let", 2494 "yield", 2495 "const", 2496 "class", 2497 // JS handles these with a special rule 2498 // "get", 2499 // "set", 2500 "debugger", 2501 "async", 2502 "await", 2503 "static", 2504 "import", 2505 "from", 2506 "export", 2507 "extends", 2508 // It's reached stage 3, which is "recommended for implementation": 2509 "using" 2510]; 2511var LITERALS = [ 2512 "true", 2513 "false", 2514 "null", 2515 "undefined", 2516 "NaN", 2517 "Infinity" 2518]; 2519var TYPES = [ 2520 // Fundamental objects 2521 "Object", 2522 "Function", 2523 "Boolean", 2524 "Symbol", 2525 // numbers and dates 2526 "Math", 2527 "Date", 2528 "Number", 2529 "BigInt", 2530 // text 2531 "String", 2532 "RegExp", 2533 // Indexed collections 2534 "Array", 2535 "Float32Array", 2536 "Float64Array", 2537 "Int8Array", 2538 "Uint8Array", 2539 "Uint8ClampedArray", 2540 "Int16Array", 2541 "Int32Array", 2542 "Uint16Array", 2543 "Uint32Array", 2544 "BigInt64Array", 2545 "BigUint64Array", 2546 // Keyed collections 2547 "Set", 2548 "Map", 2549 "WeakSet", 2550 "WeakMap", 2551 // Structured data 2552 "ArrayBuffer", 2553 "SharedArrayBuffer", 2554 "Atomics", 2555 "DataView", 2556 "JSON", 2557 // Control abstraction objects 2558 "Promise", 2559 "Generator", 2560 "GeneratorFunction", 2561 "AsyncFunction", 2562 // Reflection 2563 "Reflect", 2564 "Proxy", 2565 // Internationalization 2566 "Intl", 2567 // WebAssembly 2568 "WebAssembly" 2569]; 2570var ERROR_TYPES = [ 2571 "Error", 2572 "EvalError", 2573 "InternalError", 2574 "RangeError", 2575 "ReferenceError", 2576 "SyntaxError", 2577 "TypeError", 2578 "URIError" 2579]; 2580var BUILT_IN_GLOBALS = [ 2581 "setInterval", 2582 "setTimeout", 2583 "clearInterval", 2584 "clearTimeout", 2585 "require", 2586 "exports", 2587 "eval", 2588 "isFinite", 2589 "isNaN", 2590 "parseFloat", 2591 "parseInt", 2592 "decodeURI", 2593 "decodeURIComponent", 2594 "encodeURI", 2595 "encodeURIComponent", 2596 "escape", 2597 "unescape" 2598]; 2599var BUILT_IN_VARIABLES = [ 2600 "arguments", 2601 "this", 2602 "super", 2603 "console", 2604 "window", 2605 "document", 2606 "localStorage", 2607 "sessionStorage", 2608 "module", 2609 "global" 2610 // Node.js 2611]; 2612var BUILT_INS = [].concat( 2613 BUILT_IN_GLOBALS, 2614 TYPES, 2615 ERROR_TYPES 2616); 2617function javascript(hljs) { 2618 const regex = hljs.regex; 2619 const hasClosingTag = (match, { after }) => { 2620 const tag = "</" + match[0].slice(1); 2621 const pos = match.input.indexOf(tag, after); 2622 return pos !== -1; 2623 }; 2624 const IDENT_RE$1 = IDENT_RE; 2625 const FRAGMENT = { 2626 begin: "<>", 2627 end: "</>" 2628 }; 2629 const XML_SELF_CLOSING = /<[A-Za-z0-9\\._:-]+\s*\/>/; 2630 const XML_TAG = { 2631 begin: /<[A-Za-z0-9\\._:-]+/, 2632 end: /\/[A-Za-z0-9\\._:-]+>|\/>/, 2633 /** 2634 * @param {RegExpMatchArray} match 2635 * @param {CallbackResponse} response 2636 */ 2637 isTrulyOpeningTag: (match, response) => { 2638 const afterMatchIndex = match[0].length + match.index; 2639 const nextChar = match.input[afterMatchIndex]; 2640 if ( 2641 // HTML should not include another raw `<` inside a tag 2642 // nested type? 2643 // `<Array<Array<number>>`, etc. 2644 nextChar === "<" || // the , gives away that this is not HTML 2645 // `<T, A extends keyof T, V>` 2646 nextChar === "," 2647 ) { 2648 response.ignoreMatch(); 2649 return; 2650 } 2651 if (nextChar === ">") { 2652 if (!hasClosingTag(match, { after: afterMatchIndex })) { 2653 response.ignoreMatch(); 2654 } 2655 } 2656 let m; 2657 const afterMatch = match.input.substring(afterMatchIndex); 2658 if (m = afterMatch.match(/^\s*=/)) { 2659 response.ignoreMatch(); 2660 return; 2661 } 2662 if (m = afterMatch.match(/^\s+extends\s+/)) { 2663 if (m.index === 0) { 2664 response.ignoreMatch(); 2665 return; 2666 } 2667 } 2668 } 2669 }; 2670 const KEYWORDS$1 = { 2671 $pattern: IDENT_RE, 2672 keyword: KEYWORDS, 2673 literal: LITERALS, 2674 built_in: BUILT_INS, 2675 "variable.language": BUILT_IN_VARIABLES 2676 }; 2677 const decimalDigits3 = "[0-9](_?[0-9])*"; 2678 const frac3 = `\\.(${decimalDigits3})`; 2679 const decimalInteger = `0|[1-9](_?[0-9])*|0[0-7]*[89][0-9]*`; 2680 const NUMBER = { 2681 className: "number", 2682 variants: [ 2683 // DecimalLiteral 2684 { begin: `(\\b(${decimalInteger})((${frac3})|\\.)?|(${frac3}))[eE][+-]?(${decimalDigits3})\\b` }, 2685 { begin: `\\b(${decimalInteger})\\b((${frac3})\\b|\\.)?|(${frac3})\\b` }, 2686 // DecimalBigIntegerLiteral 2687 { begin: `\\b(0|[1-9](_?[0-9])*)n\\b` }, 2688 // NonDecimalIntegerLiteral 2689 { begin: "\\b0[xX][0-9a-fA-F](_?[0-9a-fA-F])*n?\\b" }, 2690 { begin: "\\b0[bB][0-1](_?[0-1])*n?\\b" }, 2691 { begin: "\\b0[oO][0-7](_?[0-7])*n?\\b" }, 2692 // LegacyOctalIntegerLiteral (does not include underscore separators) 2693 // https://tc39.es/ecma262/#sec-additional-syntax-numeric-literals 2694 { begin: "\\b0[0-7]+n?\\b" } 2695 ], 2696 relevance: 0 2697 }; 2698 const SUBST = { 2699 className: "subst", 2700 begin: "\\$\\{", 2701 end: "\\}", 2702 keywords: KEYWORDS$1, 2703 contains: [] 2704 // defined later 2705 }; 2706 const HTML_TEMPLATE = { 2707 begin: ".?html`", 2708 end: "", 2709 starts: { 2710 end: "`", 2711 returnEnd: false, 2712 contains: [ 2713 hljs.BACKSLASH_ESCAPE, 2714 SUBST 2715 ], 2716 subLanguage: "xml" 2717 } 2718 }; 2719 const CSS_TEMPLATE = { 2720 begin: ".?css`", 2721 end: "", 2722 starts: { 2723 end: "`", 2724 returnEnd: false, 2725 contains: [ 2726 hljs.BACKSLASH_ESCAPE, 2727 SUBST 2728 ], 2729 subLanguage: "css" 2730 } 2731 }; 2732 const GRAPHQL_TEMPLATE = { 2733 begin: ".?gql`", 2734 end: "", 2735 starts: { 2736 end: "`", 2737 returnEnd: false, 2738 contains: [ 2739 hljs.BACKSLASH_ESCAPE, 2740 SUBST 2741 ], 2742 subLanguage: "graphql" 2743 } 2744 }; 2745 const TEMPLATE_STRING = { 2746 className: "string", 2747 begin: "`", 2748 end: "`", 2749 contains: [ 2750 hljs.BACKSLASH_ESCAPE, 2751 SUBST 2752 ] 2753 }; 2754 const JSDOC_COMMENT = hljs.COMMENT( 2755 /\/\*\*(?!\/)/, 2756 "\\*/", 2757 { 2758 relevance: 0, 2759 contains: [ 2760 { 2761 begin: "(?=@[A-Za-z]+)", 2762 relevance: 0, 2763 contains: [ 2764 { 2765 className: "doctag", 2766 begin: "@[A-Za-z]+" 2767 }, 2768 { 2769 className: "type", 2770 begin: "\\{", 2771 end: "\\}", 2772 excludeEnd: true, 2773 excludeBegin: true, 2774 relevance: 0 2775 }, 2776 { 2777 className: "variable", 2778 begin: IDENT_RE$1 + "(?=\\s*(-)|$)", 2779 endsParent: true, 2780 relevance: 0 2781 }, 2782 // eat spaces (not newlines) so we can find 2783 // types or variables 2784 { 2785 begin: /(?=[^\n])\s/, 2786 relevance: 0 2787 } 2788 ] 2789 } 2790 ] 2791 } 2792 ); 2793 const COMMENT = { 2794 className: "comment", 2795 variants: [ 2796 JSDOC_COMMENT, 2797 hljs.C_BLOCK_COMMENT_MODE, 2798 hljs.C_LINE_COMMENT_MODE 2799 ] 2800 }; 2801 const SUBST_INTERNALS = [ 2802 hljs.APOS_STRING_MODE, 2803 hljs.QUOTE_STRING_MODE, 2804 HTML_TEMPLATE, 2805 CSS_TEMPLATE, 2806 GRAPHQL_TEMPLATE, 2807 TEMPLATE_STRING, 2808 // Skip numbers when they are part of a variable name 2809 { match: /\$\d+/ }, 2810 NUMBER 2811 // This is intentional: 2812 // See https://github.com/highlightjs/highlight.js/issues/3288 2813 // hljs.REGEXP_MODE 2814 ]; 2815 SUBST.contains = SUBST_INTERNALS.concat({ 2816 // we need to pair up {} inside our subst to prevent 2817 // it from ending too early by matching another } 2818 begin: /\{/, 2819 end: /\}/, 2820 keywords: KEYWORDS$1, 2821 contains: [ 2822 "self" 2823 ].concat(SUBST_INTERNALS) 2824 }); 2825 const SUBST_AND_COMMENTS = [].concat(COMMENT, SUBST.contains); 2826 const PARAMS_CONTAINS = SUBST_AND_COMMENTS.concat([ 2827 // eat recursive parens in sub expressions 2828 { 2829 begin: /(\s*)\(/, 2830 end: /\)/, 2831 keywords: KEYWORDS$1, 2832 contains: ["self"].concat(SUBST_AND_COMMENTS) 2833 } 2834 ]); 2835 const PARAMS = { 2836 className: "params", 2837 // convert this to negative lookbehind in v12 2838 begin: /(\s*)\(/, 2839 // to match the parms with 2840 end: /\)/, 2841 excludeBegin: true, 2842 excludeEnd: true, 2843 keywords: KEYWORDS$1, 2844 contains: PARAMS_CONTAINS 2845 }; 2846 const CLASS_OR_EXTENDS = { 2847 variants: [ 2848 // class Car extends vehicle 2849 { 2850 match: [ 2851 /class/, 2852 /\s+/, 2853 IDENT_RE$1, 2854 /\s+/, 2855 /extends/, 2856 /\s+/, 2857 regex.concat(IDENT_RE$1, "(", regex.concat(/\./, IDENT_RE$1), ")*") 2858 ], 2859 scope: { 2860 1: "keyword", 2861 3: "title.class", 2862 5: "keyword", 2863 7: "title.class.inherited" 2864 } 2865 }, 2866 // class Car 2867 { 2868 match: [ 2869 /class/, 2870 /\s+/, 2871 IDENT_RE$1 2872 ], 2873 scope: { 2874 1: "keyword", 2875 3: "title.class" 2876 } 2877 } 2878 ] 2879 }; 2880 const CLASS_REFERENCE = { 2881 relevance: 0, 2882 match: regex.either( 2883 // Hard coded exceptions 2884 /\bJSON/, 2885 // Float32Array, OutT 2886 /\b[A-Z][a-z]+([A-Z][a-z]*|\d)*/, 2887 // CSSFactory, CSSFactoryT 2888 /\b[A-Z]{2,}([A-Z][a-z]+|\d)+([A-Z][a-z]*)*/, 2889 // FPs, FPsT 2890 /\b[A-Z]{2,}[a-z]+([A-Z][a-z]+|\d)*([A-Z][a-z]*)*/ 2891 // P 2892 // single letters are not highlighted 2893 // BLAH 2894 // this will be flagged as a UPPER_CASE_CONSTANT instead 2895 ), 2896 className: "title.class", 2897 keywords: { 2898 _: [ 2899 // se we still get relevance credit for JS library classes 2900 ...TYPES, 2901 ...ERROR_TYPES 2902 ] 2903 } 2904 }; 2905 const USE_STRICT = { 2906 label: "use_strict", 2907 className: "meta", 2908 relevance: 10, 2909 begin: /^\s*['"]use (strict|asm)['"]/ 2910 }; 2911 const FUNCTION_DEFINITION = { 2912 variants: [ 2913 { 2914 match: [ 2915 /function/, 2916 /\s+/, 2917 IDENT_RE$1, 2918 /(?=\s*\()/ 2919 ] 2920 }, 2921 // anonymous function 2922 { 2923 match: [ 2924 /function/, 2925 /\s*(?=\()/ 2926 ] 2927 } 2928 ], 2929 className: { 2930 1: "keyword", 2931 3: "title.function" 2932 }, 2933 label: "func.def", 2934 contains: [PARAMS], 2935 illegal: /%/ 2936 }; 2937 const UPPER_CASE_CONSTANT = { 2938 relevance: 0, 2939 match: /\b[A-Z][A-Z_0-9]+\b/, 2940 className: "variable.constant" 2941 }; 2942 function noneOf(list) { 2943 return regex.concat("(?!", list.join("|"), ")"); 2944 } 2945 const FUNCTION_CALL = { 2946 match: regex.concat( 2947 /\b/, 2948 noneOf([ 2949 ...BUILT_IN_GLOBALS, 2950 "super", 2951 "import" 2952 ].map((x) => `${x}\\s*\\(`)), 2953 IDENT_RE$1, 2954 regex.lookahead(/\s*\(/) 2955 ), 2956 className: "title.function", 2957 relevance: 0 2958 }; 2959 const PROPERTY_ACCESS = { 2960 begin: regex.concat(/\./, regex.lookahead( 2961 regex.concat(IDENT_RE$1, /(?![0-9A-Za-z$_(])/) 2962 )), 2963 end: IDENT_RE$1, 2964 excludeBegin: true, 2965 keywords: "prototype", 2966 className: "property", 2967 relevance: 0 2968 }; 2969 const GETTER_OR_SETTER = { 2970 match: [ 2971 /get|set/, 2972 /\s+/, 2973 IDENT_RE$1, 2974 /(?=\()/ 2975 ], 2976 className: { 2977 1: "keyword", 2978 3: "title.function" 2979 }, 2980 contains: [ 2981 { 2982 // eat to avoid empty params 2983 begin: /\(\)/ 2984 }, 2985 PARAMS 2986 ] 2987 }; 2988 const FUNC_LEAD_IN_RE = "(\\([^()]*(\\([^()]*(\\([^()]*\\)[^()]*)*\\)[^()]*)*\\)|" + hljs.UNDERSCORE_IDENT_RE + ")\\s*=>"; 2989 const FUNCTION_VARIABLE = { 2990 match: [ 2991 /const|var|let/, 2992 /\s+/, 2993 IDENT_RE$1, 2994 /\s*/, 2995 /=\s*/, 2996 /(async\s*)?/, 2997 // async is optional 2998 regex.lookahead(FUNC_LEAD_IN_RE) 2999 ], 3000 keywords: "async", 3001 className: { 3002 1: "keyword", 3003 3: "title.function" 3004 }, 3005 contains: [ 3006 PARAMS 3007 ] 3008 }; 3009 return { 3010 name: "JavaScript", 3011 aliases: ["js", "jsx", "mjs", "cjs"], 3012 keywords: KEYWORDS$1, 3013 // this will be extended by TypeScript 3014 exports: { PARAMS_CONTAINS, CLASS_REFERENCE }, 3015 illegal: /#(?![$_A-z])/, 3016 contains: [ 3017 hljs.SHEBANG({ 3018 label: "shebang", 3019 binary: "node", 3020 relevance: 5 3021 }), 3022 USE_STRICT, 3023 hljs.APOS_STRING_MODE, 3024 hljs.QUOTE_STRING_MODE, 3025 HTML_TEMPLATE, 3026 CSS_TEMPLATE, 3027 GRAPHQL_TEMPLATE, 3028 TEMPLATE_STRING, 3029 COMMENT, 3030 // Skip numbers when they are part of a variable name 3031 { match: /\$\d+/ }, 3032 NUMBER, 3033 CLASS_REFERENCE, 3034 { 3035 scope: "attr", 3036 match: IDENT_RE$1 + regex.lookahead(":"), 3037 relevance: 0 3038 }, 3039 FUNCTION_VARIABLE, 3040 { 3041 // "value" container 3042 begin: "(" + hljs.RE_STARTERS_RE + "|\\b(case|return|throw)\\b)\\s*", 3043 keywords: "return throw case", 3044 relevance: 0, 3045 contains: [ 3046 COMMENT, 3047 hljs.REGEXP_MODE, 3048 { 3049 className: "function", 3050 // we have to count the parens to make sure we actually have the 3051 // correct bounding ( ) before the =>. There could be any number of 3052 // sub-expressions inside also surrounded by parens. 3053 begin: FUNC_LEAD_IN_RE, 3054 returnBegin: true, 3055 end: "\\s*=>", 3056 contains: [ 3057 { 3058 className: "params", 3059 variants: [ 3060 { 3061 begin: hljs.UNDERSCORE_IDENT_RE, 3062 relevance: 0 3063 }, 3064 { 3065 className: null, 3066 begin: /\(\s*\)/, 3067 skip: true 3068 }, 3069 { 3070 begin: /(\s*)\(/, 3071 end: /\)/, 3072 excludeBegin: true, 3073 excludeEnd: true, 3074 keywords: KEYWORDS$1, 3075 contains: PARAMS_CONTAINS 3076 } 3077 ] 3078 } 3079 ] 3080 }, 3081 { 3082 // could be a comma delimited list of params to a function call 3083 begin: /,/, 3084 relevance: 0 3085 }, 3086 { 3087 match: /\s+/, 3088 relevance: 0 3089 }, 3090 { 3091 // JSX 3092 variants: [ 3093 { begin: FRAGMENT.begin, end: FRAGMENT.end }, 3094 { match: XML_SELF_CLOSING }, 3095 { 3096 begin: XML_TAG.begin, 3097 // we carefully check the opening tag to see if it truly 3098 // is a tag and not a false positive 3099 "on:begin": XML_TAG.isTrulyOpeningTag, 3100 end: XML_TAG.end 3101 } 3102 ], 3103 subLanguage: "xml", 3104 contains: [ 3105 { 3106 begin: XML_TAG.begin, 3107 end: XML_TAG.end, 3108 skip: true, 3109 contains: ["self"] 3110 } 3111 ] 3112 } 3113 ] 3114 }, 3115 FUNCTION_DEFINITION, 3116 { 3117 // prevent this from getting swallowed up by function 3118 // since they appear "function like" 3119 beginKeywords: "while if switch catch for" 3120 }, 3121 { 3122 // we have to count the parens to make sure we actually have the correct 3123 // bounding ( ). There could be any number of sub-expressions inside 3124 // also surrounded by parens. 3125 begin: "\\b(?!function)" + hljs.UNDERSCORE_IDENT_RE + "\\([^()]*(\\([^()]*(\\([^()]*\\)[^()]*)*\\)[^()]*)*\\)\\s*\\{", 3126 // end parens 3127 returnBegin: true, 3128 label: "func.def", 3129 contains: [ 3130 PARAMS, 3131 hljs.inherit(hljs.TITLE_MODE, { begin: IDENT_RE$1, className: "title.function" }) 3132 ] 3133 }, 3134 // catch ... so it won't trigger the property rule below 3135 { 3136 match: /\.\.\./, 3137 relevance: 0 3138 }, 3139 PROPERTY_ACCESS, 3140 // hack: prevents detection of keywords in some circumstances 3141 // .keyword() 3142 // $keyword = x 3143 { 3144 match: "\\$" + IDENT_RE$1, 3145 relevance: 0 3146 }, 3147 { 3148 match: [/\bconstructor(?=\s*\()/], 3149 className: { 1: "title.function" }, 3150 contains: [PARAMS] 3151 }, 3152 FUNCTION_CALL, 3153 UPPER_CASE_CONSTANT, 3154 CLASS_OR_EXTENDS, 3155 GETTER_OR_SETTER, 3156 { 3157 match: /\$[(.]/ 3158 // relevance booster for a pattern common to JS libs: `$(something)` and `$.something` 3159 } 3160 ] 3161 }; 3162} 3163
vendor: 767 bytes, lines 3164-3203
3164// node_modules/highlight.js/es/languages/json.js 3165function json(hljs) { 3166 const ATTRIBUTE = { 3167 className: "attr", 3168 begin: /"(\\.|[^\\"\r\n])*"(?=\s*:)/, 3169 relevance: 1.01 3170 }; 3171 const PUNCTUATION = { 3172 match: /[{}[\],:]/, 3173 className: "punctuation", 3174 relevance: 0 3175 }; 3176 const LITERALS2 = [ 3177 "true", 3178 "false", 3179 "null" 3180 ]; 3181 const LITERALS_MODE = { 3182 scope: "literal", 3183 beginKeywords: LITERALS2.join(" ") 3184 }; 3185 return { 3186 name: "JSON", 3187 aliases: ["jsonc"], 3188 keywords: { 3189 literal: LITERALS2 3190 }, 3191 contains: [ 3192 ATTRIBUTE, 3193 PUNCTUATION, 3194 hljs.QUOTE_STRING_MODE, 3195 LITERALS_MODE, 3196 hljs.C_NUMBER_MODE, 3197 hljs.C_LINE_COMMENT_MODE, 3198 hljs.C_BLOCK_COMMENT_MODE 3199 ], 3200 illegal: "\\S" 3201 }; 3202} 3203
vendor: 6,844 bytes, lines 3204-3458
3204// node_modules/highlight.js/es/languages/kotlin.js 3205var decimalDigits2 = "[0-9](_*[0-9])*"; 3206var frac2 = `\\.(${decimalDigits2})`; 3207var hexDigits2 = "[0-9a-fA-F](_*[0-9a-fA-F])*"; 3208var NUMERIC2 = { 3209 className: "number", 3210 variants: [ 3211 // DecimalFloatingPointLiteral 3212 // including ExponentPart 3213 { begin: `(\\b(${decimalDigits2})((${frac2})|\\.)?|(${frac2}))[eE][+-]?(${decimalDigits2})[fFdD]?\\b` }, 3214 // excluding ExponentPart 3215 { begin: `\\b(${decimalDigits2})((${frac2})[fFdD]?\\b|\\.([fFdD]\\b)?)` }, 3216 { begin: `(${frac2})[fFdD]?\\b` }, 3217 { begin: `\\b(${decimalDigits2})[fFdD]\\b` }, 3218 // HexadecimalFloatingPointLiteral 3219 { begin: `\\b0[xX]((${hexDigits2})\\.?|(${hexDigits2})?\\.(${hexDigits2}))[pP][+-]?(${decimalDigits2})[fFdD]?\\b` }, 3220 // DecimalIntegerLiteral 3221 { begin: "\\b(0|[1-9](_*[0-9])*)[lL]?\\b" }, 3222 // HexIntegerLiteral 3223 { begin: `\\b0[xX](${hexDigits2})[lL]?\\b` }, 3224 // OctalIntegerLiteral 3225 { begin: "\\b0(_*[0-7])*[lL]?\\b" }, 3226 // BinaryIntegerLiteral 3227 { begin: "\\b0[bB][01](_*[01])*[lL]?\\b" } 3228 ], 3229 relevance: 0 3230}; 3231function kotlin(hljs) { 3232 const KEYWORDS2 = { 3233 keyword: "abstract as val var vararg get set class object open private protected public noinline crossinline dynamic final enum if else do while for when throw try catch finally import package is in fun override companion reified inline lateinit init interface annotation data sealed internal infix operator out by constructor super tailrec where const inner suspend typealias external expect actual", 3234 built_in: "Byte Short Char Int Long Boolean Float Double Void Unit Nothing", 3235 literal: "true false null" 3236 }; 3237 const KEYWORDS_WITH_LABEL = { 3238 className: "keyword", 3239 begin: /\b(break|continue|return|this)\b/, 3240 starts: { contains: [ 3241 { 3242 className: "symbol", 3243 begin: /@\w+/ 3244 } 3245 ] } 3246 }; 3247 const LABEL = { 3248 className: "symbol", 3249 begin: hljs.UNDERSCORE_IDENT_RE + "@" 3250 }; 3251 const SUBST = { 3252 className: "subst", 3253 begin: /\$\{/, 3254 end: /\}/, 3255 contains: [hljs.C_NUMBER_MODE] 3256 }; 3257 const VARIABLE = { 3258 className: "variable", 3259 begin: "\\$" + hljs.UNDERSCORE_IDENT_RE 3260 }; 3261 const STRING = { 3262 className: "string", 3263 variants: [ 3264 { 3265 begin: '"""', 3266 end: '"""(?=[^"])', 3267 contains: [ 3268 VARIABLE, 3269 SUBST 3270 ] 3271 }, 3272 // Can't use built-in modes easily, as we want to use STRING in the meta 3273 // context as 'meta-string' and there's no syntax to remove explicitly set 3274 // classNames in built-in modes. 3275 { 3276 begin: "'", 3277 end: "'", 3278 illegal: /\n/, 3279 contains: [hljs.BACKSLASH_ESCAPE] 3280 }, 3281 { 3282 begin: '"', 3283 end: '"', 3284 illegal: /\n/, 3285 contains: [ 3286 hljs.BACKSLASH_ESCAPE, 3287 VARIABLE, 3288 SUBST 3289 ] 3290 } 3291 ] 3292 }; 3293 SUBST.contains.push(STRING); 3294 const ANNOTATION_USE_SITE = { 3295 className: "meta", 3296 begin: "@(?:file|property|field|get|set|receiver|param|setparam|delegate)\\s*:(?:\\s*" + hljs.UNDERSCORE_IDENT_RE + ")?" 3297 }; 3298 const ANNOTATION = { 3299 className: "meta", 3300 begin: "@" + hljs.UNDERSCORE_IDENT_RE, 3301 contains: [ 3302 { 3303 begin: /\(/, 3304 end: /\)/, 3305 contains: [ 3306 hljs.inherit(STRING, { className: "string" }), 3307 "self" 3308 ] 3309 } 3310 ] 3311 }; 3312 const KOTLIN_NUMBER_MODE = NUMERIC2; 3313 const KOTLIN_NESTED_COMMENT = hljs.COMMENT( 3314 "/\\*", 3315 "\\*/", 3316 { contains: [hljs.C_BLOCK_COMMENT_MODE] } 3317 ); 3318 const KOTLIN_PAREN_TYPE = { variants: [ 3319 { 3320 className: "type", 3321 begin: hljs.UNDERSCORE_IDENT_RE 3322 }, 3323 { 3324 begin: /\(/, 3325 end: /\)/, 3326 contains: [] 3327 // defined later 3328 } 3329 ] }; 3330 const KOTLIN_PAREN_TYPE2 = KOTLIN_PAREN_TYPE; 3331 KOTLIN_PAREN_TYPE2.variants[1].contains = [KOTLIN_PAREN_TYPE]; 3332 KOTLIN_PAREN_TYPE.variants[1].contains = [KOTLIN_PAREN_TYPE2]; 3333 return { 3334 name: "Kotlin", 3335 aliases: [ 3336 "kt", 3337 "kts" 3338 ], 3339 keywords: KEYWORDS2, 3340 contains: [ 3341 hljs.COMMENT( 3342 "/\\*\\*", 3343 "\\*/", 3344 { 3345 relevance: 0, 3346 contains: [ 3347 { 3348 className: "doctag", 3349 begin: "@[A-Za-z]+" 3350 } 3351 ] 3352 } 3353 ), 3354 hljs.C_LINE_COMMENT_MODE, 3355 KOTLIN_NESTED_COMMENT, 3356 KEYWORDS_WITH_LABEL, 3357 LABEL, 3358 ANNOTATION_USE_SITE, 3359 ANNOTATION, 3360 { 3361 className: "function", 3362 beginKeywords: "fun", 3363 end: "[(]|$", 3364 returnBegin: true, 3365 excludeEnd: true, 3366 keywords: KEYWORDS2, 3367 relevance: 5, 3368 contains: [ 3369 { 3370 begin: hljs.UNDERSCORE_IDENT_RE + "\\s*\\(", 3371 returnBegin: true, 3372 relevance: 0, 3373 contains: [hljs.UNDERSCORE_TITLE_MODE] 3374 }, 3375 { 3376 className: "type", 3377 begin: /</, 3378 end: />/, 3379 keywords: "reified", 3380 relevance: 0 3381 }, 3382 { 3383 className: "params", 3384 begin: /\(/, 3385 end: /\)/, 3386 endsParent: true, 3387 keywords: KEYWORDS2, 3388 relevance: 0, 3389 contains: [ 3390 { 3391 begin: /:/, 3392 end: /[=,\/]/, 3393 endsWithParent: true, 3394 contains: [ 3395 KOTLIN_PAREN_TYPE, 3396 hljs.C_LINE_COMMENT_MODE, 3397 KOTLIN_NESTED_COMMENT 3398 ], 3399 relevance: 0 3400 }, 3401 hljs.C_LINE_COMMENT_MODE, 3402 KOTLIN_NESTED_COMMENT, 3403 ANNOTATION_USE_SITE, 3404 ANNOTATION, 3405 STRING, 3406 hljs.C_NUMBER_MODE 3407 ] 3408 }, 3409 KOTLIN_NESTED_COMMENT 3410 ] 3411 }, 3412 { 3413 begin: [ 3414 /class|interface|trait/, 3415 /\s+/, 3416 hljs.UNDERSCORE_IDENT_RE 3417 ], 3418 beginScope: { 3419 3: "title.class" 3420 }, 3421 keywords: "class interface trait", 3422 end: /[:\{(]|$/, 3423 excludeEnd: true, 3424 illegal: "extends implements", 3425 contains: [ 3426 { beginKeywords: "public protected internal private constructor" }, 3427 hljs.UNDERSCORE_TITLE_MODE, 3428 { 3429 className: "type", 3430 begin: /</, 3431 end: />/, 3432 excludeBegin: true, 3433 excludeEnd: true, 3434 relevance: 0 3435 }, 3436 { 3437 className: "type", 3438 begin: /[,:]\s*/, 3439 end: /[<\(,){\s]|$/, 3440 excludeBegin: true, 3441 returnEnd: true 3442 }, 3443 ANNOTATION_USE_SITE, 3444 ANNOTATION 3445 ] 3446 }, 3447 STRING, 3448 { 3449 className: "meta", 3450 begin: "^#!/usr/bin/env", 3451 end: "$", 3452 illegal: "\n" 3453 }, 3454 KOTLIN_NUMBER_MODE 3455 ] 3456 }; 3457} 3458
vendor: 13,767 bytes, lines 3459-4059
3459// node_modules/highlight.js/es/languages/php.js 3460function php(hljs) { 3461 const regex = hljs.regex; 3462 const NOT_PERL_ETC = /(?![A-Za-z0-9])(?![$])/; 3463 const IDENT_RE2 = regex.concat( 3464 /[a-zA-Z_\x7f-\xff][a-zA-Z0-9_\x7f-\xff]*/, 3465 NOT_PERL_ETC 3466 ); 3467 const PASCAL_CASE_CLASS_NAME_RE = regex.concat( 3468 /(\\?[A-Z][a-z0-9_\x7f-\xff]+|\\?[A-Z]+(?=[A-Z][a-z0-9_\x7f-\xff])){1,}/, 3469 NOT_PERL_ETC 3470 ); 3471 const UPCASE_NAME_RE = regex.concat( 3472 /[A-Z]+/, 3473 NOT_PERL_ETC 3474 ); 3475 const VARIABLE = { 3476 scope: "variable", 3477 match: "\\$+" + IDENT_RE2 3478 }; 3479 const PREPROCESSOR = { 3480 scope: "meta", 3481 variants: [ 3482 { begin: /<\?php/, relevance: 10 }, 3483 // boost for obvious PHP 3484 { begin: /<\?=/ }, 3485 // less relevant per PSR-1 which says not to use short-tags 3486 { begin: /<\?/, relevance: 0.1 }, 3487 { begin: /\?>/ } 3488 // end php tag 3489 ] 3490 }; 3491 const SUBST = { 3492 scope: "subst", 3493 variants: [ 3494 { begin: /\$\w+/ }, 3495 { 3496 begin: /\{\$/, 3497 end: /\}/ 3498 } 3499 ] 3500 }; 3501 const SINGLE_QUOTED = hljs.inherit(hljs.APOS_STRING_MODE, { illegal: null }); 3502 const DOUBLE_QUOTED = hljs.inherit(hljs.QUOTE_STRING_MODE, { 3503 illegal: null, 3504 contains: hljs.QUOTE_STRING_MODE.contains.concat(SUBST) 3505 }); 3506 const HEREDOC = { 3507 begin: /<<<[ \t]*(?:(\w+)|"(\w+)")\n/, 3508 end: /[ \t]*(\w+)\b/, 3509 contains: hljs.QUOTE_STRING_MODE.contains.concat(SUBST), 3510 "on:begin": (m, resp) => { 3511 resp.data._beginMatch = m[1] || m[2]; 3512 }, 3513 "on:end": (m, resp) => { 3514 if (resp.data._beginMatch !== m[1]) resp.ignoreMatch(); 3515 } 3516 }; 3517 const NOWDOC = hljs.END_SAME_AS_BEGIN({ 3518 begin: /<<<[ \t]*'(\w+)'\n/, 3519 end: /[ \t]*(\w+)\b/ 3520 }); 3521 const WHITESPACE = "[ \n]"; 3522 const STRING = { 3523 scope: "string", 3524 variants: [ 3525 DOUBLE_QUOTED, 3526 SINGLE_QUOTED, 3527 HEREDOC, 3528 NOWDOC 3529 ] 3530 }; 3531 const NUMBER = { 3532 scope: "number", 3533 variants: [ 3534 { begin: `\\b0[bB][01]+(?:_[01]+)*\\b` }, 3535 // Binary w/ underscore support 3536 { begin: `\\b0[oO][0-7]+(?:_[0-7]+)*\\b` }, 3537 // Octals w/ underscore support 3538 { begin: `\\b0[xX][\\da-fA-F]+(?:_[\\da-fA-F]+)*\\b` }, 3539 // Hex w/ underscore support 3540 // Decimals w/ underscore support, with optional fragments and scientific exponent (e) suffix. 3541 { begin: `(?:\\b\\d+(?:_\\d+)*(\\.(?:\\d+(?:_\\d+)*))?|\\B\\.\\d+)(?:[eE][+-]?\\d+)?` } 3542 ], 3543 relevance: 0 3544 }; 3545 const LITERALS2 = [ 3546 "false", 3547 "null", 3548 "true" 3549 ]; 3550 const KWS = [ 3551 // Magic constants: 3552 // <https://www.php.net/manual/en/language.constants.predefined.php> 3553 "__CLASS__", 3554 "__DIR__", 3555 "__FILE__", 3556 "__FUNCTION__", 3557 "__COMPILER_HALT_OFFSET__", 3558 "__LINE__", 3559 "__METHOD__", 3560 "__NAMESPACE__", 3561 "__TRAIT__", 3562 // Function that look like language construct or language construct that look like function: 3563 // List of keywords that may not require parenthesis 3564 "die", 3565 "echo", 3566 "exit", 3567 "include", 3568 "include_once", 3569 "print", 3570 "require", 3571 "require_once", 3572 // These are not language construct (function) but operate on the currently-executing function and can access the current symbol table 3573 // 'compact extract func_get_arg func_get_args func_num_args get_called_class get_parent_class ' + 3574 // Other keywords: 3575 // <https://www.php.net/manual/en/reserved.php> 3576 // <https://www.php.net/manual/en/language.types.type-juggling.php> 3577 "array", 3578 "abstract", 3579 "and", 3580 "as", 3581 "binary", 3582 "bool", 3583 "boolean", 3584 "break", 3585 "callable", 3586 "case", 3587 "catch", 3588 "class", 3589 "clone", 3590 "const", 3591 "continue", 3592 "declare", 3593 "default", 3594 "do", 3595 "double", 3596 "else", 3597 "elseif", 3598 "empty", 3599 "enddeclare", 3600 "endfor", 3601 "endforeach", 3602 "endif", 3603 "endswitch", 3604 "endwhile", 3605 "enum", 3606 "eval", 3607 "extends", 3608 "final", 3609 "finally", 3610 "float", 3611 "for", 3612 "foreach", 3613 "from", 3614 "global", 3615 "goto", 3616 "if", 3617 "implements", 3618 "instanceof", 3619 "insteadof", 3620 "int", 3621 "integer", 3622 "interface", 3623 "isset", 3624 "iterable", 3625 "list", 3626 "match|0", 3627 "mixed", 3628 "new", 3629 "never", 3630 "object", 3631 "or", 3632 "private", 3633 "protected", 3634 "public", 3635 "readonly", 3636 "real", 3637 "return", 3638 "string", 3639 "switch", 3640 "throw", 3641 "trait", 3642 "try", 3643 "unset", 3644 "use", 3645 "var", 3646 "void", 3647 "while", 3648 "xor", 3649 "yield" 3650 ]; 3651 const BUILT_INS2 = [ 3652 // Standard PHP library: 3653 // <https://www.php.net/manual/en/book.spl.php> 3654 "Error|0", 3655 "AppendIterator", 3656 "ArgumentCountError", 3657 "ArithmeticError", 3658 "ArrayIterator", 3659 "ArrayObject", 3660 "AssertionError", 3661 "BadFunctionCallException", 3662 "BadMethodCallException", 3663 "CachingIterator", 3664 "CallbackFilterIterator", 3665 "CompileError", 3666 "Countable", 3667 "DirectoryIterator", 3668 "DivisionByZeroError", 3669 "DomainException", 3670 "EmptyIterator", 3671 "ErrorException", 3672 "Exception", 3673 "FilesystemIterator", 3674 "FilterIterator", 3675 "GlobIterator", 3676 "InfiniteIterator", 3677 "InvalidArgumentException", 3678 "IteratorIterator", 3679 "LengthException", 3680 "LimitIterator", 3681 "LogicException", 3682 "MultipleIterator", 3683 "NoRewindIterator", 3684 "OutOfBoundsException", 3685 "OutOfRangeException", 3686 "OuterIterator", 3687 "OverflowException", 3688 "ParentIterator", 3689 "ParseError", 3690 "RangeException", 3691 "RecursiveArrayIterator", 3692 "RecursiveCachingIterator", 3693 "RecursiveCallbackFilterIterator", 3694 "RecursiveDirectoryIterator", 3695 "RecursiveFilterIterator", 3696 "RecursiveIterator", 3697 "RecursiveIteratorIterator", 3698 "RecursiveRegexIterator", 3699 "RecursiveTreeIterator", 3700 "RegexIterator", 3701 "RuntimeException", 3702 "SeekableIterator", 3703 "SplDoublyLinkedList", 3704 "SplFileInfo", 3705 "SplFileObject", 3706 "SplFixedArray", 3707 "SplHeap", 3708 "SplMaxHeap", 3709 "SplMinHeap", 3710 "SplObjectStorage", 3711 "SplObserver", 3712 "SplPriorityQueue", 3713 "SplQueue", 3714 "SplStack", 3715 "SplSubject", 3716 "SplTempFileObject", 3717 "TypeError", 3718 "UnderflowException", 3719 "UnexpectedValueException", 3720 "UnhandledMatchError", 3721 // Reserved interfaces: 3722 // <https://www.php.net/manual/en/reserved.interfaces.php> 3723 "ArrayAccess", 3724 "BackedEnum", 3725 "Closure", 3726 "Fiber", 3727 "Generator", 3728 "Iterator", 3729 "IteratorAggregate", 3730 "Serializable", 3731 "Stringable", 3732 "Throwable", 3733 "Traversable", 3734 "UnitEnum", 3735 "WeakReference", 3736 "WeakMap", 3737 // Reserved classes: 3738 // <https://www.php.net/manual/en/reserved.classes.php> 3739 "Directory", 3740 "__PHP_Incomplete_Class", 3741 "parent", 3742 "php_user_filter", 3743 "self", 3744 "static", 3745 "stdClass" 3746 ]; 3747 const dualCase = (items) => { 3748 const result = []; 3749 items.forEach((item) => { 3750 result.push(item); 3751 if (item.toLowerCase() === item) { 3752 result.push(item.toUpperCase()); 3753 } else { 3754 result.push(item.toLowerCase()); 3755 } 3756 }); 3757 return result; 3758 }; 3759 const KEYWORDS2 = { 3760 keyword: KWS, 3761 literal: dualCase(LITERALS2), 3762 built_in: BUILT_INS2 3763 }; 3764 const normalizeKeywords = (items) => { 3765 return items.map((item) => { 3766 return item.replace(/\|\d+$/, ""); 3767 }); 3768 }; 3769 const CONSTRUCTOR_CALL = { variants: [ 3770 { 3771 match: [ 3772 /new/, 3773 regex.concat(WHITESPACE, "+"), 3774 // to prevent built ins from being confused as the class constructor call 3775 regex.concat("(?!", normalizeKeywords(BUILT_INS2).join("\\b|"), "\\b)"), 3776 PASCAL_CASE_CLASS_NAME_RE 3777 ], 3778 scope: { 3779 1: "keyword", 3780 4: "title.class" 3781 } 3782 } 3783 ] }; 3784 const CONSTANT_REFERENCE = regex.concat(IDENT_RE2, "\\b(?!\\()"); 3785 const LEFT_AND_RIGHT_SIDE_OF_DOUBLE_COLON = { variants: [ 3786 { 3787 match: [ 3788 regex.concat( 3789 /::/, 3790 regex.lookahead(/(?!class\b)/) 3791 ), 3792 CONSTANT_REFERENCE 3793 ], 3794 scope: { 2: "variable.constant" } 3795 }, 3796 { 3797 match: [ 3798 /::/, 3799 /class/ 3800 ], 3801 scope: { 2: "variable.language" } 3802 }, 3803 { 3804 match: [ 3805 PASCAL_CASE_CLASS_NAME_RE, 3806 regex.concat( 3807 /::/, 3808 regex.lookahead(/(?!class\b)/) 3809 ), 3810 CONSTANT_REFERENCE 3811 ], 3812 scope: { 3813 1: "title.class", 3814 3: "variable.constant" 3815 } 3816 }, 3817 { 3818 match: [ 3819 PASCAL_CASE_CLASS_NAME_RE, 3820 regex.concat( 3821 "::", 3822 regex.lookahead(/(?!class\b)/) 3823 ) 3824 ], 3825 scope: { 1: "title.class" } 3826 }, 3827 { 3828 match: [ 3829 PASCAL_CASE_CLASS_NAME_RE, 3830 /::/, 3831 /class/ 3832 ], 3833 scope: { 3834 1: "title.class", 3835 3: "variable.language" 3836 } 3837 } 3838 ] }; 3839 const NAMED_ARGUMENT = { 3840 scope: "attr", 3841 match: regex.concat(IDENT_RE2, regex.lookahead(":"), regex.lookahead(/(?!::)/)) 3842 }; 3843 const PARAMS_MODE = { 3844 relevance: 0, 3845 begin: /\(/, 3846 end: /\)/, 3847 keywords: KEYWORDS2, 3848 contains: [ 3849 NAMED_ARGUMENT, 3850 VARIABLE, 3851 LEFT_AND_RIGHT_SIDE_OF_DOUBLE_COLON, 3852 hljs.C_BLOCK_COMMENT_MODE, 3853 STRING, 3854 NUMBER, 3855 CONSTRUCTOR_CALL 3856 ] 3857 }; 3858 const FUNCTION_INVOKE = { 3859 relevance: 0, 3860 match: [ 3861 /\b/, 3862 // to prevent keywords from being confused as the function title 3863 regex.concat("(?!fn\\b|function\\b|", normalizeKeywords(KWS).join("\\b|"), "|", normalizeKeywords(BUILT_INS2).join("\\b|"), "\\b)"), 3864 IDENT_RE2, 3865 regex.concat(WHITESPACE, "*"), 3866 regex.lookahead(/(?=\()/) 3867 ], 3868 scope: { 3: "title.function.invoke" }, 3869 contains: [PARAMS_MODE] 3870 }; 3871 PARAMS_MODE.contains.push(FUNCTION_INVOKE); 3872 const ATTRIBUTE_CONTAINS = [ 3873 NAMED_ARGUMENT, 3874 LEFT_AND_RIGHT_SIDE_OF_DOUBLE_COLON, 3875 hljs.C_BLOCK_COMMENT_MODE, 3876 STRING, 3877 NUMBER, 3878 CONSTRUCTOR_CALL 3879 ]; 3880 const ATTRIBUTES = { 3881 begin: regex.concat( 3882 /#\[\s*\\?/, 3883 regex.either( 3884 PASCAL_CASE_CLASS_NAME_RE, 3885 UPCASE_NAME_RE 3886 ) 3887 ), 3888 beginScope: "meta", 3889 end: /]/, 3890 endScope: "meta", 3891 keywords: { 3892 literal: LITERALS2, 3893 keyword: [ 3894 "new", 3895 "array" 3896 ] 3897 }, 3898 contains: [ 3899 { 3900 begin: /\[/, 3901 end: /]/, 3902 keywords: { 3903 literal: LITERALS2, 3904 keyword: [ 3905 "new", 3906 "array" 3907 ] 3908 }, 3909 contains: [ 3910 "self", 3911 ...ATTRIBUTE_CONTAINS 3912 ] 3913 }, 3914 ...ATTRIBUTE_CONTAINS, 3915 { 3916 scope: "meta", 3917 variants: [ 3918 { match: PASCAL_CASE_CLASS_NAME_RE }, 3919 { match: UPCASE_NAME_RE } 3920 ] 3921 } 3922 ] 3923 }; 3924 return { 3925 case_insensitive: false, 3926 keywords: KEYWORDS2, 3927 contains: [ 3928 ATTRIBUTES, 3929 hljs.HASH_COMMENT_MODE, 3930 hljs.COMMENT("//", "$"), 3931 hljs.COMMENT( 3932 "/\\*", 3933 "\\*/", 3934 { contains: [ 3935 { 3936 scope: "doctag", 3937 match: "@[A-Za-z]+" 3938 } 3939 ] } 3940 ), 3941 { 3942 match: /__halt_compiler\(\);/, 3943 keywords: "__halt_compiler", 3944 starts: { 3945 scope: "comment", 3946 end: hljs.MATCH_NOTHING_RE, 3947 contains: [ 3948 { 3949 match: /\?>/, 3950 scope: "meta", 3951 endsParent: true 3952 } 3953 ] 3954 } 3955 }, 3956 PREPROCESSOR, 3957 { 3958 scope: "variable.language", 3959 match: /\$this\b/ 3960 }, 3961 VARIABLE, 3962 FUNCTION_INVOKE, 3963 LEFT_AND_RIGHT_SIDE_OF_DOUBLE_COLON, 3964 { 3965 match: [ 3966 /const/, 3967 /\s/, 3968 IDENT_RE2 3969 ], 3970 scope: { 3971 1: "keyword", 3972 3: "variable.constant" 3973 } 3974 }, 3975 CONSTRUCTOR_CALL, 3976 { 3977 scope: "function", 3978 relevance: 0, 3979 beginKeywords: "fn function", 3980 end: /[;{]/, 3981 excludeEnd: true, 3982 illegal: "[$%\\[]", 3983 contains: [ 3984 { beginKeywords: "use" }, 3985 hljs.UNDERSCORE_TITLE_MODE, 3986 { 3987 begin: "=>", 3988 // No markup, just a relevance booster 3989 endsParent: true 3990 }, 3991 { 3992 scope: "params", 3993 begin: "\\(", 3994 end: "\\)", 3995 excludeBegin: true, 3996 excludeEnd: true, 3997 keywords: KEYWORDS2, 3998 contains: [ 3999 "self", 4000 ATTRIBUTES, 4001 VARIABLE, 4002 LEFT_AND_RIGHT_SIDE_OF_DOUBLE_COLON, 4003 hljs.C_BLOCK_COMMENT_MODE, 4004 STRING, 4005 NUMBER 4006 ] 4007 } 4008 ] 4009 }, 4010 { 4011 scope: "class", 4012 variants: [ 4013 { 4014 beginKeywords: "enum", 4015 illegal: /[($"]/ 4016 }, 4017 { 4018 beginKeywords: "class interface trait", 4019 illegal: /[:($"]/ 4020 } 4021 ], 4022 relevance: 0, 4023 end: /\{/, 4024 excludeEnd: true, 4025 contains: [ 4026 { beginKeywords: "extends implements" }, 4027 hljs.UNDERSCORE_TITLE_MODE 4028 ] 4029 }, 4030 // both use and namespace still use "old style" rules (vs multi-match) 4031 // because the namespace name can include `\` and we still want each 4032 // element to be treated as its own *individual* title 4033 { 4034 beginKeywords: "namespace", 4035 relevance: 0, 4036 end: ";", 4037 illegal: /[.']/, 4038 contains: [hljs.inherit(hljs.UNDERSCORE_TITLE_MODE, { scope: "title.class" })] 4039 }, 4040 { 4041 beginKeywords: "use", 4042 relevance: 0, 4043 end: ";", 4044 contains: [ 4045 // TODO: title.function vs title.class 4046 { 4047 match: /\b(as|const|function)\b/, 4048 scope: "keyword" 4049 }, 4050 // TODO: could be title.class or title.function 4051 hljs.UNDERSCORE_TITLE_MODE 4052 ] 4053 }, 4054 STRING, 4055 NUMBER 4056 ] 4057 }; 4058} 4059
vendor: 8,474 bytes, lines 4060-4474
4060// node_modules/highlight.js/es/languages/python.js 4061function python(hljs) { 4062 const regex = hljs.regex; 4063 const IDENT_RE2 = /[\p{XID_Start}_]\p{XID_Continue}*/u; 4064 const RESERVED_WORDS = [ 4065 "and", 4066 "as", 4067 "assert", 4068 "async", 4069 "await", 4070 "break", 4071 "case", 4072 "class", 4073 "continue", 4074 "def", 4075 "del", 4076 "elif", 4077 "else", 4078 "except", 4079 "finally", 4080 "for", 4081 "from", 4082 "global", 4083 "if", 4084 "import", 4085 "in", 4086 "is", 4087 "lambda", 4088 "match", 4089 "nonlocal|10", 4090 "not", 4091 "or", 4092 "pass", 4093 "raise", 4094 "return", 4095 "try", 4096 "while", 4097 "with", 4098 "yield" 4099 ]; 4100 const BUILT_INS2 = [ 4101 "__import__", 4102 "abs", 4103 "all", 4104 "any", 4105 "ascii", 4106 "bin", 4107 "bool", 4108 "breakpoint", 4109 "bytearray", 4110 "bytes", 4111 "callable", 4112 "chr", 4113 "classmethod", 4114 "compile", 4115 "complex", 4116 "delattr", 4117 "dict", 4118 "dir", 4119 "divmod", 4120 "enumerate", 4121 "eval", 4122 "exec", 4123 "filter", 4124 "float", 4125 "format", 4126 "frozenset", 4127 "getattr", 4128 "globals", 4129 "hasattr", 4130 "hash", 4131 "help", 4132 "hex", 4133 "id", 4134 "input", 4135 "int", 4136 "isinstance", 4137 "issubclass", 4138 "iter", 4139 "len", 4140 "list", 4141 "locals", 4142 "map", 4143 "max", 4144 "memoryview", 4145 "min", 4146 "next", 4147 "object", 4148 "oct", 4149 "open", 4150 "ord", 4151 "pow", 4152 "print", 4153 "property", 4154 "range", 4155 "repr", 4156 "reversed", 4157 "round", 4158 "set", 4159 "setattr", 4160 "slice", 4161 "sorted", 4162 "staticmethod", 4163 "str", 4164 "sum", 4165 "super", 4166 "tuple", 4167 "type", 4168 "vars", 4169 "zip" 4170 ]; 4171 const LITERALS2 = [ 4172 "__debug__", 4173 "Ellipsis", 4174 "False", 4175 "None", 4176 "NotImplemented", 4177 "True" 4178 ]; 4179 const TYPES2 = [ 4180 "Any", 4181 "Callable", 4182 "Coroutine", 4183 "Dict", 4184 "List", 4185 "Literal", 4186 "Generic", 4187 "Optional", 4188 "Sequence", 4189 "Set", 4190 "Tuple", 4191 "Type", 4192 "Union" 4193 ]; 4194 const KEYWORDS2 = { 4195 $pattern: /[A-Za-z]\w+|__\w+__/, 4196 keyword: RESERVED_WORDS, 4197 built_in: BUILT_INS2, 4198 literal: LITERALS2, 4199 type: TYPES2 4200 }; 4201 const PROMPT = { 4202 className: "meta", 4203 begin: /^(>>>|\.\.\.) / 4204 }; 4205 const SUBST = { 4206 className: "subst", 4207 begin: /\{/, 4208 end: /\}/, 4209 keywords: KEYWORDS2, 4210 illegal: /#/ 4211 }; 4212 const LITERAL_BRACKET = { 4213 begin: /\{\{/, 4214 relevance: 0 4215 }; 4216 const STRING = { 4217 className: "string", 4218 contains: [hljs.BACKSLASH_ESCAPE], 4219 variants: [ 4220 { 4221 begin: /([uU]|[bB]|[rR]|[bB][rR]|[rR][bB])?'''/, 4222 end: /'''/, 4223 contains: [ 4224 hljs.BACKSLASH_ESCAPE, 4225 PROMPT 4226 ], 4227 relevance: 10 4228 }, 4229 { 4230 begin: /([uU]|[bB]|[rR]|[bB][rR]|[rR][bB])?"""/, 4231 end: /"""/, 4232 contains: [ 4233 hljs.BACKSLASH_ESCAPE, 4234 PROMPT 4235 ], 4236 relevance: 10 4237 }, 4238 { 4239 begin: /([fF][rR]|[rR][fF]|[fF])'''/, 4240 end: /'''/, 4241 contains: [ 4242 hljs.BACKSLASH_ESCAPE, 4243 PROMPT, 4244 LITERAL_BRACKET, 4245 SUBST 4246 ] 4247 }, 4248 { 4249 begin: /([fF][rR]|[rR][fF]|[fF])"""/, 4250 end: /"""/, 4251 contains: [ 4252 hljs.BACKSLASH_ESCAPE, 4253 PROMPT, 4254 LITERAL_BRACKET, 4255 SUBST 4256 ] 4257 }, 4258 { 4259 begin: /([uU]|[rR])'/, 4260 end: /'/, 4261 relevance: 10 4262 }, 4263 { 4264 begin: /([uU]|[rR])"/, 4265 end: /"/, 4266 relevance: 10 4267 }, 4268 { 4269 begin: /([bB]|[bB][rR]|[rR][bB])'/, 4270 end: /'/ 4271 }, 4272 { 4273 begin: /([bB]|[bB][rR]|[rR][bB])"/, 4274 end: /"/ 4275 }, 4276 { 4277 begin: /([fF][rR]|[rR][fF]|[fF])'/, 4278 end: /'/, 4279 contains: [ 4280 hljs.BACKSLASH_ESCAPE, 4281 LITERAL_BRACKET, 4282 SUBST 4283 ] 4284 }, 4285 { 4286 begin: /([fF][rR]|[rR][fF]|[fF])"/, 4287 end: /"/, 4288 contains: [ 4289 hljs.BACKSLASH_ESCAPE, 4290 LITERAL_BRACKET, 4291 SUBST 4292 ] 4293 }, 4294 hljs.APOS_STRING_MODE, 4295 hljs.QUOTE_STRING_MODE 4296 ] 4297 }; 4298 const digitpart = "[0-9](_?[0-9])*"; 4299 const pointfloat = `(\\b(${digitpart}))?\\.(${digitpart})|\\b(${digitpart})\\.`; 4300 const lookahead = `\\b|${RESERVED_WORDS.join("|")}`; 4301 const NUMBER = { 4302 className: "number", 4303 relevance: 0, 4304 variants: [ 4305 // exponentfloat, pointfloat 4306 // https://docs.python.org/3.9/reference/lexical_analysis.html#floating-point-literals 4307 // optionally imaginary 4308 // https://docs.python.org/3.9/reference/lexical_analysis.html#imaginary-literals 4309 // Note: no leading \b because floats can start with a decimal point 4310 // and we don't want to mishandle e.g. `fn(.5)`, 4311 // no trailing \b for pointfloat because it can end with a decimal point 4312 // and we don't want to mishandle e.g. `0..hex()`; this should be safe 4313 // because both MUST contain a decimal point and so cannot be confused with 4314 // the interior part of an identifier 4315 { 4316 begin: `(\\b(${digitpart})|(${pointfloat}))[eE][+-]?(${digitpart})[jJ]?(?=${lookahead})` 4317 }, 4318 { 4319 begin: `(${pointfloat})[jJ]?` 4320 }, 4321 // decinteger, bininteger, octinteger, hexinteger 4322 // https://docs.python.org/3.9/reference/lexical_analysis.html#integer-literals 4323 // optionally "long" in Python 2 4324 // https://docs.python.org/2.7/reference/lexical_analysis.html#integer-and-long-integer-literals 4325 // decinteger is optionally imaginary 4326 // https://docs.python.org/3.9/reference/lexical_analysis.html#imaginary-literals 4327 { 4328 begin: `\\b([1-9](_?[0-9])*|0+(_?0)*)[lLjJ]?(?=${lookahead})` 4329 }, 4330 { 4331 begin: `\\b0[bB](_?[01])+[lL]?(?=${lookahead})` 4332 }, 4333 { 4334 begin: `\\b0[oO](_?[0-7])+[lL]?(?=${lookahead})` 4335 }, 4336 { 4337 begin: `\\b0[xX](_?[0-9a-fA-F])+[lL]?(?=${lookahead})` 4338 }, 4339 // imagnumber (digitpart-based) 4340 // https://docs.python.org/3.9/reference/lexical_analysis.html#imaginary-literals 4341 { 4342 begin: `\\b(${digitpart})[jJ](?=${lookahead})` 4343 } 4344 ] 4345 }; 4346 const COMMENT_TYPE = { 4347 className: "comment", 4348 begin: regex.lookahead(/# type:/), 4349 end: /$/, 4350 keywords: KEYWORDS2, 4351 contains: [ 4352 { 4353 // prevent keywords from coloring `type` 4354 begin: /# type:/ 4355 }, 4356 // comment within a datatype comment includes no keywords 4357 { 4358 begin: /#/, 4359 end: /\b\B/, 4360 endsWithParent: true 4361 } 4362 ] 4363 }; 4364 const PARAMS = { 4365 className: "params", 4366 variants: [ 4367 // Exclude params in functions without params 4368 { 4369 className: "", 4370 begin: /\(\s*\)/, 4371 skip: true 4372 }, 4373 { 4374 begin: /\(/, 4375 end: /\)/, 4376 excludeBegin: true, 4377 excludeEnd: true, 4378 keywords: KEYWORDS2, 4379 contains: [ 4380 "self", 4381 PROMPT, 4382 NUMBER, 4383 STRING, 4384 hljs.HASH_COMMENT_MODE 4385 ] 4386 } 4387 ] 4388 }; 4389 SUBST.contains = [ 4390 STRING, 4391 NUMBER, 4392 PROMPT 4393 ]; 4394 return { 4395 name: "Python", 4396 aliases: [ 4397 "py", 4398 "gyp", 4399 "ipython" 4400 ], 4401 unicodeRegex: true, 4402 keywords: KEYWORDS2, 4403 illegal: /(<\/|\?)|=>/, 4404 contains: [ 4405 PROMPT, 4406 NUMBER, 4407 { 4408 // very common convention 4409 scope: "variable.language", 4410 match: /\bself\b/ 4411 }, 4412 { 4413 // eat "if" prior to string so that it won't accidentally be 4414 // labeled as an f-string 4415 beginKeywords: "if", 4416 relevance: 0 4417 }, 4418 { match: /\bor\b/, scope: "keyword" }, 4419 STRING, 4420 COMMENT_TYPE, 4421 hljs.HASH_COMMENT_MODE, 4422 { 4423 match: [ 4424 /\bdef/, 4425 /\s+/, 4426 IDENT_RE2 4427 ], 4428 scope: { 4429 1: "keyword", 4430 3: "title.function" 4431 }, 4432 contains: [PARAMS] 4433 }, 4434 { 4435 variants: [ 4436 { 4437 match: [ 4438 /\bclass/, 4439 /\s+/, 4440 IDENT_RE2, 4441 /\s*/, 4442 /\(\s*/, 4443 IDENT_RE2, 4444 /\s*\)/ 4445 ] 4446 }, 4447 { 4448 match: [ 4449 /\bclass/, 4450 /\s+/, 4451 IDENT_RE2 4452 ] 4453 } 4454 ], 4455 scope: { 4456 1: "keyword", 4457 3: "title.class", 4458 6: "title.class.inherited" 4459 } 4460 }, 4461 { 4462 className: "meta", 4463 begin: /^[\t ]*@/, 4464 end: /(?=#)|$/, 4465 contains: [ 4466 NUMBER, 4467 PARAMS, 4468 STRING 4469 ] 4470 } 4471 ] 4472 }; 4473} 4474
vendor: 9,038 bytes, lines 4475-4887
4475// node_modules/highlight.js/es/languages/ruby.js 4476function ruby(hljs) { 4477 const regex = hljs.regex; 4478 const RUBY_METHOD_RE = "([a-zA-Z_]\\w*[!?=]?|[-+~]@|<<|>>|=~|===?|<=>|[<>]=?|\\*\\*|[-/+%^&*~`|]|\\[\\]=?)"; 4479 const CLASS_NAME_RE = regex.either( 4480 /\b([A-Z]+[a-z0-9]+)+/, 4481 // ends in caps 4482 /\b([A-Z]+[a-z0-9]+)+[A-Z]+/ 4483 ); 4484 const CLASS_NAME_WITH_NAMESPACE_RE = regex.concat(CLASS_NAME_RE, /(::\w+)*/); 4485 const PSEUDO_KWS = [ 4486 "include", 4487 "extend", 4488 "prepend", 4489 "public", 4490 "private", 4491 "protected", 4492 "raise", 4493 "throw" 4494 ]; 4495 const RUBY_KEYWORDS = { 4496 "variable.constant": [ 4497 "__FILE__", 4498 "__LINE__", 4499 "__ENCODING__" 4500 ], 4501 "variable.language": [ 4502 "self", 4503 "super" 4504 ], 4505 keyword: [ 4506 "alias", 4507 "and", 4508 "begin", 4509 "BEGIN", 4510 "break", 4511 "case", 4512 "class", 4513 "defined", 4514 "do", 4515 "else", 4516 "elsif", 4517 "end", 4518 "END", 4519 "ensure", 4520 "for", 4521 "if", 4522 "in", 4523 "module", 4524 "next", 4525 "not", 4526 "or", 4527 "redo", 4528 "require", 4529 "rescue", 4530 "retry", 4531 "return", 4532 "then", 4533 "undef", 4534 "unless", 4535 "until", 4536 "when", 4537 "while", 4538 "yield", 4539 ...PSEUDO_KWS 4540 ], 4541 built_in: [ 4542 "proc", 4543 "lambda", 4544 "attr_accessor", 4545 "attr_reader", 4546 "attr_writer", 4547 "define_method", 4548 "private_constant", 4549 "module_function" 4550 ], 4551 literal: [ 4552 "true", 4553 "false", 4554 "nil" 4555 ] 4556 }; 4557 const YARDOCTAG = { 4558 className: "doctag", 4559 begin: "@[A-Za-z]+" 4560 }; 4561 const IRB_OBJECT = { 4562 begin: "#<", 4563 end: ">" 4564 }; 4565 const COMMENT_MODES = [ 4566 hljs.COMMENT( 4567 "#", 4568 "$", 4569 { contains: [YARDOCTAG] } 4570 ), 4571 hljs.COMMENT( 4572 "^=begin", 4573 "^=end", 4574 { 4575 contains: [YARDOCTAG], 4576 relevance: 10 4577 } 4578 ), 4579 hljs.COMMENT("^__END__", hljs.MATCH_NOTHING_RE) 4580 ]; 4581 const SUBST = { 4582 className: "subst", 4583 begin: /#\{/, 4584 end: /\}/, 4585 keywords: RUBY_KEYWORDS 4586 }; 4587 const STRING = { 4588 className: "string", 4589 contains: [ 4590 hljs.BACKSLASH_ESCAPE, 4591 SUBST 4592 ], 4593 variants: [ 4594 { 4595 begin: /'/, 4596 end: /'/ 4597 }, 4598 { 4599 begin: /"/, 4600 end: /"/ 4601 }, 4602 { 4603 begin: /`/, 4604 end: /`/ 4605 }, 4606 { 4607 begin: /%[qQwWx]?\(/, 4608 end: /\)/ 4609 }, 4610 { 4611 begin: /%[qQwWx]?\[/, 4612 end: /\]/ 4613 }, 4614 { 4615 begin: /%[qQwWx]?\{/, 4616 end: /\}/ 4617 }, 4618 { 4619 begin: /%[qQwWx]?</, 4620 end: />/ 4621 }, 4622 { 4623 begin: /%[qQwWx]?\//, 4624 end: /\// 4625 }, 4626 { 4627 begin: /%[qQwWx]?%/, 4628 end: /%/ 4629 }, 4630 { 4631 begin: /%[qQwWx]?-/, 4632 end: /-/ 4633 }, 4634 { 4635 begin: /%[qQwWx]?\|/, 4636 end: /\|/ 4637 }, 4638 // in the following expressions, \B in the beginning suppresses recognition of ?-sequences 4639 // where ? is the last character of a preceding identifier, as in: `func?4` 4640 { begin: /\B\?(\\\d{1,3})/ }, 4641 { begin: /\B\?(\\x[A-Fa-f0-9]{1,2})/ }, 4642 { begin: /\B\?(\\u\{?[A-Fa-f0-9]{1,6}\}?)/ }, 4643 { begin: /\B\?(\\M-\\C-|\\M-\\c|\\c\\M-|\\M-|\\C-\\M-)[\x20-\x7e]/ }, 4644 { begin: /\B\?\\(c|C-)[\x20-\x7e]/ }, 4645 { begin: /\B\?\\?\S/ }, 4646 // heredocs 4647 { 4648 // this guard makes sure that we have an entire heredoc and not a false 4649 // positive (auto-detect, etc.) 4650 begin: regex.concat( 4651 /<<[-~]?'?/, 4652 regex.lookahead(/(\w+)(?=\W)[^\n]*\n(?:[^\n]*\n)*?\s*\1\b/) 4653 ), 4654 contains: [ 4655 hljs.END_SAME_AS_BEGIN({ 4656 begin: /(\w+)/, 4657 end: /(\w+)/, 4658 contains: [ 4659 hljs.BACKSLASH_ESCAPE, 4660 SUBST 4661 ] 4662 }) 4663 ] 4664 } 4665 ] 4666 }; 4667 const decimal = "[1-9](_?[0-9])*|0"; 4668 const digits = "[0-9](_?[0-9])*"; 4669 const NUMBER = { 4670 className: "number", 4671 relevance: 0, 4672 variants: [ 4673 // decimal integer/float, optionally exponential or rational, optionally imaginary 4674 { begin: `\\b(${decimal})(\\.(${digits}))?([eE][+-]?(${digits})|r)?i?\\b` }, 4675 // explicit decimal/binary/octal/hexadecimal integer, 4676 // optionally rational and/or imaginary 4677 { begin: "\\b0[dD][0-9](_?[0-9])*r?i?\\b" }, 4678 { begin: "\\b0[bB][0-1](_?[0-1])*r?i?\\b" }, 4679 { begin: "\\b0[oO][0-7](_?[0-7])*r?i?\\b" }, 4680 { begin: "\\b0[xX][0-9a-fA-F](_?[0-9a-fA-F])*r?i?\\b" }, 4681 // 0-prefixed implicit octal integer, optionally rational and/or imaginary 4682 { begin: "\\b0(_?[0-7])+r?i?\\b" } 4683 ] 4684 }; 4685 const PARAMS = { 4686 variants: [ 4687 { 4688 match: /\(\)/ 4689 }, 4690 { 4691 className: "params", 4692 begin: /\(/, 4693 end: /(?=\))/, 4694 excludeBegin: true, 4695 endsParent: true, 4696 keywords: RUBY_KEYWORDS 4697 } 4698 ] 4699 }; 4700 const INCLUDE_EXTEND = { 4701 match: [ 4702 /(include|extend)\s+/, 4703 CLASS_NAME_WITH_NAMESPACE_RE 4704 ], 4705 scope: { 4706 2: "title.class" 4707 }, 4708 keywords: RUBY_KEYWORDS 4709 }; 4710 const CLASS_DEFINITION = { 4711 variants: [ 4712 { 4713 match: [ 4714 /class\s+/, 4715 CLASS_NAME_WITH_NAMESPACE_RE, 4716 /\s+<\s+/, 4717 CLASS_NAME_WITH_NAMESPACE_RE 4718 ] 4719 }, 4720 { 4721 match: [ 4722 /\b(class|module)\s+/, 4723 CLASS_NAME_WITH_NAMESPACE_RE 4724 ] 4725 } 4726 ], 4727 scope: { 4728 2: "title.class", 4729 4: "title.class.inherited" 4730 }, 4731 keywords: RUBY_KEYWORDS 4732 }; 4733 const UPPER_CASE_CONSTANT = { 4734 relevance: 0, 4735 match: /\b[A-Z][A-Z_0-9]+\b/, 4736 className: "variable.constant" 4737 }; 4738 const METHOD_DEFINITION = { 4739 match: [ 4740 /def/, 4741 /\s+/, 4742 RUBY_METHOD_RE 4743 ], 4744 scope: { 4745 1: "keyword", 4746 3: "title.function" 4747 }, 4748 contains: [ 4749 PARAMS 4750 ] 4751 }; 4752 const OBJECT_CREATION = { 4753 relevance: 0, 4754 match: [ 4755 CLASS_NAME_WITH_NAMESPACE_RE, 4756 /\.new[. (]/ 4757 ], 4758 scope: { 4759 1: "title.class" 4760 } 4761 }; 4762 const CLASS_REFERENCE = { 4763 relevance: 0, 4764 match: CLASS_NAME_RE, 4765 scope: "title.class" 4766 }; 4767 const RUBY_DEFAULT_CONTAINS = [ 4768 STRING, 4769 CLASS_DEFINITION, 4770 INCLUDE_EXTEND, 4771 OBJECT_CREATION, 4772 UPPER_CASE_CONSTANT, 4773 CLASS_REFERENCE, 4774 METHOD_DEFINITION, 4775 { 4776 // swallow namespace qualifiers before symbols 4777 begin: hljs.IDENT_RE + "::" 4778 }, 4779 { 4780 className: "symbol", 4781 begin: hljs.UNDERSCORE_IDENT_RE + "(!|\\?)?:", 4782 relevance: 0 4783 }, 4784 { 4785 className: "symbol", 4786 begin: ":(?!\\s)", 4787 contains: [ 4788 STRING, 4789 { begin: RUBY_METHOD_RE } 4790 ], 4791 relevance: 0 4792 }, 4793 NUMBER, 4794 { 4795 // negative-look forward attempts to prevent false matches like: 4796 // @ident@ or $ident$ that might indicate this is not ruby at all 4797 className: "variable", 4798 begin: `(\\$\\W)|((\\$|@@?)(\\w+))(?=[^@$?])(?![A-Za-z])(?![@$?'])` 4799 }, 4800 { 4801 className: "params", 4802 begin: /\|(?!=)/, 4803 end: /\|/, 4804 excludeBegin: true, 4805 excludeEnd: true, 4806 relevance: 0, 4807 // this could be a lot of things (in other languages) other than params 4808 keywords: RUBY_KEYWORDS 4809 }, 4810 { 4811 // regexp container 4812 begin: "(" + hljs.RE_STARTERS_RE + "|unless)\\s*", 4813 keywords: "unless", 4814 contains: [ 4815 { 4816 className: "regexp", 4817 contains: [ 4818 hljs.BACKSLASH_ESCAPE, 4819 SUBST 4820 ], 4821 illegal: /\n/, 4822 variants: [ 4823 { 4824 begin: "/", 4825 end: "/[a-z]*" 4826 }, 4827 { 4828 begin: /%r\{/, 4829 end: /\}[a-z]*/ 4830 }, 4831 { 4832 begin: "%r\\(", 4833 end: "\\)[a-z]*" 4834 }, 4835 { 4836 begin: "%r!", 4837 end: "![a-z]*" 4838 }, 4839 { 4840 begin: "%r\\[", 4841 end: "\\][a-z]*" 4842 } 4843 ] 4844 } 4845 ].concat(IRB_OBJECT, COMMENT_MODES), 4846 relevance: 0 4847 } 4848 ].concat(IRB_OBJECT, COMMENT_MODES); 4849 SUBST.contains = RUBY_DEFAULT_CONTAINS; 4850 PARAMS.contains = RUBY_DEFAULT_CONTAINS; 4851 const SIMPLE_PROMPT = "[>?]>"; 4852 const DEFAULT_PROMPT = "[\\w#]+\\(\\w+\\):\\d+:\\d+[>*]"; 4853 const RVM_PROMPT = "(\\w+-)?\\d+\\.\\d+\\.\\d+(p\\d+)?[^\\d][^>]+>"; 4854 const IRB_DEFAULT = [ 4855 { 4856 begin: /^\s*=>/, 4857 starts: { 4858 end: "$", 4859 contains: RUBY_DEFAULT_CONTAINS 4860 } 4861 }, 4862 { 4863 className: "meta.prompt", 4864 begin: "^(" + SIMPLE_PROMPT + "|" + DEFAULT_PROMPT + "|" + RVM_PROMPT + ")(?=[ ])", 4865 starts: { 4866 end: "$", 4867 keywords: RUBY_KEYWORDS, 4868 contains: RUBY_DEFAULT_CONTAINS 4869 } 4870 } 4871 ]; 4872 COMMENT_MODES.unshift(IRB_OBJECT); 4873 return { 4874 name: "Ruby", 4875 aliases: [ 4876 "rb", 4877 "gemspec", 4878 "podspec", 4879 "thor", 4880 "irb" 4881 ], 4882 keywords: RUBY_KEYWORDS, 4883 illegal: /\/\*/, 4884 contains: [hljs.SHEBANG({ binary: "ruby" })].concat(IRB_DEFAULT).concat(COMMENT_MODES).concat(RUBY_DEFAULT_CONTAINS) 4885 }; 4886} 4887
4888// app/assets/javascripts/highlight.js 4889core_default.registerLanguage("bash", bash); 4890core_default.registerAliases(["curl"], { languageName: "bash" }); 4891core_default.registerLanguage("go", go); 4892core_default.registerLanguage("http", http); 4893core_default.registerLanguage("java", java); 4894core_default.registerLanguage("javascript", javascript); 4895core_default.registerLanguage("json", json); 4896core_default.registerLanguage("kotlin", kotlin); 4897core_default.registerLanguage("php", php); 4898core_default.registerLanguage("python", python); 4899core_default.registerLanguage("ruby", ruby); 4900core_default.getLanguage("bash").keywords.built_in += " npx curl runapi"; 4901var highlight_default = core_default; 4902export { 4903 highlight_default as default 4904}; 4905//# sourceMappingURL=/assets/highlight-898a060c.js.map
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.