vendor: 5,479 bytes, lines 1-152
1/** 2 * marked v15.0.12 - a markdown parser 3 * Copyright (c) 2011-2025, Christopher Jeffrey. (MIT Licensed) 4 * https://github.com/markedjs/marked 5 */ 6 7/** 8 * DO NOT EDIT THIS FILE 9 * The code in this file is generated from files in ./src/ 10 */ 11(function (g, f) { 12 if (typeof exports == "object" && typeof module < "u") { 13 module.exports = f() 14 } else if ("function" == typeof define && define.amd) { 15 define("marked", f) 16 } else { 17 g["marked"] = f() 18 } 19}(typeof globalThis < "u" ? globalThis : typeof self < "u" ? self : this, function () { 20 var exports = {}; 21 var __exports = exports; 22 var module = {exports}; 23 "use strict"; 24 var H = Object.defineProperty; 25 var be = Object.getOwnPropertyDescriptor; 26 var Te = Object.getOwnPropertyNames; 27 var we = Object.prototype.hasOwnProperty; 28 var ye = (l, e) => { 29 for (var t in e) H(l, t, {get: e[t], enumerable: !0}) 30 }, Re = (l, e, t, n) => { 31 if (e && typeof e == "object" || typeof e == "function") for (let s of Te(e)) !we.call(l, s) && s !== t && H(l, s, { 32 get: () => e[s], 33 enumerable: !(n = be(e, s)) || n.enumerable 34 }); 35 return l 36 }; 37 var Se = l => Re(H({}, "__esModule", {value: !0}), l); 38 var kt = {}; 39 ye(kt, { 40 Hooks: () => L, 41 Lexer: () => x, 42 Marked: () => E, 43 Parser: () => b, 44 Renderer: () => $, 45 TextRenderer: () => _, 46 Tokenizer: () => S, 47 defaults: () => w, 48 getDefaults: () => z, 49 lexer: () => ht, 50 marked: () => k, 51 options: () => it, 52 parse: () => pt, 53 parseInline: () => ct, 54 parser: () => ut, 55 setOptions: () => ot, 56 use: () => lt, 57 walkTokens: () => at 58 }); 59 module.exports = Se(kt); 60 61 function z() { 62 return { 63 async: !1, 64 breaks: !1, 65 extensions: null, 66 gfm: !0, 67 hooks: null, 68 pedantic: !1, 69 renderer: null, 70 silent: !1, 71 tokenizer: null, 72 walkTokens: null 73 } 74 } 75 76 var w = z(); 77 78 function N(l) { 79 w = l 80 } 81 82 var I = {exec: () => null}; 83 84 function h(l, e = "") { 85 let t = typeof l == "string" ? l : l.source, n = { 86 replace: (s, i) => { 87 let r = typeof i == "string" ? i : i.source; 88 return r = r.replace(m.caret, "$1"), t = t.replace(s, r), n 89 }, getRegex: () => new RegExp(t, e) 90 }; 91 return n 92 } 93 94 var m = { 95 codeRemoveIndent: /^(?: {1,4}| {0,3}\t)/gm, 96 outputLinkReplace: /\\([\[\]])/g, 97 indentCodeCompensation: /^(\s+)(?:```)/, 98 beginningSpace: /^\s+/, 99 endingHash: /#$/, 100 startingSpaceChar: /^ /, 101 endingSpaceChar: / $/, 102 nonSpaceChar: /[^ ]/, 103 newLineCharGlobal: /\n/g, 104 tabCharGlobal: /\t/g, 105 multipleSpaceGlobal: /\s+/g, 106 blankLine: /^[ \t]*$/, 107 doubleBlankLine: /\n[ \t]*\n[ \t]*$/, 108 blockquoteStart: /^ {0,3}>/, 109 blockquoteSetextReplace: /\n {0,3}((?:=+|-+) *)(?=\n|$)/g, 110 blockquoteSetextReplace2: /^ {0,3}>[ \t]?/gm, 111 listReplaceTabs: /^\t+/, 112 listReplaceNesting: /^ {1,4}(?=( {4})*[^ ])/g, 113 listIsTask: /^\[[ xX]\] /, 114 listReplaceTask: /^\[[ xX]\] +/, 115 anyLine: /\n.*\n/, 116 hrefBrackets: /^<(.*)>$/, 117 tableDelimiter: /[:|]/, 118 tableAlignChars: /^\||\| *$/g, 119 tableRowBlankLine: /\n[ \t]*$/, 120 tableAlignRight: /^ *-+: *$/, 121 tableAlignCenter: /^ *:-+: *$/, 122 tableAlignLeft: /^ *:-+ *$/, 123 startATag: /^<a /i, 124 endATag: /^<\/a>/i, 125 startPreScriptTag: /^<(pre|code|kbd|script)(\s|>)/i, 126 endPreScriptTag: /^<\/(pre|code|kbd|script)(\s|>)/i, 127 startAngleBracket: /^</, 128 endAngleBracket: />$/, 129 pedanticHrefTitle: /^([^'"]*[^\s])\s+(['"])(.*)\2/, 130 unicodeAlphaNumeric: /[\p{L}\p{N}]/u, 131 escapeTest: /[&<>"']/, 132 escapeReplace: /[&<>"']/g, 133 escapeTestNoEncode: /[<>"']|&(?!(#\d{1,7}|#[Xx][a-fA-F0-9]{1,6}|\w+);)/, 134 escapeReplaceNoEncode: /[<>"']|&(?!(#\d{1,7}|#[Xx][a-fA-F0-9]{1,6}|\w+);)/g, 135 unescapeTest: /&(#(?:\d+)|(?:#x[0-9A-Fa-f]+)|(?:\w+));?/ig, 136 caret: /(^|[^\[])\^/g, 137 percentDecode: /%25/g, 138 findPipe: /\|/g, 139 splitPipe: / \|/, 140 slashPipe: /\\\|/g, 141 carriageReturn: /\r\n|\r/g, 142 spaceLine: /^ +$/gm, 143 notSpaceStart: /^\S*/, 144 endingNewline: /\n$/, 145 listItemRegex: l => new RegExp(`^( {0,3}${l})((?:[ ][^\\n]*)?(?:\\n|$))`), 146 nextBulletRegex: l => new RegExp(`^ {0,${Math.min(3,l-1)}}(?:[*+-]|\\d{1,9}[.)])((?:[ ][^\\n]*)?(?:\\n|$))`), 147 hrRegex: l => new RegExp(`^ {0,${Math.min(3,l-1)}}((?:- *){3,}|(?:_ *){3,}|(?:\\* *){3,})(?:\\n+|$)`), 148 fencesBeginRegex: l => new RegExp(`^ {0,${Math.min(3,l-1)}}(?:\`\`\`|~~~)`), 149 headingBeginRegex: l => new RegExp(`^ {0,${Math.min(3,l-1)}}#`), 150 htmlBeginRegex: l => new RegExp(`^ {0,${Math.min(3,l-1)}}<(?:[a-z].*>|!--)`, "i") 151 }, $e = /^(?:[ \t]*(?:\n|$))+/, _e = /^((?: {4}| {0,3}\t)[^\n]+(?:\n(?:[ \t]*(?:\n|$))*)?)+/, 152 Le = /^ {0,3}(`{3,}
vendor: 11,937 bytes, lines 152-317
152(?=[^`\n]*(?:\n|$))|~{3,})([^\n]*)(?:\n|$)(?:|([\s\S]*?)(?:\n|$))(?: {0,3}\1[~`]* *(?=\n|$)|$)/, 153 O = /^ {0,3}((?:-[\t ]*){3,}|(?:_[ \t]*){3,}|(?:\*[ \t]*){3,})(?:\n+|$)/, 154 ze = /^ {0,3}(#{1,6})(?=\s|$)(.*)(?:\n+|$)/, F = /(?:[*+-]|\d{1,9}[.)])/, 155 ie = /^(?!bull |blockCode|fences|blockquote|heading|html|table)((?:.|\n(?!\s*?\n|bull |blockCode|fences|blockquote|heading|html|table))+?)\n {0,3}(=+|-+) *(?:\n+|$)/, 156 oe = h(ie).replace(/bull/g, F).replace(/blockCode/g, /(?: {4}| {0,3}\t)/).replace(/fences/g, / {0,3}(?:`{3,}|~{3,})/).replace(/blockquote/g, / {0,3}>/).replace(/heading/g, / {0,3}#{1,6}/).replace(/html/g, / {0,3}<[^\n>]+>\n/).replace(/\|table/g, "").getRegex(), 157 Me = h(ie).replace(/bull/g, F).replace(/blockCode/g, /(?: {4}| {0,3}\t)/).replace(/fences/g, / {0,3}(?:`{3,}|~{3,})/).replace(/blockquote/g, / {0,3}>/).replace(/heading/g, / {0,3}#{1,6}/).replace(/html/g, / {0,3}<[^\n>]+>\n/).replace(/table/g, / {0,3}\|?(?:[:\- ]*\|)+[\:\- ]*\n/).getRegex(), 158 Q = /^([^\n]+(?:\n(?!hr|heading|lheading|blockquote|fences|list|html|table| +\n)[^\n]+)*)/, Pe = /^[^\n]+/, 159 U = /(?!\s*\])(?:\\.|[^\[\]\\])+/, 160 Ae = h(/^ {0,3}\[(label)\]: *(?:\n[ \t]*)?([^<\s][^\s]*|<.*?>)(?:(?: +(?:\n[ \t]*)?| *\n[ \t]*)(title))? *(?:\n+|$)/).replace("label", U).replace("title", /(?:"(?:\\"?|[^"\\])*"|'[^'\n]*(?:\n[^'\n]+)*\n?'|\([^()]*\))/).getRegex(), 161 Ee = h(/^( {0,3}bull)([ \t][^\n]+?)?(?:\n|$)/).replace(/bull/g, F).getRegex(), 162 v = "address|article|aside|base|basefont|blockquote|body|caption|center|col|colgroup|dd|details|dialog|dir|div|dl|dt|fieldset|figcaption|figure|footer|form|frame|frameset|h[1-6]|head|header|hr|html|iframe|legend|li|link|main|menu|menuitem|meta|nav|noframes|ol|optgroup|option|p|param|search|section|summary|table|tbody|td|tfoot|th|thead|title|tr|track|ul", 163 K = /<!--(?:-?>|[\s\S]*?(?:-->|$))/, 164 Ce = h("^ {0,3}(?:<(script|pre|style|textarea)[\\s>][\\s\\S]*?(?:</\\1>[^\\n]*\\n+|$)|comment[^\\n]*(\\n+|$)|<\\?[\\s\\S]*?(?:\\?>\\n*|$)|<![A-Z][\\s\\S]*?(?:>\\n*|$)|<!\\[CDATA\\[[\\s\\S]*?(?:\\]\\]>\\n*|$)|</?(tag)(?: +|\\n|/?>)[\\s\\S]*?(?:(?:\\n[ ]*)+\\n|$)|<(?!script|pre|style|textarea)([a-z][\\w-]*)(?:attribute)*? */?>(?=[ \\t]*(?:\\n|$))[\\s\\S]*?(?:(?:\\n[ ]*)+\\n|$)|</(?!script|pre|style|textarea)[a-z][\\w-]*\\s*>(?=[ \\t]*(?:\\n|$))[\\s\\S]*?(?:(?:\\n[ ]*)+\\n|$))", "i").replace("comment", K).replace("tag", v).replace("attribute", / +[a-zA-Z:_][\w.:-]*(?: *= *"[^"\n]*"| *= *'[^'\n]*'| *= *[^\s"'=<>`]+)?/).getRegex(), 165 le = h(Q).replace("hr", O).replace("heading", " {0,3}#{1,6}(?:\\s|$)").replace("|lheading", "").replace("|table", "").replace("blockquote", " {0,3}>").replace("fences", " {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n").replace("list", " {0,3}(?:[*+-]|1[.)]) ").replace("html", "</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|textarea|!--)").replace("tag", v).getRegex(), 166 Ie = h(/^( {0,3}> ?(paragraph|[^\n]*)(?:\n|$))+/).replace("paragraph", le).getRegex(), X = { 167 blockquote: Ie, 168 code: _e, 169 def: Ae, 170 fences: Le, 171 heading: ze, 172 hr: O, 173 html: Ce, 174 lheading: oe, 175 list: Ee, 176 newline: $e, 177 paragraph: le, 178 table: I, 179 text: Pe 180 }, 181 re = h("^ *([^\\n ].*)\\n {0,3}((?:\\| *)?:?-+:? *(?:\\| *:?-+:? *)*(?:\\| *)?)(?:\\n((?:(?! *\\n|hr|heading|blockquote|code|fences|list|html).*(?:\\n|$))*)\\n*|$)").replace("hr", O).replace("heading", " {0,3}#{1,6}(?:\\s|$)").replace("blockquote", " {0,3}>").replace("code", "(?: {4}| {0,3} )[^\\n]").replace("fences", " {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n").replace("list", " {0,3}(?:[*+-]|1[.)]) ").replace("html", "</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|textarea|!--)").replace("tag", v).getRegex(), 182 Oe = { 183 ...X, 184 lheading: Me, 185 table: re, 186 paragraph: h(Q).replace("hr", O).replace("heading", " {0,3}#{1,6}(?:\\s|$)").replace("|lheading", "").replace("table", re).replace("blockquote", " {0,3}>").replace("fences", " {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n").replace("list", " {0,3}(?:[*+-]|1[.)]) ").replace("html", "</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|textarea|!--)").replace("tag", v).getRegex() 187 }, Be = { 188 ...X, 189 html: h(`^ *(?:comment *(?:\\n|\\s*$)|<(tag)[\\s\\S]+?</\\1> *(?:\\n{2,}|\\s*$)|<tag(?:"[^"]*"|'[^']*'|\\s[^'"/>\\s]*)*?/?> *(?:\\n{2,}|\\s*$))`).replace("comment", K).replace(/tag/g, "(?!(?:a|em|strong|small|s|cite|q|dfn|abbr|data|time|code|var|samp|kbd|sub|sup|i|b|u|mark|ruby|rt|rp|bdi|bdo|span|br|wbr|ins|del|img)\\b)\\w+(?!:|[^\\w\\s@]*@)\\b").getRegex(), 190 def: /^ *\[([^\]]+)\]: *<?([^\s>]+)>?(?: +(["(][^\n]+[")]))? *(?:\n+|$)/, 191 heading: /^(#{1,6})(.*)(?:\n+|$)/, 192 fences: I, 193 lheading: /^(.+?)\n {0,3}(=+|-+) *(?:\n+|$)/, 194 paragraph: h(Q).replace("hr", O).replace("heading", ` *#{1,6} *[^ 195]`).replace("lheading", oe).replace("|table", "").replace("blockquote", " {0,3}>").replace("|fences", "").replace("|list", "").replace("|html", "").replace("|tag", "").getRegex() 196 }, qe = /^\\([!"#$%&'()*+,\-./:;<=>?@\[\]\\^_`{|}~])/, ve = /^(`+)([^`]|[^`][\s\S]*?[^`])\1(?!`)/, 197 ae = /^( {2,}|\\)\n(?!\s*$)/, 198 De = /^(`+|[^`])(?:(?= {2,}\n)|[\s\S]*?(?:(?=[\\<!\[`*_]|\b_|$)|[^ ](?= {2,}\n)))/, D = /[\p{P}\p{S}]/u, 199 W = /[\s\p{P}\p{S}]/u, ce = /[^\s\p{P}\p{S}]/u, 200 Ze = h(/^((?![*_])punctSpace)/, "u").replace(/punctSpace/g, W).getRegex(), pe = /(?!~)[\p{P}\p{S}]/u, 201 Ge = /(?!~)[\s\p{P}\p{S}]/u, He = /(?:[^\s\p{P}\p{S}]|~)/u, 202 Ne = /\[[^[\]]*?\]\((?:\\.|[^\\\(\)]|\((?:\\.|[^\\\(\)])*\))*\)|`[^`]*?`|<[^<>]*?>/g, 203 ue = /^(?:\*+(?:((?!\*)punct)|[^\s*]))|^_+(?:((?!_)punct)|([^\s_]))/, 204 je = h(ue, "u").replace(/punct/g, D).getRegex(), Fe = h(ue, "u").replace(/punct/g, pe).getRegex(), 205 he = "^[^_*]*?__[^_*]*?\\*[^_*]*?(?=__)|[^*]+(?=[^*])|(?!\\*)punct(\\*+)(?=[\\s]|$)|notPunctSpace(\\*+)(?!\\*)(?=punctSpace|$)|(?!\\*)punctSpace(\\*+)(?=notPunctSpace)|[\\s](\\*+)(?!\\*)(?=punct)|(?!\\*)punct(\\*+)(?!\\*)(?=punct)|notPunctSpace(\\*+)(?=notPunctSpace)", 206 Qe = h(he, "gu").replace(/notPunctSpace/g, ce).replace(/punctSpace/g, W).replace(/punct/g, D).getRegex(), 207 Ue = h(he, "gu").replace(/notPunctSpace/g, He).replace(/punctSpace/g, Ge).replace(/punct/g, pe).getRegex(), 208 Ke = h("^[^_*]*?\\*\\*[^_*]*?_[^_*]*?(?=\\*\\*)|[^_]+(?=[^_])|(?!_)punct(_+)(?=[\\s]|$)|notPunctSpace(_+)(?!_)(?=punctSpace|$)|(?!_)punctSpace(_+)(?=notPunctSpace)|[\\s](_+)(?!_)(?=punct)|(?!_)punct(_+)(?!_)(?=punct)", "gu").replace(/notPunctSpace/g, ce).replace(/punctSpace/g, W).replace(/punct/g, D).getRegex(), 209 Xe = h(/\\(punct)/, "gu").replace(/punct/g, D).getRegex(), 210 We = h(/^<(scheme:[^\s\x00-\x1f<>]*|email)>/).replace("scheme", /[a-zA-Z][a-zA-Z0-9+.-]{1,31}/).replace("email", /[a-zA-Z0-9.!#$%&'*+/=?^_`{|}~-]+(@)[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)+(?![-_])/).getRegex(), 211 Je = h(K).replace("(?:-->|$)", "-->").getRegex(), 212 Ve = h("^comment|^</[a-zA-Z][\\w:-]*\\s*>|^<[a-zA-Z][\\w-]*(?:attribute)*?\\s*/?>|^<\\?[\\s\\S]*?\\?>|^<![a-zA-Z]+\\s[\\s\\S]*?>|^<!\\[CDATA\\[[\\s\\S]*?\\]\\]>").replace("comment", Je).replace("attribute", /\s+[a-zA-Z:_][\w.:-]*(?:\s*=\s*"[^"]*"|\s*=\s*'[^']*'|\s*=\s*[^\s"'=<>`]+)?/).getRegex(), 213 q = /(?:\[(?:\\.|[^\[\]\\])*\]|\\.|`[^`]*`|[^\[\]\\`])*?/, 214 Ye = h(/^!?\[(label)\]\(\s*(href)(?:(?:[ \t]*(?:\n[ \t]*)?)(title))?\s*\)/).replace("label", q).replace("href", /<(?:\\.|[^\n<>\\])+>|[^ \t\n\x00-\x1f]*/).replace("title", /"(?:\\"?|[^"\\])*"|'(?:\\'?|[^'\\])*'|\((?:\\\)?|[^)\\])*\)/).getRegex(), 215 ke = h(/^!?\[(label)\]\[(ref)\]/).replace("label", q).replace("ref", U).getRegex(), 216 ge = h(/^!?\[(ref)\](?:\[\])?/).replace("ref", U).getRegex(), 217 et = h("reflink|nolink(?!\\()", "g").replace("reflink", ke).replace("nolink", ge).getRegex(), J = { 218 _backpedal: I, 219 anyPunctuation: Xe, 220 autolink: We, 221 blockSkip: Ne, 222 br: ae, 223 code: ve, 224 del: I, 225 emStrongLDelim: je, 226 emStrongRDelimAst: Qe, 227 emStrongRDelimUnd: Ke, 228 escape: qe, 229 link: Ye, 230 nolink: ge, 231 punctuation: Ze, 232 reflink: ke, 233 reflinkSearch: et, 234 tag: Ve, 235 text: De, 236 url: I 237 }, tt = { 238 ...J, 239 link: h(/^!?\[(label)\]\((.*?)\)/).replace("label", q).getRegex(), 240 reflink: h(/^!?\[(label)\]\s*\[([^\]]*)\]/).replace("label", q).getRegex() 241 }, j = { 242 ...J, 243 emStrongRDelimAst: Ue, 244 emStrongLDelim: Fe, 245 url: h(/^((?:ftp|https?):\/\/|www\.)(?:[a-zA-Z0-9\-]+\.?)+[^\s<]*|^email/, "i").replace("email", /[A-Za-z0-9._+-]+(@)[a-zA-Z0-9-_]+(?:\.[a-zA-Z0-9-_]*[a-zA-Z0-9])+(?![-_])/).getRegex(), 246 _backpedal: /(?:[^?!.,:;*_'"~()&]+|\([^)]*\)|&(?![a-zA-Z0-9]+;$)|[?!.,:;*_'"~)]+(?!$))+/, 247 del: /^(~~?)(?=[^\s~])((?:\\.|[^\\])*?(?:\\.|[^\s~\\]))\1(?=[^~]|$)/, 248 text: /^([`~]+|[^`~])(?:(?= {2,}\n)|(?=[a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-]+@)|[\s\S]*?(?:(?=[\\<!\[`*~_]|\b_|https?:\/\/|ftp:\/\/|www\.|$)|[^ ](?= {2,}\n)|[^a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-](?=[a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-]+@)))/ 249 }, nt = { 250 ...j, 251 br: h(ae).replace("{2,}", "*").getRegex(), 252 text: h(j.text).replace("\\b_", "\\b_| {2,}\\n").replace(/\{2,\}/g, "*").getRegex() 253 }, B = {normal: X, gfm: Oe, pedantic: Be}, P = {normal: J, gfm: j, breaks: nt, pedantic: tt}; 254 var st = {"&": "&", "<": "<", ">": ">", '"': """, "'": "'"}, fe = l => st[l]; 255 256 function R(l, e) { 257 if (e) { 258 if (m.escapeTest.test(l)) return l.replace(m.escapeReplace, fe) 259 } else if (m.escapeTestNoEncode.test(l)) return l.replace(m.escapeReplaceNoEncode, fe); 260 return l 261 } 262 263 function V(l) { 264 try { 265 l = encodeURI(l).replace(m.percentDecode, "%") 266 } catch { 267 return null 268 } 269 return l 270 } 271 272 function Y(l, e) { 273 let t = l.replace(m.findPipe, (i, r, o) => { 274 let a = !1, c = r; 275 for (; --c >= 0 && o[c] === "\\";) a = !a; 276 return a ? "|" : " |" 277 }), n = t.split(m.splitPipe), s = 0; 278 if (n[0].trim() || n.shift(), n.length > 0 && !n.at(-1)?.trim() && n.pop(), e) if (n.length > e) n.splice(e); else for (; n.length < e;) n.push(""); 279 for (; s < n.length; s++) n[s] = n[s].trim().replace(m.slashPipe, "|"); 280 return n 281 } 282 283 function A(l, e, t) { 284 let n = l.length; 285 if (n === 0) return ""; 286 let s = 0; 287 for (; s < n;) { 288 let i = l.charAt(n - s - 1); 289 if (i === e && !t) s++; else if (i !== e && t) s++; else break 290 } 291 return l.slice(0, n - s) 292 } 293 294 function de(l, e) { 295 if (l.indexOf(e[1]) === -1) return -1; 296 let t = 0; 297 for (let n = 0; n < l.length; n++) if (l[n] === "\\") n++; else if (l[n] === e[0]) t++; else if (l[n] === e[1] && (t--, t < 0)) return n; 298 return t > 0 ? -2 : -1 299 } 300 301 function me(l, e, t, n, s) { 302 let i = e.href, r = e.title || null, o = l[1].replace(s.other.outputLinkReplace, "$1"); 303 n.state.inLink = !0; 304 let a = { 305 type: l[0].charAt(0) === "!" ? "image" : "link", 306 raw: t, 307 href: i, 308 title: r, 309 text: o, 310 tokens: n.inlineTokens(o) 311 }; 312 return n.state.inLink = !1, a 313 } 314 315 function rt(l, e, t) { 316 let n = l.match(t.other.indentCodeCompensation); 317 if (n === null) return e;
vendor: 11,183 bytes, lines 318-565
318 let s = n[1]; 319 return e.split(` 320`).map(i => { 321 let r = i.match(t.other.beginningSpace); 322 if (r === null) return i; 323 let [o] = r; 324 return o.length >= s.length ? i.slice(s.length) : i 325 }).join(` 326`) 327 } 328 329 var S = class { 330 options; 331 rules; 332 lexer; 333 334 constructor(e) { 335 this.options = e || w 336 } 337 338 space(e) { 339 let t = this.rules.block.newline.exec(e); 340 if (t && t[0].length > 0) return {type: "space", raw: t[0]} 341 } 342 343 code(e) { 344 let t = this.rules.block.code.exec(e); 345 if (t) { 346 let n = t[0].replace(this.rules.other.codeRemoveIndent, ""); 347 return { 348 type: "code", raw: t[0], codeBlockStyle: "indented", text: this.options.pedantic ? n : A(n, ` 349`) 350 } 351 } 352 } 353 354 fences(e) { 355 let t = this.rules.block.fences.exec(e); 356 if (t) { 357 let n = t[0], s = rt(n, t[3] || "", this.rules); 358 return { 359 type: "code", 360 raw: n, 361 lang: t[2] ? t[2].trim().replace(this.rules.inline.anyPunctuation, "$1") : t[2], 362 text: s 363 } 364 } 365 } 366 367 heading(e) { 368 let t = this.rules.block.heading.exec(e); 369 if (t) { 370 let n = t[2].trim(); 371 if (this.rules.other.endingHash.test(n)) { 372 let s = A(n, "#"); 373 (this.options.pedantic || !s || this.rules.other.endingSpaceChar.test(s)) && (n = s.trim()) 374 } 375 return {type: "heading", raw: t[0], depth: t[1].length, text: n, tokens: this.lexer.inline(n)} 376 } 377 } 378 379 hr(e) { 380 let t = this.rules.block.hr.exec(e); 381 if (t) return { 382 type: "hr", raw: A(t[0], ` 383`) 384 } 385 } 386 387 blockquote(e) { 388 let t = this.rules.block.blockquote.exec(e); 389 if (t) { 390 let n = A(t[0], ` 391`).split(` 392`), s = "", i = "", r = []; 393 for (; n.length > 0;) { 394 let o = !1, a = [], c; 395 for (c = 0; c < n.length; c++) if (this.rules.other.blockquoteStart.test(n[c])) a.push(n[c]), o = !0; else if (!o) a.push(n[c]); else break; 396 n = n.slice(c); 397 let p = a.join(` 398`), u = p.replace(this.rules.other.blockquoteSetextReplace, ` 399 $1`).replace(this.rules.other.blockquoteSetextReplace2, ""); 400 s = s ? `${s} 401${p}` : p, i = i ? `${i} 402${u}` : u; 403 let d = this.lexer.state.top; 404 if (this.lexer.state.top = !0, this.lexer.blockTokens(u, r, !0), this.lexer.state.top = d, n.length === 0) break; 405 let g = r.at(-1); 406 if (g?.type === "code") break; 407 if (g?.type === "blockquote") { 408 let T = g, f = T.raw + ` 409` + n.join(` 410`), y = this.blockquote(f); 411 r[r.length - 1] = y, s = s.substring(0, s.length - T.raw.length) + y.raw, i = i.substring(0, i.length - T.text.length) + y.text; 412 break 413 } else if (g?.type === "list") { 414 let T = g, f = T.raw + ` 415` + n.join(` 416`), y = this.list(f); 417 r[r.length - 1] = y, s = s.substring(0, s.length - g.raw.length) + y.raw, i = i.substring(0, i.length - T.raw.length) + y.raw, n = f.substring(r.at(-1).raw.length).split(` 418`); 419 continue 420 } 421 } 422 return {type: "blockquote", raw: s, tokens: r, text: i} 423 } 424 } 425 426 list(e) { 427 let t = this.rules.block.list.exec(e); 428 if (t) { 429 let n = t[1].trim(), s = n.length > 1, 430 i = {type: "list", raw: "", ordered: s, start: s ? +n.slice(0, -1) : "", loose: !1, items: []}; 431 n = s ? `\\d{1,9}\\${n.slice(-1)}` : `\\${n}`, this.options.pedantic && (n = s ? n : "[*+-]"); 432 let r = this.rules.other.listItemRegex(n), o = !1; 433 for (; e;) { 434 let c = !1, p = "", u = ""; 435 if (!(t = r.exec(e)) || this.rules.block.hr.test(e)) break; 436 p = t[0], e = e.substring(p.length); 437 let d = t[2].split(` 438`, 1)[0].replace(this.rules.other.listReplaceTabs, Z => " ".repeat(3 * Z.length)), g = e.split(` 439`, 1)[0], T = !d.trim(), f = 0; 440 if (this.options.pedantic ? (f = 2, u = d.trimStart()) : T ? f = t[1].length + 1 : (f = t[2].search(this.rules.other.nonSpaceChar), f = f > 4 ? 1 : f, u = d.slice(f), f += t[1].length), T && this.rules.other.blankLine.test(g) && (p += g + ` 441`, e = e.substring(g.length + 1), c = !0), !c) { 442 let Z = this.rules.other.nextBulletRegex(f), te = this.rules.other.hrRegex(f), 443 ne = this.rules.other.fencesBeginRegex(f), se = this.rules.other.headingBeginRegex(f), 444 xe = this.rules.other.htmlBeginRegex(f); 445 for (; e;) { 446 let G = e.split(` 447`, 1)[0], C; 448 if (g = G, this.options.pedantic ? (g = g.replace(this.rules.other.listReplaceNesting, " "), C = g) : C = g.replace(this.rules.other.tabCharGlobal, " "), ne.test(g) || se.test(g) || xe.test(g) || Z.test(g) || te.test(g)) break; 449 if (C.search(this.rules.other.nonSpaceChar) >= f || !g.trim()) u += ` 450` + C.slice(f); else { 451 if (T || d.replace(this.rules.other.tabCharGlobal, " ").search(this.rules.other.nonSpaceChar) >= 4 || ne.test(d) || se.test(d) || te.test(d)) break; 452 u += ` 453` + g 454 } 455 !T && !g.trim() && (T = !0), p += G + ` 456`, e = e.substring(G.length + 1), d = C.slice(f) 457 } 458 } 459 i.loose || (o ? i.loose = !0 : this.rules.other.doubleBlankLine.test(p) && (o = !0)); 460 let y = null, ee; 461 this.options.gfm && (y = this.rules.other.listIsTask.exec(u), y && (ee = y[0] !== "[ ] ", u = u.replace(this.rules.other.listReplaceTask, ""))), i.items.push({ 462 type: "list_item", 463 raw: p, 464 task: !!y, 465 checked: ee, 466 loose: !1, 467 text: u, 468 tokens: [] 469 }), i.raw += p 470 } 471 let a = i.items.at(-1); 472 if (a) a.raw = a.raw.trimEnd(), a.text = a.text.trimEnd(); else return; 473 i.raw = i.raw.trimEnd(); 474 for (let c = 0; c < i.items.length; c++) if (this.lexer.state.top = !1, i.items[c].tokens = this.lexer.blockTokens(i.items[c].text, []), !i.loose) { 475 let p = i.items[c].tokens.filter(d => d.type === "space"), 476 u = p.length > 0 && p.some(d => this.rules.other.anyLine.test(d.raw)); 477 i.loose = u 478 } 479 if (i.loose) for (let c = 0; c < i.items.length; c++) i.items[c].loose = !0; 480 return i 481 } 482 } 483 484 html(e) { 485 let t = this.rules.block.html.exec(e); 486 if (t) return { 487 type: "html", 488 block: !0, 489 raw: t[0], 490 pre: t[1] === "pre" || t[1] === "script" || t[1] === "style", 491 text: t[0] 492 } 493 } 494 495 def(e) { 496 let t = this.rules.block.def.exec(e); 497 if (t) { 498 let n = t[1].toLowerCase().replace(this.rules.other.multipleSpaceGlobal, " "), 499 s = t[2] ? t[2].replace(this.rules.other.hrefBrackets, "$1").replace(this.rules.inline.anyPunctuation, "$1") : "", 500 i = t[3] ? t[3].substring(1, t[3].length - 1).replace(this.rules.inline.anyPunctuation, "$1") : t[3]; 501 return {type: "def", tag: n, raw: t[0], href: s, title: i} 502 } 503 } 504 505 table(e) { 506 let t = this.rules.block.table.exec(e); 507 if (!t || !this.rules.other.tableDelimiter.test(t[2])) return; 508 let n = Y(t[1]), s = t[2].replace(this.rules.other.tableAlignChars, "").split("|"), 509 i = t[3]?.trim() ? t[3].replace(this.rules.other.tableRowBlankLine, "").split(` 510`) : [], r = {type: "table", raw: t[0], header: [], align: [], rows: []}; 511 if (n.length === s.length) { 512 for (let o of s) this.rules.other.tableAlignRight.test(o) ? r.align.push("right") : this.rules.other.tableAlignCenter.test(o) ? r.align.push("center") : this.rules.other.tableAlignLeft.test(o) ? r.align.push("left") : r.align.push(null); 513 for (let o = 0; o < n.length; o++) r.header.push({ 514 text: n[o], 515 tokens: this.lexer.inline(n[o]), 516 header: !0, 517 align: r.align[o] 518 }); 519 for (let o of i) r.rows.push(Y(o, r.header.length).map((a, c) => ({ 520 text: a, 521 tokens: this.lexer.inline(a), 522 header: !1, 523 align: r.align[c] 524 }))); 525 return r 526 } 527 } 528 529 lheading(e) { 530 let t = this.rules.block.lheading.exec(e); 531 if (t) return { 532 type: "heading", 533 raw: t[0], 534 depth: t[2].charAt(0) === "=" ? 1 : 2, 535 text: t[1], 536 tokens: this.lexer.inline(t[1]) 537 } 538 } 539 540 paragraph(e) { 541 let t = this.rules.block.paragraph.exec(e); 542 if (t) { 543 let n = t[1].charAt(t[1].length - 1) === ` 544` ? t[1].slice(0, -1) : t[1]; 545 return {type: "paragraph", raw: t[0], text: n, tokens: this.lexer.inline(n)} 546 } 547 } 548 549 text(e) { 550 let t = this.rules.block.text.exec(e); 551 if (t) return {type: "text", raw: t[0], text: t[0], tokens: this.lexer.inline(t[0])} 552 } 553 554 escape(e) { 555 let t = this.rules.inline.escape.exec(e); 556 if (t) return {type: "escape", raw: t[0], text: t[1]} 557 } 558 559 tag(e) { 560 let t = this.rules.inline.tag.exec(e); 561 if (t) return !this.lexer.state.inLink && this.rules.other.startATag.test(t[0]) ? this.lexer.state.inLink = !0 : this.lexer.state.inLink && this.rules.other.endATag.test(t[0]) && (this.lexer.state.inLink = !1), !this.lexer.state.inRawBlock && this.rules.other.startPreScriptTag.test(t[0]) ? this.lexer.state.inRawBlock = !0 : this.lexer.state.inRawBlock && this.rules.other.endPreScriptTag.test(t[0]) && (this.lexer.state.inRawBlock = !1), { 562 type: "html", 563 raw: t[0], 564 inLink: this.lexer.state.inLink, 565 inRawBlock: this.lexer.state.inRawBlock,
vendor: 4,682 bytes, lines 566-667
566 block: !1, 567 text: t[0] 568 } 569 } 570 571 link(e) { 572 let t = this.rules.inline.link.exec(e); 573 if (t) { 574 let n = t[2].trim(); 575 if (!this.options.pedantic && this.rules.other.startAngleBracket.test(n)) { 576 if (!this.rules.other.endAngleBracket.test(n)) return; 577 let r = A(n.slice(0, -1), "\\"); 578 if ((n.length - r.length) % 2 === 0) return 579 } else { 580 let r = de(t[2], "()"); 581 if (r === -2) return; 582 if (r > -1) { 583 let a = (t[0].indexOf("!") === 0 ? 5 : 4) + t[1].length + r; 584 t[2] = t[2].substring(0, r), t[0] = t[0].substring(0, a).trim(), t[3] = "" 585 } 586 } 587 let s = t[2], i = ""; 588 if (this.options.pedantic) { 589 let r = this.rules.other.pedanticHrefTitle.exec(s); 590 r && (s = r[1], i = r[3]) 591 } else i = t[3] ? t[3].slice(1, -1) : ""; 592 return s = s.trim(), this.rules.other.startAngleBracket.test(s) && (this.options.pedantic && !this.rules.other.endAngleBracket.test(n) ? s = s.slice(1) : s = s.slice(1, -1)), me(t, { 593 href: s && s.replace(this.rules.inline.anyPunctuation, "$1"), 594 title: i && i.replace(this.rules.inline.anyPunctuation, "$1") 595 }, t[0], this.lexer, this.rules) 596 } 597 } 598 599 reflink(e, t) { 600 let n; 601 if ((n = this.rules.inline.reflink.exec(e)) || (n = this.rules.inline.nolink.exec(e))) { 602 let s = (n[2] || n[1]).replace(this.rules.other.multipleSpaceGlobal, " "), i = t[s.toLowerCase()]; 603 if (!i) { 604 let r = n[0].charAt(0); 605 return {type: "text", raw: r, text: r} 606 } 607 return me(n, i, n[0], this.lexer, this.rules) 608 } 609 } 610 611 emStrong(e, t, n = "") { 612 let s = this.rules.inline.emStrongLDelim.exec(e); 613 if (!s || s[3] && n.match(this.rules.other.unicodeAlphaNumeric)) return; 614 if (!(s[1] || s[2] || "") || !n || this.rules.inline.punctuation.exec(n)) { 615 let r = [...s[0]].length - 1, o, a, c = r, p = 0, 616 u = s[0][0] === "*" ? this.rules.inline.emStrongRDelimAst : this.rules.inline.emStrongRDelimUnd; 617 for (u.lastIndex = 0, t = t.slice(-1 * e.length + r); (s = u.exec(t)) != null;) { 618 if (o = s[1] || s[2] || s[3] || s[4] || s[5] || s[6], !o) continue; 619 if (a = [...o].length, s[3] || s[4]) { 620 c += a; 621 continue 622 } else if ((s[5] || s[6]) && r % 3 && !((r + a) % 3)) { 623 p += a; 624 continue 625 } 626 if (c -= a, c > 0) continue; 627 a = Math.min(a, a + c + p); 628 let d = [...s[0]][0].length, g = e.slice(0, r + s.index + d + a); 629 if (Math.min(r, a) % 2) { 630 let f = g.slice(1, -1); 631 return {type: "em", raw: g, text: f, tokens: this.lexer.inlineTokens(f)} 632 } 633 let T = g.slice(2, -2); 634 return {type: "strong", raw: g, text: T, tokens: this.lexer.inlineTokens(T)} 635 } 636 } 637 } 638 639 codespan(e) { 640 let t = this.rules.inline.code.exec(e); 641 if (t) { 642 let n = t[2].replace(this.rules.other.newLineCharGlobal, " "), 643 s = this.rules.other.nonSpaceChar.test(n), 644 i = this.rules.other.startingSpaceChar.test(n) && this.rules.other.endingSpaceChar.test(n); 645 return s && i && (n = n.substring(1, n.length - 1)), {type: "codespan", raw: t[0], text: n} 646 } 647 } 648 649 br(e) { 650 let t = this.rules.inline.br.exec(e); 651 if (t) return {type: "br", raw: t[0]} 652 } 653 654 del(e) { 655 let t = this.rules.inline.del.exec(e); 656 if (t) return {type: "del", raw: t[0], text: t[2], tokens: this.lexer.inlineTokens(t[2])} 657 } 658 659 autolink(e) { 660 let t = this.rules.inline.autolink.exec(e); 661 if (t) { 662 let n, s; 663 return t[2] === "@" ? (n = t[1], s = "mailto:" + n) : (n = t[1], s = n), { 664 type: "link", 665 raw: t[0], 666 text: n, 667 href: s,
vendor: 9,417 bytes, lines 668-882
668 tokens: [{type: "text", raw: n, text: n}] 669 } 670 } 671 } 672 673 url(e) { 674 let t; 675 if (t = this.rules.inline.url.exec(e)) { 676 let n, s; 677 if (t[2] === "@") n = t[0], s = "mailto:" + n; else { 678 let i; 679 do i = t[0], t[0] = this.rules.inline._backpedal.exec(t[0])?.[0] ?? ""; while (i !== t[0]); 680 n = t[0], t[1] === "www." ? s = "http://" + t[0] : s = t[0] 681 } 682 return {type: "link", raw: t[0], text: n, href: s, tokens: [{type: "text", raw: n, text: n}]} 683 } 684 } 685 686 inlineText(e) { 687 let t = this.rules.inline.text.exec(e); 688 if (t) { 689 let n = this.lexer.state.inRawBlock; 690 return {type: "text", raw: t[0], text: t[0], escaped: n} 691 } 692 } 693 }; 694 var x = class l { 695 tokens; 696 options; 697 state; 698 tokenizer; 699 inlineQueue; 700 701 constructor(e) { 702 this.tokens = [], this.tokens.links = Object.create(null), this.options = e || w, this.options.tokenizer = this.options.tokenizer || new S, this.tokenizer = this.options.tokenizer, this.tokenizer.options = this.options, this.tokenizer.lexer = this, this.inlineQueue = [], this.state = { 703 inLink: !1, 704 inRawBlock: !1, 705 top: !0 706 }; 707 let t = {other: m, block: B.normal, inline: P.normal}; 708 this.options.pedantic ? (t.block = B.pedantic, t.inline = P.pedantic) : this.options.gfm && (t.block = B.gfm, this.options.breaks ? t.inline = P.breaks : t.inline = P.gfm), this.tokenizer.rules = t 709 } 710 711 static get rules() { 712 return {block: B, inline: P} 713 } 714 715 static lex(e, t) { 716 return new l(t).lex(e) 717 } 718 719 static lexInline(e, t) { 720 return new l(t).inlineTokens(e) 721 } 722 723 lex(e) { 724 e = e.replace(m.carriageReturn, ` 725`), this.blockTokens(e, this.tokens); 726 for (let t = 0; t < this.inlineQueue.length; t++) { 727 let n = this.inlineQueue[t]; 728 this.inlineTokens(n.src, n.tokens) 729 } 730 return this.inlineQueue = [], this.tokens 731 } 732 733 blockTokens(e, t = [], n = !1) { 734 for (this.options.pedantic && (e = e.replace(m.tabCharGlobal, " ").replace(m.spaceLine, "")); e;) { 735 let s; 736 if (this.options.extensions?.block?.some(r => (s = r.call({lexer: this}, e, t)) ? (e = e.substring(s.raw.length), t.push(s), !0) : !1)) continue; 737 if (s = this.tokenizer.space(e)) { 738 e = e.substring(s.raw.length); 739 let r = t.at(-1); 740 s.raw.length === 1 && r !== void 0 ? r.raw += ` 741` : t.push(s); 742 continue 743 } 744 if (s = this.tokenizer.code(e)) { 745 e = e.substring(s.raw.length); 746 let r = t.at(-1); 747 r?.type === "paragraph" || r?.type === "text" ? (r.raw += ` 748` + s.raw, r.text += ` 749` + s.text, this.inlineQueue.at(-1).src = r.text) : t.push(s); 750 continue 751 } 752 if (s = this.tokenizer.fences(e)) { 753 e = e.substring(s.raw.length), t.push(s); 754 continue 755 } 756 if (s = this.tokenizer.heading(e)) { 757 e = e.substring(s.raw.length), t.push(s); 758 continue 759 } 760 if (s = this.tokenizer.hr(e)) { 761 e = e.substring(s.raw.length), t.push(s); 762 continue 763 } 764 if (s = this.tokenizer.blockquote(e)) { 765 e = e.substring(s.raw.length), t.push(s); 766 continue 767 } 768 if (s = this.tokenizer.list(e)) { 769 e = e.substring(s.raw.length), t.push(s); 770 continue 771 } 772 if (s = this.tokenizer.html(e)) { 773 e = e.substring(s.raw.length), t.push(s); 774 continue 775 } 776 if (s = this.tokenizer.def(e)) { 777 e = e.substring(s.raw.length); 778 let r = t.at(-1); 779 r?.type === "paragraph" || r?.type === "text" ? (r.raw += ` 780` + s.raw, r.text += ` 781` + s.raw, this.inlineQueue.at(-1).src = r.text) : this.tokens.links[s.tag] || (this.tokens.links[s.tag] = { 782 href: s.href, 783 title: s.title 784 }); 785 continue 786 } 787 if (s = this.tokenizer.table(e)) { 788 e = e.substring(s.raw.length), t.push(s); 789 continue 790 } 791 if (s = this.tokenizer.lheading(e)) { 792 e = e.substring(s.raw.length), t.push(s); 793 continue 794 } 795 let i = e; 796 if (this.options.extensions?.startBlock) { 797 let r = 1 / 0, o = e.slice(1), a; 798 this.options.extensions.startBlock.forEach(c => { 799 a = c.call({lexer: this}, o), typeof a == "number" && a >= 0 && (r = Math.min(r, a)) 800 }), r < 1 / 0 && r >= 0 && (i = e.substring(0, r + 1)) 801 } 802 if (this.state.top && (s = this.tokenizer.paragraph(i))) { 803 let r = t.at(-1); 804 n && r?.type === "paragraph" ? (r.raw += ` 805` + s.raw, r.text += ` 806` + s.text, this.inlineQueue.pop(), this.inlineQueue.at(-1).src = r.text) : t.push(s), n = i.length !== e.length, e = e.substring(s.raw.length); 807 continue 808 } 809 if (s = this.tokenizer.text(e)) { 810 e = e.substring(s.raw.length); 811 let r = t.at(-1); 812 r?.type === "text" ? (r.raw += ` 813` + s.raw, r.text += ` 814` + s.text, this.inlineQueue.pop(), this.inlineQueue.at(-1).src = r.text) : t.push(s); 815 continue 816 } 817 if (e) { 818 let r = "Infinite loop on byte: " + e.charCodeAt(0); 819 if (this.options.silent) { 820 console.error(r); 821 break 822 } else throw new Error(r) 823 } 824 } 825 return this.state.top = !0, t 826 } 827 828 inline(e, t = []) { 829 return this.inlineQueue.push({src: e, tokens: t}), t 830 } 831 832 inlineTokens(e, t = []) { 833 let n = e, s = null; 834 if (this.tokens.links) { 835 let o = Object.keys(this.tokens.links); 836 if (o.length > 0) for (; (s = this.tokenizer.rules.inline.reflinkSearch.exec(n)) != null;) o.includes(s[0].slice(s[0].lastIndexOf("[") + 1, -1)) && (n = n.slice(0, s.index) + "[" + "a".repeat(s[0].length - 2) + "]" + n.slice(this.tokenizer.rules.inline.reflinkSearch.lastIndex)) 837 } 838 for (; (s = this.tokenizer.rules.inline.anyPunctuation.exec(n)) != null;) n = n.slice(0, s.index) + "++" + n.slice(this.tokenizer.rules.inline.anyPunctuation.lastIndex); 839 for (; (s = this.tokenizer.rules.inline.blockSkip.exec(n)) != null;) n = n.slice(0, s.index) + "[" + "a".repeat(s[0].length - 2) + "]" + n.slice(this.tokenizer.rules.inline.blockSkip.lastIndex); 840 let i = !1, r = ""; 841 for (; e;) { 842 i || (r = ""), i = !1; 843 let o; 844 if (this.options.extensions?.inline?.some(c => (o = c.call({lexer: this}, e, t)) ? (e = e.substring(o.raw.length), t.push(o), !0) : !1)) continue; 845 if (o = this.tokenizer.escape(e)) { 846 e = e.substring(o.raw.length), t.push(o); 847 continue 848 } 849 if (o = this.tokenizer.tag(e)) { 850 e = e.substring(o.raw.length), t.push(o); 851 continue 852 } 853 if (o = this.tokenizer.link(e)) { 854 e = e.substring(o.raw.length), t.push(o); 855 continue 856 } 857 if (o = this.tokenizer.reflink(e, this.tokens.links)) { 858 e = e.substring(o.raw.length); 859 let c = t.at(-1); 860 o.type === "text" && c?.type === "text" ? (c.raw += o.raw, c.text += o.text) : t.push(o); 861 continue 862 } 863 if (o = this.tokenizer.emStrong(e, n, r)) { 864 e = e.substring(o.raw.length), t.push(o); 865 continue 866 } 867 if (o = this.tokenizer.codespan(e)) { 868 e = e.substring(o.raw.length), t.push(o); 869 continue 870 } 871 if (o = this.tokenizer.br(e)) { 872 e = e.substring(o.raw.length), t.push(o); 873 continue 874 } 875 if (o = this.tokenizer.del(e)) { 876 e = e.substring(o.raw.length), t.push(o); 877 continue 878 } 879 if (o = this.tokenizer.autolink(e)) { 880 e = e.substring(o.raw.length), t.push(o); 881 continue 882 }
vendor: 14,623 bytes, lines 883-1332
883 if (!this.state.inLink && (o = this.tokenizer.url(e))) { 884 e = e.substring(o.raw.length), t.push(o); 885 continue 886 } 887 let a = e; 888 if (this.options.extensions?.startInline) { 889 let c = 1 / 0, p = e.slice(1), u; 890 this.options.extensions.startInline.forEach(d => { 891 u = d.call({lexer: this}, p), typeof u == "number" && u >= 0 && (c = Math.min(c, u)) 892 }), c < 1 / 0 && c >= 0 && (a = e.substring(0, c + 1)) 893 } 894 if (o = this.tokenizer.inlineText(a)) { 895 e = e.substring(o.raw.length), o.raw.slice(-1) !== "_" && (r = o.raw.slice(-1)), i = !0; 896 let c = t.at(-1); 897 c?.type === "text" ? (c.raw += o.raw, c.text += o.text) : t.push(o); 898 continue 899 } 900 if (e) { 901 let c = "Infinite loop on byte: " + e.charCodeAt(0); 902 if (this.options.silent) { 903 console.error(c); 904 break 905 } else throw new Error(c) 906 } 907 } 908 return t 909 } 910 }; 911 var $ = class { 912 options; 913 parser; 914 915 constructor(e) { 916 this.options = e || w 917 } 918 919 space(e) { 920 return "" 921 } 922 923 code({text: e, lang: t, escaped: n}) { 924 let s = (t || "").match(m.notSpaceStart)?.[0], i = e.replace(m.endingNewline, "") + ` 925`; 926 return s ? '<pre><code class="language-' + R(s) + '">' + (n ? i : R(i, !0)) + `</code></pre> 927` : "<pre><code>" + (n ? i : R(i, !0)) + `</code></pre> 928` 929 } 930 931 blockquote({tokens: e}) { 932 return `<blockquote> 933${this.parser.parse(e)}</blockquote> 934` 935 } 936 937 html({text: e}) { 938 return e 939 } 940 941 heading({tokens: e, depth: t}) { 942 return `<h${t}>${this.parser.parseInline(e)}</h${t}> 943` 944 } 945 946 hr(e) { 947 return `<hr> 948` 949 } 950 951 list(e) { 952 let t = e.ordered, n = e.start, s = ""; 953 for (let o = 0; o < e.items.length; o++) { 954 let a = e.items[o]; 955 s += this.listitem(a) 956 } 957 let i = t ? "ol" : "ul", r = t && n !== 1 ? ' start="' + n + '"' : ""; 958 return "<" + i + r + `> 959` + s + "</" + i + `> 960` 961 } 962 963 listitem(e) { 964 let t = ""; 965 if (e.task) { 966 let n = this.checkbox({checked: !!e.checked}); 967 e.loose ? e.tokens[0]?.type === "paragraph" ? (e.tokens[0].text = n + " " + e.tokens[0].text, e.tokens[0].tokens && e.tokens[0].tokens.length > 0 && e.tokens[0].tokens[0].type === "text" && (e.tokens[0].tokens[0].text = n + " " + R(e.tokens[0].tokens[0].text), e.tokens[0].tokens[0].escaped = !0)) : e.tokens.unshift({ 968 type: "text", 969 raw: n + " ", 970 text: n + " ", 971 escaped: !0 972 }) : t += n + " " 973 } 974 return t += this.parser.parse(e.tokens, !!e.loose), `<li>${t}</li> 975` 976 } 977 978 checkbox({checked: e}) { 979 return "<input " + (e ? 'checked="" ' : "") + 'disabled="" type="checkbox">' 980 } 981 982 paragraph({tokens: e}) { 983 return `<p>${this.parser.parseInline(e)}</p> 984` 985 } 986 987 table(e) { 988 let t = "", n = ""; 989 for (let i = 0; i < e.header.length; i++) n += this.tablecell(e.header[i]); 990 t += this.tablerow({text: n}); 991 let s = ""; 992 for (let i = 0; i < e.rows.length; i++) { 993 let r = e.rows[i]; 994 n = ""; 995 for (let o = 0; o < r.length; o++) n += this.tablecell(r[o]); 996 s += this.tablerow({text: n}) 997 } 998 return s && (s = `<tbody>${s}</tbody>`), `<table> 999<thead> 1000` + t + `</thead> 1001` + s + `</table> 1002` 1003 } 1004 1005 tablerow({text: e}) { 1006 return `<tr> 1007${e}</tr> 1008` 1009 } 1010 1011 tablecell(e) { 1012 let t = this.parser.parseInline(e.tokens), n = e.header ? "th" : "td"; 1013 return (e.align ? `<${n} align="${e.align}">` : `<${n}>`) + t + `</${n}> 1014` 1015 } 1016 1017 strong({tokens: e}) { 1018 return `<strong>${this.parser.parseInline(e)}</strong>` 1019 } 1020 1021 em({tokens: e}) { 1022 return `<em>${this.parser.parseInline(e)}</em>` 1023 } 1024 1025 codespan({text: e}) { 1026 return `<code>${R(e, !0)}</code>` 1027 } 1028 1029 br(e) { 1030 return "<br>" 1031 } 1032 1033 del({tokens: e}) { 1034 return `<del>${this.parser.parseInline(e)}</del>` 1035 } 1036 1037 link({href: e, title: t, tokens: n}) { 1038 let s = this.parser.parseInline(n), i = V(e); 1039 if (i === null) return s; 1040 e = i; 1041 let r = '<a href="' + e + '"'; 1042 return t && (r += ' title="' + R(t) + '"'), r += ">" + s + "</a>", r 1043 } 1044 1045 image({href: e, title: t, text: n, tokens: s}) { 1046 s && (n = this.parser.parseInline(s, this.parser.textRenderer)); 1047 let i = V(e); 1048 if (i === null) return R(n); 1049 e = i; 1050 let r = `<img src="${e}" alt="${n}"`; 1051 return t && (r += ` title="${R(t)}"`), r += ">", r 1052 } 1053 1054 text(e) { 1055 return "tokens" in e && e.tokens ? this.parser.parseInline(e.tokens) : "escaped" in e && e.escaped ? e.text : R(e.text) 1056 } 1057 }; 1058 var _ = class { 1059 strong({text: e}) { 1060 return e 1061 } 1062 1063 em({text: e}) { 1064 return e 1065 } 1066 1067 codespan({text: e}) { 1068 return e 1069 } 1070 1071 del({text: e}) { 1072 return e 1073 } 1074 1075 html({text: e}) { 1076 return e 1077 } 1078 1079 text({text: e}) { 1080 return e 1081 } 1082 1083 link({text: e}) { 1084 return "" + e 1085 } 1086 1087 image({text: e}) { 1088 return "" + e 1089 } 1090 1091 br() { 1092 return "" 1093 } 1094 }; 1095 var b = class l { 1096 options; 1097 renderer; 1098 textRenderer; 1099 1100 constructor(e) { 1101 this.options = e || w, this.options.renderer = this.options.renderer || new $, this.renderer = this.options.renderer, this.renderer.options = this.options, this.renderer.parser = this, this.textRenderer = new _ 1102 } 1103 1104 static parse(e, t) { 1105 return new l(t).parse(e) 1106 } 1107 1108 static parseInline(e, t) { 1109 return new l(t).parseInline(e) 1110 } 1111 1112 parse(e, t = !0) { 1113 let n = ""; 1114 for (let s = 0; s < e.length; s++) { 1115 let i = e[s]; 1116 if (this.options.extensions?.renderers?.[i.type]) { 1117 let o = i, a = this.options.extensions.renderers[o.type].call({parser: this}, o); 1118 if (a !== !1 || !["space", "hr", "heading", "code", "table", "blockquote", "list", "html", "paragraph", "text"].includes(o.type)) { 1119 n += a || ""; 1120 continue 1121 } 1122 } 1123 let r = i; 1124 switch (r.type) { 1125 case"space": { 1126 n += this.renderer.space(r); 1127 continue 1128 } 1129 case"hr": { 1130 n += this.renderer.hr(r); 1131 continue 1132 } 1133 case"heading": { 1134 n += this.renderer.heading(r); 1135 continue 1136 } 1137 case"code": { 1138 n += this.renderer.code(r); 1139 continue 1140 } 1141 case"table": { 1142 n += this.renderer.table(r); 1143 continue 1144 } 1145 case"blockquote": { 1146 n += this.renderer.blockquote(r); 1147 continue 1148 } 1149 case"list": { 1150 n += this.renderer.list(r); 1151 continue 1152 } 1153 case"html": { 1154 n += this.renderer.html(r); 1155 continue 1156 } 1157 case"paragraph": { 1158 n += this.renderer.paragraph(r); 1159 continue 1160 } 1161 case"text": { 1162 let o = r, a = this.renderer.text(o); 1163 for (; s + 1 < e.length && e[s + 1].type === "text";) o = e[++s], a += ` 1164` + this.renderer.text(o); 1165 t ? n += this.renderer.paragraph({ 1166 type: "paragraph", 1167 raw: a, 1168 text: a, 1169 tokens: [{type: "text", raw: a, text: a, escaped: !0}] 1170 }) : n += a; 1171 continue 1172 } 1173 default: { 1174 let o = 'Token with "' + r.type + '" type was not found.'; 1175 if (this.options.silent) return console.error(o), ""; 1176 throw new Error(o) 1177 } 1178 } 1179 } 1180 return n 1181 } 1182 1183 parseInline(e, t = this.renderer) { 1184 let n = ""; 1185 for (let s = 0; s < e.length; s++) { 1186 let i = e[s]; 1187 if (this.options.extensions?.renderers?.[i.type]) { 1188 let o = this.options.extensions.renderers[i.type].call({parser: this}, i); 1189 if (o !== !1 || !["escape", "html", "link", "image", "strong", "em", "codespan", "br", "del", "text"].includes(i.type)) { 1190 n += o || ""; 1191 continue 1192 } 1193 } 1194 let r = i; 1195 switch (r.type) { 1196 case"escape": { 1197 n += t.text(r); 1198 break 1199 } 1200 case"html": { 1201 n += t.html(r); 1202 break 1203 } 1204 case"link": { 1205 n += t.link(r); 1206 break 1207 } 1208 case"image": { 1209 n += t.image(r); 1210 break 1211 } 1212 case"strong": { 1213 n += t.strong(r); 1214 break 1215 } 1216 case"em": { 1217 n += t.em(r); 1218 break 1219 } 1220 case"codespan": { 1221 n += t.codespan(r); 1222 break 1223 } 1224 case"br": { 1225 n += t.br(r); 1226 break 1227 } 1228 case"del": { 1229 n += t.del(r); 1230 break 1231 } 1232 case"text": { 1233 n += t.text(r); 1234 break 1235 } 1236 default: { 1237 let o = 'Token with "' + r.type + '" type was not found.'; 1238 if (this.options.silent) return console.error(o), ""; 1239 throw new Error(o) 1240 } 1241 } 1242 } 1243 return n 1244 } 1245 }; 1246 var L = class { 1247 options; 1248 block; 1249 1250 constructor(e) { 1251 this.options = e || w 1252 } 1253 1254 static passThroughHooks = new Set(["preprocess", "postprocess", "processAllTokens"]); 1255 1256 preprocess(e) { 1257 return e 1258 } 1259 1260 postprocess(e) { 1261 return e 1262 } 1263 1264 processAllTokens(e) { 1265 return e 1266 } 1267 1268 provideLexer() { 1269 return this.block ? x.lex : x.lexInline 1270 } 1271 1272 provideParser() { 1273 return this.block ? b.parse : b.parseInline 1274 } 1275 }; 1276 var E = class { 1277 defaults = z(); 1278 options = this.setOptions; 1279 parse = this.parseMarkdown(!0); 1280 parseInline = this.parseMarkdown(!1); 1281 Parser = b; 1282 Renderer = $; 1283 TextRenderer = _; 1284 Lexer = x; 1285 Tokenizer = S; 1286 Hooks = L; 1287 1288 constructor(...e) { 1289 this.use(...e) 1290 } 1291 1292 walkTokens(e, t) { 1293 let n = []; 1294 for (let s of e) switch (n = n.concat(t.call(this, s)), s.type) { 1295 case"table": { 1296 let i = s; 1297 for (let r of i.header) n = n.concat(this.walkTokens(r.tokens, t)); 1298 for (let r of i.rows) for (let o of r) n = n.concat(this.walkTokens(o.tokens, t)); 1299 break 1300 } 1301 case"list": { 1302 let i = s; 1303 n = n.concat(this.walkTokens(i.items, t)); 1304 break 1305 } 1306 default: { 1307 let i = s; 1308 this.defaults.extensions?.childTokens?.[i.type] ? this.defaults.extensions.childTokens[i.type].forEach(r => { 1309 let o = i[r].flat(1 / 0); 1310 n = n.concat(this.walkTokens(o, t)) 1311 }) : i.tokens && (n = n.concat(this.walkTokens(i.tokens, t))) 1312 } 1313 } 1314 return n 1315 } 1316 1317 use(...e) { 1318 let t = this.defaults.extensions || {renderers: {}, childTokens: {}}; 1319 return e.forEach(n => { 1320 let s = {...n}; 1321 if (s.async = this.defaults.async || s.async || !1, n.extensions && (n.extensions.forEach(i => { 1322 if (!i.name) throw new Error("extension name required"); 1323 if ("renderer" in i) { 1324 let r = t.renderers[i.name]; 1325 r ? t.renderers[i.name] = function (...o) { 1326 let a = i.renderer.apply(this, o); 1327 return a === !1 && (a = r.apply(this, o)), a 1328 } : t.renderers[i.name] = i.renderer 1329 } 1330 if ("tokenizer" in i) { 1331 if (!i.level || i.level !== "block" && i.level !== "inline") throw new Error("extension level must be 'block' or 'inline'"); 1332 let r = t[i.level];
vendor: 5,682 bytes, lines 1333-1446
1333 r ? r.unshift(i.tokenizer) : t[i.level] = [i.tokenizer], i.start && (i.level === "block" ? t.startBlock ? t.startBlock.push(i.start) : t.startBlock = [i.start] : i.level === "inline" && (t.startInline ? t.startInline.push(i.start) : t.startInline = [i.start])) 1334 } 1335 "childTokens" in i && i.childTokens && (t.childTokens[i.name] = i.childTokens) 1336 }), s.extensions = t), n.renderer) { 1337 let i = this.defaults.renderer || new $(this.defaults); 1338 for (let r in n.renderer) { 1339 if (!(r in i)) throw new Error(`renderer '${r}' does not exist`); 1340 if (["options", "parser"].includes(r)) continue; 1341 let o = r, a = n.renderer[o], c = i[o]; 1342 i[o] = (...p) => { 1343 let u = a.apply(i, p); 1344 return u === !1 && (u = c.apply(i, p)), u || "" 1345 } 1346 } 1347 s.renderer = i 1348 } 1349 if (n.tokenizer) { 1350 let i = this.defaults.tokenizer || new S(this.defaults); 1351 for (let r in n.tokenizer) { 1352 if (!(r in i)) throw new Error(`tokenizer '${r}' does not exist`); 1353 if (["options", "rules", "lexer"].includes(r)) continue; 1354 let o = r, a = n.tokenizer[o], c = i[o]; 1355 i[o] = (...p) => { 1356 let u = a.apply(i, p); 1357 return u === !1 && (u = c.apply(i, p)), u 1358 } 1359 } 1360 s.tokenizer = i 1361 } 1362 if (n.hooks) { 1363 let i = this.defaults.hooks || new L; 1364 for (let r in n.hooks) { 1365 if (!(r in i)) throw new Error(`hook '${r}' does not exist`); 1366 if (["options", "block"].includes(r)) continue; 1367 let o = r, a = n.hooks[o], c = i[o]; 1368 L.passThroughHooks.has(r) ? i[o] = p => { 1369 if (this.defaults.async) return Promise.resolve(a.call(i, p)).then(d => c.call(i, d)); 1370 let u = a.call(i, p); 1371 return c.call(i, u) 1372 } : i[o] = (...p) => { 1373 let u = a.apply(i, p); 1374 return u === !1 && (u = c.apply(i, p)), u 1375 } 1376 } 1377 s.hooks = i 1378 } 1379 if (n.walkTokens) { 1380 let i = this.defaults.walkTokens, r = n.walkTokens; 1381 s.walkTokens = function (o) { 1382 let a = []; 1383 return a.push(r.call(this, o)), i && (a = a.concat(i.call(this, o))), a 1384 } 1385 } 1386 this.defaults = {...this.defaults, ...s} 1387 }), this 1388 } 1389 1390 setOptions(e) { 1391 return this.defaults = {...this.defaults, ...e}, this 1392 } 1393 1394 lexer(e, t) { 1395 return x.lex(e, t ?? this.defaults) 1396 } 1397 1398 parser(e, t) { 1399 return b.parse(e, t ?? this.defaults) 1400 } 1401 1402 parseMarkdown(e) { 1403 return (n, s) => { 1404 let i = {...s}, r = {...this.defaults, ...i}, o = this.onError(!!r.silent, !!r.async); 1405 if (this.defaults.async === !0 && i.async === !1) return o(new Error("marked(): The async option was set to true by an extension. Remove async: false from the parse options object to return a Promise.")); 1406 if (typeof n > "u" || n === null) return o(new Error("marked(): input parameter is undefined or null")); 1407 if (typeof n != "string") return o(new Error("marked(): input parameter is of type " + Object.prototype.toString.call(n) + ", string expected")); 1408 r.hooks && (r.hooks.options = r, r.hooks.block = e); 1409 let a = r.hooks ? r.hooks.provideLexer() : e ? x.lex : x.lexInline, 1410 c = r.hooks ? r.hooks.provideParser() : e ? b.parse : b.parseInline; 1411 if (r.async) return Promise.resolve(r.hooks ? r.hooks.preprocess(n) : n).then(p => a(p, r)).then(p => r.hooks ? r.hooks.processAllTokens(p) : p).then(p => r.walkTokens ? Promise.all(this.walkTokens(p, r.walkTokens)).then(() => p) : p).then(p => c(p, r)).then(p => r.hooks ? r.hooks.postprocess(p) : p).catch(o); 1412 try { 1413 r.hooks && (n = r.hooks.preprocess(n)); 1414 let p = a(n, r); 1415 r.hooks && (p = r.hooks.processAllTokens(p)), r.walkTokens && this.walkTokens(p, r.walkTokens); 1416 let u = c(p, r); 1417 return r.hooks && (u = r.hooks.postprocess(u)), u 1418 } catch (p) { 1419 return o(p) 1420 } 1421 } 1422 } 1423 1424 onError(e, t) { 1425 return n => { 1426 if (n.message += ` 1427Please report this to https://github.com/markedjs/marked.`, e) { 1428 let s = "<p>An error occurred:</p><pre>" + R(n.message + "", !0) + "</pre>"; 1429 return t ? Promise.resolve(s) : s 1430 } 1431 if (t) return Promise.reject(n); 1432 throw n 1433 } 1434 } 1435 }; 1436 var M = new E; 1437 1438 function k(l, e) { 1439 return M.parse(l, e) 1440 } 1441 1442 k.options = k.setOptions = function (l) { 1443 return M.setOptions(l), k.defaults = M.defaults, N(k.defaults), k 1444 }; 1445 k.getDefaults = z; 1446 k.defaults = w;
1447 k.use = function (...l) { 1448 return M.use(...l), k.defaults = M.defaults, N(k.defaults), k 1449 }; 1450 k.walkTokens = function (l, e) { 1451 return M.walkTokens(l, e) 1452 }; 1453 k.parseInline = M.parseInline; 1454 k.Parser = b; 1455 k.parser = b.parse; 1456 k.Renderer = $; 1457 k.TextRenderer = _; 1458 k.Lexer = x; 1459 k.lexer = x.lex; 1460 k.Tokenizer = S; 1461 k.Hooks = L; 1462 k.parse = k; 1463 var it = k.options, ot = k.setOptions, lt = k.use, at = k.walkTokens, ct = k.parseInline, pt = k, ut = b.parse, 1464 ht = x.lex; 1465 1466 if (__exports != exports) module.exports = exports; 1467 return module.exports 1468}));
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.