@onereach/ui-components 10.3.0 → 10.3.1-beta.4291.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (29) hide show
  1. package/dist/bundled/v2/components/OrRichTextEditorV3/OrRichTextEditor.js +1 -1
  2. package/dist/bundled/v2/components/OrRichTextEditorV3/utils/markdown.d.ts +2 -3
  3. package/dist/bundled/v2/components/OrRichTextEditorV3/utils/markdown.js +1 -1
  4. package/dist/bundled/v2/{markdown-fe3bfb01.js → markdown-4af315b8.js} +2825 -552
  5. package/dist/bundled/v3/components/OrRichTextEditorV3/OrRichTextEditor.js +1 -1
  6. package/dist/bundled/v3/components/OrRichTextEditorV3/index.js +1 -1
  7. package/dist/bundled/v3/components/OrRichTextEditorV3/props.js +1 -1
  8. package/dist/bundled/v3/components/OrRichTextEditorV3/styles.js +1 -1
  9. package/dist/bundled/v3/components/OrRichTextEditorV3/utils/codemirror/codemirrorNode.js +1 -1
  10. package/dist/bundled/v3/components/OrRichTextEditorV3/utils/codemirror/codemirrorView.js +1 -1
  11. package/dist/bundled/v3/components/OrRichTextEditorV3/utils/codemirror/index.js +1 -1
  12. package/dist/bundled/v3/components/OrRichTextEditorV3/utils/codemirror/theme.js +1 -1
  13. package/dist/bundled/v3/components/OrRichTextEditorV3/utils/markdown.d.ts +2 -3
  14. package/dist/bundled/v3/components/OrRichTextEditorV3/utils/markdown.js +1 -1
  15. package/dist/bundled/v3/components/{OrRichTextEditorV3-358d7df2.js → OrRichTextEditorV3-82b6efa2.js} +2798 -525
  16. package/dist/bundled/v3/components/index.js +1 -1
  17. package/dist/bundled/v3/index.js +1 -1
  18. package/dist/esm/v2/{OrRichTextEditor-734b8b27.js → OrRichTextEditor-4af25de8.js} +12 -54
  19. package/dist/esm/v2/components/index.js +2 -1
  20. package/dist/esm/v2/components/or-rich-text-editor-v3/index.js +2 -1
  21. package/dist/esm/v2/components/or-rich-text-editor-v3/utils/markdown.d.ts +2 -3
  22. package/dist/esm/v2/index.js +2 -1
  23. package/dist/esm/v3/{OrRichTextEditor-b5684aab.js → OrRichTextEditor-117119ca.js} +12 -54
  24. package/dist/esm/v3/components/index.js +2 -1
  25. package/dist/esm/v3/components/or-rich-text-editor-v3/index.js +2 -1
  26. package/dist/esm/v3/components/or-rich-text-editor-v3/utils/markdown.d.ts +2 -3
  27. package/dist/esm/v3/index.js +2 -1
  28. package/package.json +3 -3
  29. package/src/components/or-rich-text-editor-v3/utils/markdown.ts +15 -72
@@ -8,7 +8,7 @@ var markdownIt_min = {
8
8
  set exports(v){ markdownIt_minExports = v; },
9
9
  };
10
10
 
11
- /*! markdown-it 13.0.1 https://github.com/markdown-it/markdown-it @license MIT */
11
+ /*! markdown-it 13.0.2 https://github.com/markdown-it/markdown-it @license MIT */
12
12
  (function (module, exports) {
13
13
  !function (e, r) {
14
14
  module.exports = r() ;
@@ -2257,16 +2257,16 @@ var markdownIt_min = {
2257
2257
  for (t = 0; t < g.length; t++) -1 !== (o = a.indexOf(g[t])) && (-1 === d || o < d) && (d = o);
2258
2258
  for (-1 !== (f = -1 === d ? a.lastIndexOf("@") : a.lastIndexOf("@", d)) && (p = a.slice(0, f), a = a.slice(f + 1), this.auth = p), d = -1, t = 0; t < m.length; t++) -1 !== (o = a.indexOf(m[t])) && (-1 === d || o < d) && (d = o);
2259
2259
  -1 === d && (d = a.length), ":" === a[d - 1] && d--;
2260
- var C = a.slice(0, d);
2261
- a = a.slice(d), this.parseHost(C), this.hostname = this.hostname || "";
2262
- var y = "[" === this.hostname[0] && "]" === this.hostname[this.hostname.length - 1];
2263
- if (!y) {
2260
+ var y = a.slice(0, d);
2261
+ a = a.slice(d), this.parseHost(y), this.hostname = this.hostname || "";
2262
+ var C = "[" === this.hostname[0] && "]" === this.hostname[this.hostname.length - 1];
2263
+ if (!C) {
2264
2264
  var A = this.hostname.split(/\./);
2265
2265
  for (t = 0, n = A.length; t < n; t++) {
2266
2266
  var x = A[t];
2267
2267
  if (x && !x.match(_)) {
2268
- for (var D = "", w = 0, E = x.length; w < E; w++) x.charCodeAt(w) > 127 ? D += "x" : D += x[w];
2269
- if (!D.match(_)) {
2268
+ for (var w = "", D = 0, E = x.length; D < E; D++) x.charCodeAt(D) > 127 ? w += "x" : w += x[D];
2269
+ if (!w.match(_)) {
2270
2270
  var q = A.slice(0, t),
2271
2271
  S = A.slice(t + 1),
2272
2272
  F = x.match(k);
@@ -2276,7 +2276,7 @@ var markdownIt_min = {
2276
2276
  }
2277
2277
  }
2278
2278
  }
2279
- this.hostname.length > 255 && (this.hostname = ""), y && (this.hostname = this.hostname.substr(1, this.hostname.length - 2));
2279
+ this.hostname.length > 255 && (this.hostname = ""), C && (this.hostname = this.hostname.substr(1, this.hostname.length - 2));
2280
2280
  }
2281
2281
  var L = a.indexOf("#");
2282
2282
  -1 !== L && (this.hash = a.substr(L), a = a.slice(0, L));
@@ -2286,7 +2286,7 @@ var markdownIt_min = {
2286
2286
  var r = p.exec(e);
2287
2287
  r && (":" !== (r = r[0]) && (this.port = r.substr(1)), e = e.substr(0, e.length - r.length)), e && (this.hostname = e);
2288
2288
  };
2289
- var C = {
2289
+ var y = {
2290
2290
  encode: o,
2291
2291
  decode: c,
2292
2292
  format: function (e) {
@@ -2299,17 +2299,17 @@ var markdownIt_min = {
2299
2299
  return t.parse(e, r), t;
2300
2300
  }
2301
2301
  },
2302
- y = /[\0-\uD7FF\uE000-\uFFFF]|[\uD800-\uDBFF][\uDC00-\uDFFF]|[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF]/,
2302
+ C = /[\0-\uD7FF\uE000-\uFFFF]|[\uD800-\uDBFF][\uDC00-\uDFFF]|[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF]/,
2303
2303
  A = /[\0-\x1F\x7F-\x9F]/,
2304
2304
  x = /[ \xA0\u1680\u2000-\u200A\u2028\u2029\u202F\u205F\u3000]/,
2305
- D = {
2306
- Any: y,
2305
+ w = {
2306
+ Any: C,
2307
2307
  Cc: A,
2308
2308
  Cf: /[\xAD\u0600-\u0605\u061C\u06DD\u070F\u08E2\u180E\u200B-\u200F\u202A-\u202E\u2060-\u2064\u2066-\u206F\uFEFF\uFFF9-\uFFFB]|\uD804[\uDCBD\uDCCD]|\uD82F[\uDCA0-\uDCA3]|\uD834[\uDD73-\uDD7A]|\uDB40[\uDC01\uDC20-\uDC7F]/,
2309
2309
  P: t,
2310
2310
  Z: x
2311
2311
  },
2312
- w = function (e, r, t) {
2312
+ D = function (e, r, t) {
2313
2313
  return t = {
2314
2314
  path: r,
2315
2315
  exports: {},
@@ -2337,7 +2337,7 @@ var markdownIt_min = {
2337
2337
  }
2338
2338
  var c = /\\([!"#$%&'()*+,\-.\/:;<=>?@[\\\]^_`{|}~])/g,
2339
2339
  l = new RegExp(c.source + "|" + /&([a-z#][a-z0-9]{1,31});/gi.source, "gi"),
2340
- u = /^#((?:x[a-f0-9]{1,8}|[0-9]{1,8}))/i;
2340
+ u = /^#((?:x[a-f0-9]{1,8}|[0-9]{1,8}))$/i;
2341
2341
  var p = /[&<>"]/,
2342
2342
  h = /[&<>"]/g,
2343
2343
  f = {
@@ -2350,9 +2350,8 @@ var markdownIt_min = {
2350
2350
  return f[e];
2351
2351
  }
2352
2352
  var m = /[.?*+^$[\]\\(){}|-]/g;
2353
- n.lib = {}, n.lib.mdurl = C, n.lib.ucmicro = D, n.assign = function (e) {
2354
- var r = Array.prototype.slice.call(arguments, 1);
2355
- return r.forEach(function (r) {
2353
+ n.lib = {}, n.lib.mdurl = y, n.lib.ucmicro = w, n.assign = function (e) {
2354
+ return Array.prototype.slice.call(arguments, 1).forEach(function (r) {
2356
2355
  if (r) {
2357
2356
  if ("object" != typeof r) throw new TypeError(r + "must be object");
2358
2357
  Object.keys(r).forEach(function (t) {
@@ -2369,7 +2368,7 @@ var markdownIt_min = {
2369
2368
  }, n.unescapeAll = function (e) {
2370
2369
  return e.indexOf("\\") < 0 && e.indexOf("&") < 0 ? e : e.replace(l, function (e, t, n) {
2371
2370
  return t || function (e, t) {
2372
- var n = 0;
2371
+ var n;
2373
2372
  return o(r, t) ? r[t] : 35 === t.charCodeAt(0) && u.test(t) && i(n = "x" === t[1].toLowerCase() ? parseInt(t.slice(2), 16) : parseInt(t.slice(1), 10)) ? a(n) : e;
2374
2373
  }(e, n);
2375
2374
  });
@@ -2447,8 +2446,8 @@ var markdownIt_min = {
2447
2446
  return e = e.trim().replace(/\s+/g, " "), "\u1e7e" === "\u1e9e".toLowerCase() && (e = e.replace(/\u1e9e/g, "\xdf")), e.toLowerCase().toUpperCase();
2448
2447
  };
2449
2448
  }),
2450
- E = w.unescapeAll,
2451
- q = w.unescapeAll,
2449
+ E = D.unescapeAll,
2450
+ q = D.unescapeAll,
2452
2451
  S = function (e, r, t) {
2453
2452
  var n,
2454
2453
  s,
@@ -2459,27 +2458,27 @@ var markdownIt_min = {
2459
2458
  lines: 0,
2460
2459
  str: ""
2461
2460
  };
2462
- if (60 === e.charCodeAt(r)) {
2463
- for (r++; r < t;) {
2464
- if (10 === (n = e.charCodeAt(r))) return i;
2461
+ if (60 === e.charCodeAt(o)) {
2462
+ for (o++; o < t;) {
2463
+ if (10 === (n = e.charCodeAt(o))) return i;
2465
2464
  if (60 === n) return i;
2466
- if (62 === n) return i.pos = r + 1, i.str = E(e.slice(o + 1, r)), i.ok = !0, i;
2467
- 92 === n && r + 1 < t ? r += 2 : r++;
2465
+ if (62 === n) return i.pos = o + 1, i.str = E(e.slice(r + 1, o)), i.ok = !0, i;
2466
+ 92 === n && o + 1 < t ? o += 2 : o++;
2468
2467
  }
2469
2468
  return i;
2470
2469
  }
2471
- for (s = 0; r < t && 32 !== (n = e.charCodeAt(r)) && !(n < 32 || 127 === n);) if (92 === n && r + 1 < t) {
2472
- if (32 === e.charCodeAt(r + 1)) break;
2473
- r += 2;
2470
+ for (s = 0; o < t && 32 !== (n = e.charCodeAt(o)) && !(n < 32 || 127 === n);) if (92 === n && o + 1 < t) {
2471
+ if (32 === e.charCodeAt(o + 1)) break;
2472
+ o += 2;
2474
2473
  } else {
2475
2474
  if (40 === n && ++s > 32) return i;
2476
2475
  if (41 === n) {
2477
2476
  if (0 === s) break;
2478
2477
  s--;
2479
2478
  }
2480
- r++;
2479
+ o++;
2481
2480
  }
2482
- return o === r || 0 !== s || (i.str = E(e.slice(o, r)), i.lines = 0, i.pos = r, i.ok = !0), i;
2481
+ return r === o || 0 !== s || (i.str = E(e.slice(r, o)), i.pos = o, i.ok = !0), i;
2483
2482
  },
2484
2483
  F = function (e, r, t) {
2485
2484
  var n,
@@ -2492,12 +2491,12 @@ var markdownIt_min = {
2492
2491
  lines: 0,
2493
2492
  str: ""
2494
2493
  };
2495
- if (r >= t) return a;
2496
- if (34 !== (s = e.charCodeAt(r)) && 39 !== s && 40 !== s) return a;
2497
- for (r++, 40 === s && (s = 41); r < t;) {
2498
- if ((n = e.charCodeAt(r)) === s) return a.pos = r + 1, a.lines = o, a.str = q(e.slice(i + 1, r)), a.ok = !0, a;
2494
+ if (i >= t) return a;
2495
+ if (34 !== (s = e.charCodeAt(i)) && 39 !== s && 40 !== s) return a;
2496
+ for (i++, 40 === s && (s = 41); i < t;) {
2497
+ if ((n = e.charCodeAt(i)) === s) return a.pos = i + 1, a.lines = o, a.str = q(e.slice(r + 1, i)), a.ok = !0, a;
2499
2498
  if (40 === n && 41 === s) return a;
2500
- 10 === n ? o++ : 92 === n && r + 1 < t && (r++, 10 === e.charCodeAt(r) && o++), r++;
2499
+ 10 === n ? o++ : 92 === n && i + 1 < t && (i++, 10 === e.charCodeAt(i) && o++), i++;
2501
2500
  }
2502
2501
  return a;
2503
2502
  },
@@ -2522,20 +2521,20 @@ var markdownIt_min = {
2522
2521
  parseLinkDestination: S,
2523
2522
  parseLinkTitle: F
2524
2523
  },
2525
- z = w.assign,
2526
- T = w.unescapeAll,
2527
- I = w.escapeHtml,
2528
- M = {};
2529
- function R() {
2530
- this.rules = z({}, M);
2531
- }
2532
- M.code_inline = function (e, r, t, n, s) {
2524
+ z = D.assign,
2525
+ T = D.unescapeAll,
2526
+ I = D.escapeHtml,
2527
+ R = {};
2528
+ function M() {
2529
+ this.rules = z({}, R);
2530
+ }
2531
+ R.code_inline = function (e, r, t, n, s) {
2533
2532
  var o = e[r];
2534
- return "<code" + s.renderAttrs(o) + ">" + I(e[r].content) + "</code>";
2535
- }, M.code_block = function (e, r, t, n, s) {
2533
+ return "<code" + s.renderAttrs(o) + ">" + I(o.content) + "</code>";
2534
+ }, R.code_block = function (e, r, t, n, s) {
2536
2535
  var o = e[r];
2537
2536
  return "<pre" + s.renderAttrs(o) + "><code>" + I(e[r].content) + "</code></pre>\n";
2538
- }, M.fence = function (e, r, t, n, s) {
2537
+ }, R.fence = function (e, r, t, n, s) {
2539
2538
  var o,
2540
2539
  i,
2541
2540
  a,
@@ -2548,46 +2547,46 @@ var markdownIt_min = {
2548
2547
  return p && (h = (a = p.split(/(\s+)/g))[0], f = a.slice(2).join("")), 0 === (o = t.highlight && t.highlight(u.content, h, f) || I(u.content)).indexOf("<pre") ? o + "\n" : p ? (i = u.attrIndex("class"), c = u.attrs ? u.attrs.slice() : [], i < 0 ? c.push(["class", t.langPrefix + h]) : (c[i] = c[i].slice(), c[i][1] += " " + t.langPrefix + h), l = {
2549
2548
  attrs: c
2550
2549
  }, "<pre><code" + s.renderAttrs(l) + ">" + o + "</code></pre>\n") : "<pre><code" + s.renderAttrs(u) + ">" + o + "</code></pre>\n";
2551
- }, M.image = function (e, r, t, n, s) {
2550
+ }, R.image = function (e, r, t, n, s) {
2552
2551
  var o = e[r];
2553
2552
  return o.attrs[o.attrIndex("alt")][1] = s.renderInlineAsText(o.children, t, n), s.renderToken(e, r, t);
2554
- }, M.hardbreak = function (e, r, t) {
2553
+ }, R.hardbreak = function (e, r, t) {
2555
2554
  return t.xhtmlOut ? "<br />\n" : "<br>\n";
2556
- }, M.softbreak = function (e, r, t) {
2555
+ }, R.softbreak = function (e, r, t) {
2557
2556
  return t.breaks ? t.xhtmlOut ? "<br />\n" : "<br>\n" : "\n";
2558
- }, M.text = function (e, r) {
2557
+ }, R.text = function (e, r) {
2559
2558
  return I(e[r].content);
2560
- }, M.html_block = function (e, r) {
2559
+ }, R.html_block = function (e, r) {
2561
2560
  return e[r].content;
2562
- }, M.html_inline = function (e, r) {
2561
+ }, R.html_inline = function (e, r) {
2563
2562
  return e[r].content;
2564
- }, R.prototype.renderAttrs = function (e) {
2563
+ }, M.prototype.renderAttrs = function (e) {
2565
2564
  var r, t, n;
2566
2565
  if (!e.attrs) return "";
2567
2566
  for (n = "", r = 0, t = e.attrs.length; r < t; r++) n += " " + I(e.attrs[r][0]) + '="' + I(e.attrs[r][1]) + '"';
2568
2567
  return n;
2569
- }, R.prototype.renderToken = function (e, r, t) {
2568
+ }, M.prototype.renderToken = function (e, r, t) {
2570
2569
  var n,
2571
2570
  s = "",
2572
2571
  o = !1,
2573
2572
  i = e[r];
2574
2573
  return i.hidden ? "" : (i.block && -1 !== i.nesting && r && e[r - 1].hidden && (s += "\n"), s += (-1 === i.nesting ? "</" : "<") + i.tag, s += this.renderAttrs(i), 0 === i.nesting && t.xhtmlOut && (s += " /"), i.block && (o = !0, 1 === i.nesting && r + 1 < e.length && ("inline" === (n = e[r + 1]).type || n.hidden || -1 === n.nesting && n.tag === i.tag) && (o = !1)), s += o ? ">\n" : ">");
2575
- }, R.prototype.renderInline = function (e, r, t) {
2574
+ }, M.prototype.renderInline = function (e, r, t) {
2576
2575
  for (var n, s = "", o = this.rules, i = 0, a = e.length; i < a; i++) void 0 !== o[n = e[i].type] ? s += o[n](e, i, r, t, this) : s += this.renderToken(e, i, r);
2577
2576
  return s;
2578
- }, R.prototype.renderInlineAsText = function (e, r, t) {
2577
+ }, M.prototype.renderInlineAsText = function (e, r, t) {
2579
2578
  for (var n = "", s = 0, o = e.length; s < o; s++) "text" === e[s].type ? n += e[s].content : "image" === e[s].type ? n += this.renderInlineAsText(e[s].children, r, t) : "softbreak" === e[s].type && (n += "\n");
2580
2579
  return n;
2581
- }, R.prototype.render = function (e, r, t) {
2580
+ }, M.prototype.render = function (e, r, t) {
2582
2581
  var n,
2583
2582
  s,
2584
2583
  o,
2585
2584
  i = "",
2586
2585
  a = this.rules;
2587
- for (n = 0, s = e.length; n < s; n++) "inline" === (o = e[n].type) ? i += this.renderInline(e[n].children, r, t) : void 0 !== a[o] ? i += a[e[n].type](e, n, r, t, this) : i += this.renderToken(e, n, r, t);
2586
+ for (n = 0, s = e.length; n < s; n++) "inline" === (o = e[n].type) ? i += this.renderInline(e[n].children, r, t) : void 0 !== a[o] ? i += a[o](e, n, r, t, this) : i += this.renderToken(e, n, r, t);
2588
2587
  return i;
2589
2588
  };
2590
- var B = R;
2589
+ var B = M;
2591
2590
  function N() {
2592
2591
  this.__rules__ = [], this.__cache__ = null;
2593
2592
  }
@@ -2671,7 +2670,7 @@ var markdownIt_min = {
2671
2670
  var O = N,
2672
2671
  P = /\r\n?|\n/g,
2673
2672
  j = /\0/g,
2674
- U = w.arrayReplaceAt;
2673
+ U = D.arrayReplaceAt;
2675
2674
  function V(e) {
2676
2675
  return /^<\/a\s*>/i.test(e);
2677
2676
  }
@@ -2698,16 +2697,16 @@ var markdownIt_min = {
2698
2697
  n = 0;
2699
2698
  for (r = e.length - 1; r >= 0; r--) "text" !== (t = e[r]).type || n || Z.test(t.content) && (t.content = t.content.replace(/\+-/g, "\xb1").replace(/\.{2,}/g, "\u2026").replace(/([?!])\u2026/g, "$1..").replace(/([?!]){4,}/g, "$1$1$1").replace(/,{2,}/g, ",").replace(/(^|[^-])---(?=[^-]|$)/gm, "$1\u2014").replace(/(^|\s)--(?=\s|$)/gm, "$1\u2013").replace(/(^|[^-\s])--(?=[^-\s]|$)/gm, "$1\u2013")), "link_open" === t.type && "auto" === t.info && n--, "link_close" === t.type && "auto" === t.info && n++;
2700
2699
  }
2701
- var K = w.isWhiteSpace,
2702
- Q = w.isPunctChar,
2703
- X = w.isMdAsciiPunct,
2700
+ var K = D.isWhiteSpace,
2701
+ Q = D.isPunctChar,
2702
+ X = D.isMdAsciiPunct,
2704
2703
  ee = /['"]/,
2705
2704
  re = /['"]/g;
2706
2705
  function te(e, r, t) {
2707
2706
  return e.slice(0, r) + t + e.slice(r + 1);
2708
2707
  }
2709
2708
  function ne(e, r) {
2710
- var t, n, s, o, i, a, c, l, u, p, h, f, d, m, g, _, k, b, v, C, y;
2709
+ var t, n, s, o, i, a, c, l, u, p, h, f, d, m, g, _, k, b, v, y, C;
2711
2710
  for (v = [], t = 0; t < e.length; t++) {
2712
2711
  for (n = e[t], c = e[t].level, k = v.length - 1; k >= 0 && !(v[k].level <= c); k--);
2713
2712
  if (v.length = k + 1, "text" === n.type) {
@@ -2723,7 +2722,7 @@ var markdownIt_min = {
2723
2722
  }
2724
2723
  if (h = X(u) || Q(String.fromCharCode(u)), f = X(p) || Q(String.fromCharCode(p)), d = K(u), (m = K(p)) ? g = !1 : f && (d || h || (g = !1)), d ? _ = !1 : h && (m || f || (_ = !1)), 34 === p && '"' === o[0] && u >= 48 && u <= 57 && (_ = g = !1), g && _ && (g = h, _ = f), g || _) {
2725
2724
  if (_) for (k = v.length - 1; k >= 0 && (l = v[k], !(v[k].level < c)); k--) if (l.single === b && v[k].level === c) {
2726
- l = v[k], b ? (C = r.md.options.quotes[2], y = r.md.options.quotes[3]) : (C = r.md.options.quotes[0], y = r.md.options.quotes[1]), n.content = te(n.content, o.index, y), e[l.token].content = te(e[l.token].content, l.pos, C), i += y.length - 1, l.token === t && (i += C.length - 1), a = (s = n.content).length, v.length = k;
2725
+ l = v[k], b ? (y = r.md.options.quotes[2], C = r.md.options.quotes[3]) : (y = r.md.options.quotes[0], C = r.md.options.quotes[1]), n.content = te(n.content, o.index, C), e[l.token].content = te(e[l.token].content, l.pos, y), i += C.length - 1, l.token === t && (i += y.length - 1), a = (s = n.content).length, v.length = k;
2727
2726
  continue e;
2728
2727
  }
2729
2728
  g ? v.push({
@@ -2832,7 +2831,7 @@ var markdownIt_min = {
2832
2831
  for (r = 0, t = (n = this.ruler.getRules("")).length; r < t; r++) n[r](e);
2833
2832
  }, le.prototype.State = ae;
2834
2833
  var ue = le,
2835
- pe = w.isSpace;
2834
+ pe = D.isSpace;
2836
2835
  function he(e, r) {
2837
2836
  var t = e.bMarks[r] + e.tShift[r],
2838
2837
  n = e.eMarks[r];
@@ -2849,9 +2848,9 @@ var markdownIt_min = {
2849
2848
  for (r = e.charCodeAt(n); n < s;) 124 === r && (o ? (a += e.substring(i, n - 1), i = n) : (t.push(a + e.substring(i, n)), a = "", i = n + 1)), o = 92 === r, n++, r = e.charCodeAt(n);
2850
2849
  return t.push(a + e.substring(i)), t;
2851
2850
  }
2852
- var de = w.isSpace,
2853
- me = w.isSpace,
2854
- ge = w.isSpace;
2851
+ var de = D.isSpace,
2852
+ me = D.isSpace,
2853
+ ge = D.isSpace;
2855
2854
  function _e(e, r) {
2856
2855
  var t, n, s, o;
2857
2856
  return n = e.bMarks[r] + e.tShift[r], s = e.eMarks[r], 42 !== (t = e.src.charCodeAt(n++)) && 45 !== t && 43 !== t || n < s && (o = e.src.charCodeAt(n), !ge(o)) ? -1 : n;
@@ -2873,18 +2872,18 @@ var markdownIt_min = {
2873
2872
  }
2874
2873
  return s < o && (t = e.src.charCodeAt(s), !ge(t)) ? -1 : s;
2875
2874
  }
2876
- var be = w.normalizeReference,
2877
- ve = w.isSpace,
2878
- Ce = "<[A-Za-z][A-Za-z0-9\\-]*(?:\\s+[a-zA-Z_:][a-zA-Z0-9:._-]*(?:\\s*=\\s*(?:[^\"'=<>`\\x00-\\x20]+|'[^']*'|\"[^\"]*\"))?)*\\s*\\/?>",
2879
- ye = "<\\/[A-Za-z][A-Za-z0-9\\-]*\\s*>",
2875
+ var be = D.normalizeReference,
2876
+ ve = D.isSpace,
2877
+ ye = "<[A-Za-z][A-Za-z0-9\\-]*(?:\\s+[a-zA-Z_:][a-zA-Z0-9:._-]*(?:\\s*=\\s*(?:[^\"'=<>`\\x00-\\x20]+|'[^']*'|\"[^\"]*\"))?)*\\s*\\/?>",
2878
+ Ce = "<\\/[A-Za-z][A-Za-z0-9\\-]*\\s*>",
2880
2879
  Ae = {
2881
- HTML_TAG_RE: new RegExp("^(?:" + Ce + "|" + ye + "|\x3c!----\x3e|\x3c!--(?:-?[^>-])(?:-?[^-])*--\x3e|<[?][\\s\\S]*?[?]>|<![A-Z]+\\s+[^>]*>|<!\\[CDATA\\[[\\s\\S]*?\\]\\]>)"),
2882
- HTML_OPEN_CLOSE_TAG_RE: new RegExp("^(?:" + Ce + "|" + ye + ")")
2880
+ HTML_TAG_RE: new RegExp("^(?:" + ye + "|" + Ce + "|\x3c!----\x3e|\x3c!--(?:-?[^>-])(?:-?[^-])*--\x3e|<[?][\\s\\S]*?[?]>|<![A-Z]+\\s+[^>]*>|<!\\[CDATA\\[[\\s\\S]*?\\]\\]>)"),
2881
+ HTML_OPEN_CLOSE_TAG_RE: new RegExp("^(?:" + ye + "|" + Ce + ")")
2883
2882
  },
2884
2883
  xe = Ae.HTML_OPEN_CLOSE_TAG_RE,
2885
- De = [[/^<(script|pre|style|textarea)(?=(\s|>|$))/i, /<\/(script|pre|style|textarea)>/i, !0], [/^<!--/, /-->/, !0], [/^<\?/, /\?>/, !0], [/^<![A-Z]/, />/, !0], [/^<!\[CDATA\[/, /\]\]>/, !0], [new RegExp("^</?(" + ["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", "h1", "h2", "h3", "h4", "h5", "h6", "head", "header", "hr", "html", "iframe", "legend", "li", "link", "main", "menu", "menuitem", "nav", "noframes", "ol", "optgroup", "option", "p", "param", "section", "source", "summary", "table", "tbody", "td", "tfoot", "th", "thead", "title", "tr", "track", "ul"].join("|") + ")(?=(\\s|/?>|$))", "i"), /^$/, !0], [new RegExp(xe.source + "\\s*$"), /^$/, !1]],
2886
- we = w.isSpace,
2887
- Ee = w.isSpace;
2884
+ we = [[/^<(script|pre|style|textarea)(?=(\s|>|$))/i, /<\/(script|pre|style|textarea)>/i, !0], [/^<!--/, /-->/, !0], [/^<\?/, /\?>/, !0], [/^<![A-Z]/, />/, !0], [/^<!\[CDATA\[/, /\]\]>/, !0], [new RegExp("^</?(" + ["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", "h1", "h2", "h3", "h4", "h5", "h6", "head", "header", "hr", "html", "iframe", "legend", "li", "link", "main", "menu", "menuitem", "nav", "noframes", "ol", "optgroup", "option", "p", "param", "section", "source", "summary", "table", "tbody", "td", "tfoot", "th", "thead", "title", "tr", "track", "ul"].join("|") + ")(?=(\\s|/?>|$))", "i"), /^$/, !0], [new RegExp(xe.source + "\\s*$"), /^$/, !1]],
2885
+ De = D.isSpace,
2886
+ Ee = D.isSpace;
2888
2887
  function qe(e, r, t, n) {
2889
2888
  var s, o, i, a, c, l, u, p;
2890
2889
  for (this.src = e, this.md = r, this.env = t, this.tokens = n, this.bMarks = [], this.eMarks = [], this.tShift = [], this.sCount = [], this.bsCount = [], this.blkIndent = 0, this.line = 0, this.lineMax = 0, this.tight = !1, this.ddIndent = -1, this.listIndent = -1, this.parentType = "root", this.level = 0, this.result = "", p = !1, i = a = l = u = 0, c = (o = this.src).length; a < c; a++) {
@@ -2945,15 +2944,15 @@ var markdownIt_min = {
2945
2944
  }, qe.prototype.Token = oe;
2946
2945
  var Se = qe,
2947
2946
  Fe = [["table", function (e, r, t, n) {
2948
- var s, o, i, a, c, l, u, p, h, f, d, m, g, _, k, b, v, C;
2947
+ var s, o, i, a, c, l, u, p, h, f, d, m, g, _, k, b, v, y;
2949
2948
  if (r + 2 > t) return !1;
2950
2949
  if (l = r + 1, e.sCount[l] < e.blkIndent) return !1;
2951
2950
  if (e.sCount[l] - e.blkIndent >= 4) return !1;
2952
2951
  if ((i = e.bMarks[l] + e.tShift[l]) >= e.eMarks[l]) return !1;
2953
2952
  if (124 !== (v = e.src.charCodeAt(i++)) && 45 !== v && 58 !== v) return !1;
2954
2953
  if (i >= e.eMarks[l]) return !1;
2955
- if (124 !== (C = e.src.charCodeAt(i++)) && 45 !== C && 58 !== C && !pe(C)) return !1;
2956
- if (45 === v && pe(C)) return !1;
2954
+ if (124 !== (y = e.src.charCodeAt(i++)) && 45 !== y && 58 !== y && !pe(y)) return !1;
2955
+ if (45 === v && pe(y)) return !1;
2957
2956
  for (; i < e.eMarks[l];) {
2958
2957
  if (124 !== (s = e.src.charCodeAt(i)) && 45 !== s && 58 !== s && !pe(s)) return !1;
2959
2958
  i++;
@@ -3031,19 +3030,18 @@ var markdownIt_min = {
3031
3030
  k,
3032
3031
  b,
3033
3032
  v,
3034
- C,
3035
3033
  y,
3034
+ C,
3036
3035
  A,
3037
3036
  x = e.lineMax,
3038
- D = e.bMarks[r] + e.tShift[r],
3039
- w = e.eMarks[r];
3037
+ w = e.bMarks[r] + e.tShift[r],
3038
+ D = e.eMarks[r];
3040
3039
  if (e.sCount[r] - e.blkIndent >= 4) return !1;
3041
- if (62 !== e.src.charCodeAt(D++)) return !1;
3040
+ if (62 !== e.src.charCodeAt(w)) return !1;
3042
3041
  if (n) return !0;
3043
- for (a = h = e.sCount[r] + 1, 32 === e.src.charCodeAt(D) ? (D++, a++, h++, s = !1, b = !0) : 9 === e.src.charCodeAt(D) ? (b = !0, (e.bsCount[r] + h) % 4 == 3 ? (D++, a++, h++, s = !1) : s = !0) : b = !1, f = [e.bMarks[r]], e.bMarks[r] = D; D < w && (o = e.src.charCodeAt(D), de(o));) 9 === o ? h += 4 - (h + e.bsCount[r] + (s ? 1 : 0)) % 4 : h++, D++;
3044
- for (d = [e.bsCount[r]], e.bsCount[r] = e.sCount[r] + 1 + (b ? 1 : 0), l = D >= w, _ = [e.sCount[r]], e.sCount[r] = h - a, k = [e.tShift[r]], e.tShift[r] = D - e.bMarks[r], C = e.md.block.ruler.getRules("blockquote"), g = e.parentType, e.parentType = "blockquote", p = r + 1; p < t && (A = e.sCount[p] < e.blkIndent, !((D = e.bMarks[p] + e.tShift[p]) >= (w = e.eMarks[p]))); p++) if (62 !== e.src.charCodeAt(D++) || A) {
3042
+ for (f = [], d = [], _ = [], k = [], y = e.md.block.ruler.getRules("blockquote"), g = e.parentType, e.parentType = "blockquote", p = r; p < t && (A = e.sCount[p] < e.blkIndent, !((w = e.bMarks[p] + e.tShift[p]) >= (D = e.eMarks[p]))); p++) if (62 !== e.src.charCodeAt(w++) || A) {
3045
3043
  if (l) break;
3046
- for (v = !1, i = 0, c = C.length; i < c; i++) if (C[i](e, p, t, !0)) {
3044
+ for (v = !1, i = 0, c = y.length; i < c; i++) if (y[i](e, p, t, !0)) {
3047
3045
  v = !0;
3048
3046
  break;
3049
3047
  }
@@ -3053,10 +3051,10 @@ var markdownIt_min = {
3053
3051
  }
3054
3052
  f.push(e.bMarks[p]), d.push(e.bsCount[p]), k.push(e.tShift[p]), _.push(e.sCount[p]), e.sCount[p] = -1;
3055
3053
  } else {
3056
- for (a = h = e.sCount[p] + 1, 32 === e.src.charCodeAt(D) ? (D++, a++, h++, s = !1, b = !0) : 9 === e.src.charCodeAt(D) ? (b = !0, (e.bsCount[p] + h) % 4 == 3 ? (D++, a++, h++, s = !1) : s = !0) : b = !1, f.push(e.bMarks[p]), e.bMarks[p] = D; D < w && (o = e.src.charCodeAt(D), de(o));) 9 === o ? h += 4 - (h + e.bsCount[p] + (s ? 1 : 0)) % 4 : h++, D++;
3057
- l = D >= w, d.push(e.bsCount[p]), e.bsCount[p] = e.sCount[p] + 1 + (b ? 1 : 0), _.push(e.sCount[p]), e.sCount[p] = h - a, k.push(e.tShift[p]), e.tShift[p] = D - e.bMarks[p];
3054
+ for (a = e.sCount[p] + 1, 32 === e.src.charCodeAt(w) ? (w++, a++, s = !1, b = !0) : 9 === e.src.charCodeAt(w) ? (b = !0, (e.bsCount[p] + a) % 4 == 3 ? (w++, a++, s = !1) : s = !0) : b = !1, h = a, f.push(e.bMarks[p]), e.bMarks[p] = w; w < D && (o = e.src.charCodeAt(w), de(o));) 9 === o ? h += 4 - (h + e.bsCount[p] + (s ? 1 : 0)) % 4 : h++, w++;
3055
+ l = w >= D, d.push(e.bsCount[p]), e.bsCount[p] = e.sCount[p] + 1 + (b ? 1 : 0), _.push(e.sCount[p]), e.sCount[p] = h - a, k.push(e.tShift[p]), e.tShift[p] = w - e.bMarks[p];
3058
3056
  }
3059
- for (m = e.blkIndent, e.blkIndent = 0, (y = e.push("blockquote_open", "blockquote", 1)).markup = ">", y.map = u = [r, 0], e.md.block.tokenize(e, r, p), (y = e.push("blockquote_close", "blockquote", -1)).markup = ">", e.lineMax = x, e.parentType = g, u[1] = e.line, i = 0; i < k.length; i++) e.bMarks[i + r] = f[i], e.tShift[i + r] = k[i], e.sCount[i + r] = _[i], e.bsCount[i + r] = d[i];
3057
+ for (m = e.blkIndent, e.blkIndent = 0, (C = e.push("blockquote_open", "blockquote", 1)).markup = ">", C.map = u = [r, 0], e.md.block.tokenize(e, r, p), (C = e.push("blockquote_close", "blockquote", -1)).markup = ">", e.lineMax = x, e.parentType = g, u[1] = e.line, i = 0; i < k.length; i++) e.bMarks[i + r] = f[i], e.tShift[i + r] = k[i], e.sCount[i + r] = _[i], e.bsCount[i + r] = d[i];
3060
3058
  return e.blkIndent = m, !0;
3061
3059
  }, ["paragraph", "reference", "blockquote", "list"]], ["hr", function (e, r, t, n) {
3062
3060
  var s,
@@ -3090,52 +3088,52 @@ var markdownIt_min = {
3090
3088
  k,
3091
3089
  b,
3092
3090
  v,
3093
- C,
3094
3091
  y,
3092
+ C,
3095
3093
  A,
3096
3094
  x,
3097
- D,
3098
3095
  w,
3096
+ D,
3099
3097
  E,
3100
3098
  q,
3101
3099
  S,
3102
3100
  F,
3103
- L,
3101
+ L = r,
3104
3102
  z = !1,
3105
3103
  T = !0;
3106
- if (e.sCount[r] - e.blkIndent >= 4) return !1;
3107
- if (e.listIndent >= 0 && e.sCount[r] - e.listIndent >= 4 && e.sCount[r] < e.blkIndent) return !1;
3108
- if (n && "paragraph" === e.parentType && e.sCount[r] >= e.blkIndent && (z = !0), (w = ke(e, r)) >= 0) {
3109
- if (u = !0, q = e.bMarks[r] + e.tShift[r], g = Number(e.src.slice(q, w - 1)), z && 1 !== g) return !1;
3104
+ if (e.sCount[L] - e.blkIndent >= 4) return !1;
3105
+ if (e.listIndent >= 0 && e.sCount[L] - e.listIndent >= 4 && e.sCount[L] < e.blkIndent) return !1;
3106
+ if (n && "paragraph" === e.parentType && e.sCount[L] >= e.blkIndent && (z = !0), (w = ke(e, L)) >= 0) {
3107
+ if (u = !0, E = e.bMarks[L] + e.tShift[L], g = Number(e.src.slice(E, w - 1)), z && 1 !== g) return !1;
3110
3108
  } else {
3111
- if (!((w = _e(e, r)) >= 0)) return !1;
3109
+ if (!((w = _e(e, L)) >= 0)) return !1;
3112
3110
  u = !1;
3113
3111
  }
3114
- if (z && e.skipSpaces(w) >= e.eMarks[r]) return !1;
3115
- if (m = e.src.charCodeAt(w - 1), n) return !0;
3116
- for (d = e.tokens.length, u ? (L = e.push("ordered_list_open", "ol", 1), 1 !== g && (L.attrs = [["start", g]])) : L = e.push("bullet_list_open", "ul", 1), L.map = f = [r, 0], L.markup = String.fromCharCode(m), k = r, E = !1, F = e.md.block.ruler.getRules("list"), C = e.parentType, e.parentType = "list"; k < t;) {
3117
- for (D = w, _ = e.eMarks[k], l = b = e.sCount[k] + w - (e.bMarks[r] + e.tShift[r]); D < _;) {
3118
- if (9 === (s = e.src.charCodeAt(D))) b += 4 - (b + e.bsCount[k]) % 4;else {
3112
+ if (z && e.skipSpaces(w) >= e.eMarks[L]) return !1;
3113
+ if (n) return !0;
3114
+ for (m = e.src.charCodeAt(w - 1), d = e.tokens.length, u ? (F = e.push("ordered_list_open", "ol", 1), 1 !== g && (F.attrs = [["start", g]])) : F = e.push("bullet_list_open", "ul", 1), F.map = f = [L, 0], F.markup = String.fromCharCode(m), D = !1, S = e.md.block.ruler.getRules("list"), v = e.parentType, e.parentType = "list"; L < t;) {
3115
+ for (x = w, _ = e.eMarks[L], l = k = e.sCount[L] + w - (e.bMarks[L] + e.tShift[L]); x < _;) {
3116
+ if (9 === (s = e.src.charCodeAt(x))) k += 4 - (k + e.bsCount[L]) % 4;else {
3119
3117
  if (32 !== s) break;
3120
- b++;
3118
+ k++;
3121
3119
  }
3122
- D++;
3120
+ x++;
3123
3121
  }
3124
- if ((c = (o = D) >= _ ? 1 : b - l) > 4 && (c = 1), a = l + c, (L = e.push("list_item_open", "li", 1)).markup = String.fromCharCode(m), L.map = p = [r, 0], u && (L.info = e.src.slice(q, w - 1)), x = e.tight, A = e.tShift[r], y = e.sCount[r], v = e.listIndent, e.listIndent = e.blkIndent, e.blkIndent = a, e.tight = !0, e.tShift[r] = o - e.bMarks[r], e.sCount[r] = b, o >= _ && e.isEmpty(r + 1) ? e.line = Math.min(e.line + 2, t) : e.md.block.tokenize(e, r, t, !0), e.tight && !E || (T = !1), E = e.line - r > 1 && e.isEmpty(e.line - 1), e.blkIndent = e.listIndent, e.listIndent = v, e.tShift[r] = A, e.sCount[r] = y, e.tight = x, (L = e.push("list_item_close", "li", -1)).markup = String.fromCharCode(m), k = r = e.line, p[1] = k, o = e.bMarks[r], k >= t) break;
3125
- if (e.sCount[k] < e.blkIndent) break;
3126
- if (e.sCount[r] - e.blkIndent >= 4) break;
3127
- for (S = !1, i = 0, h = F.length; i < h; i++) if (F[i](e, k, t, !0)) {
3128
- S = !0;
3122
+ if ((c = (o = x) >= _ ? 1 : k - l) > 4 && (c = 1), a = l + c, (F = e.push("list_item_open", "li", 1)).markup = String.fromCharCode(m), F.map = p = [L, 0], u && (F.info = e.src.slice(E, w - 1)), A = e.tight, C = e.tShift[L], y = e.sCount[L], b = e.listIndent, e.listIndent = e.blkIndent, e.blkIndent = a, e.tight = !0, e.tShift[L] = o - e.bMarks[L], e.sCount[L] = k, o >= _ && e.isEmpty(L + 1) ? e.line = Math.min(e.line + 2, t) : e.md.block.tokenize(e, L, t, !0), e.tight && !D || (T = !1), D = e.line - L > 1 && e.isEmpty(e.line - 1), e.blkIndent = e.listIndent, e.listIndent = b, e.tShift[L] = C, e.sCount[L] = y, e.tight = A, (F = e.push("list_item_close", "li", -1)).markup = String.fromCharCode(m), L = e.line, p[1] = L, L >= t) break;
3123
+ if (e.sCount[L] < e.blkIndent) break;
3124
+ if (e.sCount[L] - e.blkIndent >= 4) break;
3125
+ for (q = !1, i = 0, h = S.length; i < h; i++) if (S[i](e, L, t, !0)) {
3126
+ q = !0;
3129
3127
  break;
3130
3128
  }
3131
- if (S) break;
3129
+ if (q) break;
3132
3130
  if (u) {
3133
- if ((w = ke(e, k)) < 0) break;
3134
- q = e.bMarks[k] + e.tShift[k];
3135
- } else if ((w = _e(e, k)) < 0) break;
3131
+ if ((w = ke(e, L)) < 0) break;
3132
+ E = e.bMarks[L] + e.tShift[L];
3133
+ } else if ((w = _e(e, L)) < 0) break;
3136
3134
  if (m !== e.src.charCodeAt(w - 1)) break;
3137
3135
  }
3138
- return (L = u ? e.push("ordered_list_close", "ol", -1) : e.push("bullet_list_close", "ul", -1)).markup = String.fromCharCode(m), f[1] = k, e.line = k, e.parentType = C, T && function (e, r) {
3136
+ return (F = u ? e.push("ordered_list_close", "ol", -1) : e.push("bullet_list_close", "ul", -1)).markup = String.fromCharCode(m), f[1] = L, e.line = L, e.parentType = v, T && function (e, r) {
3139
3137
  var t,
3140
3138
  n,
3141
3139
  s = e.level + 2;
@@ -3159,14 +3157,14 @@ var markdownIt_min = {
3159
3157
  k,
3160
3158
  b,
3161
3159
  v = 0,
3162
- C = e.bMarks[r] + e.tShift[r],
3163
- y = e.eMarks[r],
3160
+ y = e.bMarks[r] + e.tShift[r],
3161
+ C = e.eMarks[r],
3164
3162
  A = r + 1;
3165
3163
  if (e.sCount[r] - e.blkIndent >= 4) return !1;
3166
- if (91 !== e.src.charCodeAt(C)) return !1;
3167
- for (; ++C < y;) if (93 === e.src.charCodeAt(C) && 92 !== e.src.charCodeAt(C - 1)) {
3168
- if (C + 1 === y) return !1;
3169
- if (58 !== e.src.charCodeAt(C + 1)) return !1;
3164
+ if (91 !== e.src.charCodeAt(y)) return !1;
3165
+ for (; ++y < C;) if (93 === e.src.charCodeAt(y) && 92 !== e.src.charCodeAt(y - 1)) {
3166
+ if (y + 1 === C) return !1;
3167
+ if (58 !== e.src.charCodeAt(y + 1)) return !1;
3170
3168
  break;
3171
3169
  }
3172
3170
  for (a = e.lineMax, k = e.md.block.ruler.getRules("reference"), f = e.parentType, e.parentType = "reference"; A < a && !e.isEmpty(A); A++) if (!(e.sCount[A] - e.blkIndent > 3 || e.sCount[A] < 0)) {
@@ -3176,22 +3174,22 @@ var markdownIt_min = {
3176
3174
  }
3177
3175
  if (_) break;
3178
3176
  }
3179
- for (y = (g = e.getLines(r, A, e.blkIndent, !1).trim()).length, C = 1; C < y; C++) {
3180
- if (91 === (s = g.charCodeAt(C))) return !1;
3177
+ for (C = (g = e.getLines(r, A, e.blkIndent, !1).trim()).length, y = 1; y < C; y++) {
3178
+ if (91 === (s = g.charCodeAt(y))) return !1;
3181
3179
  if (93 === s) {
3182
- h = C;
3180
+ h = y;
3183
3181
  break;
3184
3182
  }
3185
- (10 === s || 92 === s && ++C < y && 10 === g.charCodeAt(C)) && v++;
3183
+ (10 === s || 92 === s && ++y < C && 10 === g.charCodeAt(y)) && v++;
3186
3184
  }
3187
3185
  if (h < 0 || 58 !== g.charCodeAt(h + 1)) return !1;
3188
- for (C = h + 2; C < y; C++) if (10 === (s = g.charCodeAt(C))) v++;else if (!ve(s)) break;
3189
- if (!(d = e.md.helpers.parseLinkDestination(g, C, y)).ok) return !1;
3186
+ for (y = h + 2; y < C; y++) if (10 === (s = g.charCodeAt(y))) v++;else if (!ve(s)) break;
3187
+ if (!(d = e.md.helpers.parseLinkDestination(g, y, C)).ok) return !1;
3190
3188
  if (c = e.md.normalizeLink(d.str), !e.md.validateLink(c)) return !1;
3191
- for (o = C = d.pos, i = v += d.lines, m = C; C < y; C++) if (10 === (s = g.charCodeAt(C))) v++;else if (!ve(s)) break;
3192
- for (d = e.md.helpers.parseLinkTitle(g, C, y), C < y && m !== C && d.ok ? (b = d.str, C = d.pos, v += d.lines) : (b = "", C = o, v = i); C < y && (s = g.charCodeAt(C), ve(s));) C++;
3193
- if (C < y && 10 !== g.charCodeAt(C) && b) for (b = "", C = o, v = i; C < y && (s = g.charCodeAt(C), ve(s));) C++;
3194
- return !(C < y && 10 !== g.charCodeAt(C)) && !!(p = be(g.slice(1, h))) && (n || (void 0 === e.env.references && (e.env.references = {}), void 0 === e.env.references[p] && (e.env.references[p] = {
3189
+ for (o = y = d.pos, i = v += d.lines, m = y; y < C; y++) if (10 === (s = g.charCodeAt(y))) v++;else if (!ve(s)) break;
3190
+ for (d = e.md.helpers.parseLinkTitle(g, y, C), y < C && m !== y && d.ok ? (b = d.str, y = d.pos, v += d.lines) : (b = "", y = o, v = i); y < C && (s = g.charCodeAt(y), ve(s));) y++;
3191
+ if (y < C && 10 !== g.charCodeAt(y) && b) for (b = "", y = o, v = i; y < C && (s = g.charCodeAt(y), ve(s));) y++;
3192
+ return !(y < C && 10 !== g.charCodeAt(y)) && !!(p = be(g.slice(1, h))) && (n || (void 0 === e.env.references && (e.env.references = {}), void 0 === e.env.references[p] && (e.env.references[p] = {
3195
3193
  title: b,
3196
3194
  href: c
3197
3195
  }), e.parentType = f, e.line = r + v + 1), !0);
@@ -3205,10 +3203,10 @@ var markdownIt_min = {
3205
3203
  if (e.sCount[r] - e.blkIndent >= 4) return !1;
3206
3204
  if (!e.md.options.html) return !1;
3207
3205
  if (60 !== e.src.charCodeAt(c)) return !1;
3208
- for (a = e.src.slice(c, l), s = 0; s < De.length && !De[s][0].test(a); s++);
3209
- if (s === De.length) return !1;
3210
- if (n) return De[s][2];
3211
- if (o = r + 1, !De[s][1].test(a)) for (; o < t && !(e.sCount[o] < e.blkIndent); o++) if (c = e.bMarks[o] + e.tShift[o], l = e.eMarks[o], a = e.src.slice(c, l), De[s][1].test(a)) {
3206
+ for (a = e.src.slice(c, l), s = 0; s < we.length && !we[s][0].test(a); s++);
3207
+ if (s === we.length) return !1;
3208
+ if (n) return we[s][2];
3209
+ if (o = r + 1, !we[s][1].test(a)) for (; o < t && !(e.sCount[o] < e.blkIndent); o++) if (c = e.bMarks[o] + e.tShift[o], l = e.eMarks[o], a = e.src.slice(c, l), we[s][1].test(a)) {
3212
3210
  0 !== a.length && o++;
3213
3211
  break;
3214
3212
  }
@@ -3223,7 +3221,7 @@ var markdownIt_min = {
3223
3221
  if (e.sCount[r] - e.blkIndent >= 4) return !1;
3224
3222
  if (35 !== (s = e.src.charCodeAt(c)) || c >= l) return !1;
3225
3223
  for (o = 1, s = e.src.charCodeAt(++c); 35 === s && c < l && o <= 6;) o++, s = e.src.charCodeAt(++c);
3226
- return !(o > 6 || c < l && !we(s)) && (n || (l = e.skipSpacesBack(l, c), (i = e.skipCharsBack(l, 35, c)) > c && we(e.src.charCodeAt(i - 1)) && (l = i), e.line = r + 1, (a = e.push("heading_open", "h" + String(o), 1)).markup = "########".slice(0, o), a.map = [r, e.line], (a = e.push("inline", "", 0)).content = e.src.slice(c, l).trim(), a.map = [r, e.line], a.children = [], (a = e.push("heading_close", "h" + String(o), -1)).markup = "########".slice(0, o)), !0);
3224
+ return !(o > 6 || c < l && !De(s)) && (n || (l = e.skipSpacesBack(l, c), (i = e.skipCharsBack(l, 35, c)) > c && De(e.src.charCodeAt(i - 1)) && (l = i), e.line = r + 1, (a = e.push("heading_open", "h" + String(o), 1)).markup = "########".slice(0, o), a.map = [r, e.line], (a = e.push("inline", "", 0)).content = e.src.slice(c, l).trim(), a.map = [r, e.line], a.children = [], (a = e.push("heading_close", "h" + String(o), -1)).markup = "########".slice(0, o)), !0);
3227
3225
  }, ["paragraph", "reference", "blockquote"]], ["lheading", function (e, r, t) {
3228
3226
  var n,
3229
3227
  s,
@@ -3252,24 +3250,23 @@ var markdownIt_min = {
3252
3250
  }
3253
3251
  }
3254
3252
  return !!u && (n = e.getLines(r, f, e.blkIndent, !1).trim(), e.line = f + 1, (a = e.push("heading_open", "h" + String(u), 1)).markup = String.fromCharCode(p), a.map = [r, e.line], (a = e.push("inline", "", 0)).content = n, a.map = [r, e.line - 1], a.children = [], (a = e.push("heading_close", "h" + String(u), -1)).markup = String.fromCharCode(p), e.parentType = h, !0);
3255
- }], ["paragraph", function (e, r) {
3256
- var t,
3257
- n,
3253
+ }], ["paragraph", function (e, r, t) {
3254
+ var n,
3258
3255
  s,
3259
3256
  o,
3260
3257
  i,
3261
3258
  a,
3262
- c = r + 1,
3263
- l = e.md.block.ruler.getRules("paragraph"),
3264
- u = e.lineMax;
3265
- for (a = e.parentType, e.parentType = "paragraph"; c < u && !e.isEmpty(c); c++) if (!(e.sCount[c] - e.blkIndent > 3 || e.sCount[c] < 0)) {
3266
- for (n = !1, s = 0, o = l.length; s < o; s++) if (l[s](e, c, u, !0)) {
3267
- n = !0;
3259
+ c,
3260
+ l = r + 1,
3261
+ u = e.md.block.ruler.getRules("paragraph");
3262
+ for (c = e.parentType, e.parentType = "paragraph"; l < t && !e.isEmpty(l); l++) if (!(e.sCount[l] - e.blkIndent > 3 || e.sCount[l] < 0)) {
3263
+ for (s = !1, o = 0, i = u.length; o < i; o++) if (u[o](e, l, t, !0)) {
3264
+ s = !0;
3268
3265
  break;
3269
3266
  }
3270
- if (n) break;
3267
+ if (s) break;
3271
3268
  }
3272
- return t = e.getLines(r, c, e.blkIndent, !1).trim(), e.line = c, (i = e.push("paragraph_open", "p", 1)).map = [r, e.line], (i = e.push("inline", "", 0)).content = t, i.map = [r, e.line], i.children = [], i = e.push("paragraph_close", "p", -1), e.parentType = a, !0;
3269
+ return n = e.getLines(r, l, e.blkIndent, !1).trim(), e.line = l, (a = e.push("paragraph_open", "p", 1)).map = [r, e.line], (a = e.push("inline", "", 0)).content = n, a.map = [r, e.line], a.children = [], a = e.push("paragraph_close", "p", -1), e.parentType = c, !0;
3273
3270
  }]];
3274
3271
  function Le() {
3275
3272
  this.ruler = new O();
@@ -3278,13 +3275,17 @@ var markdownIt_min = {
3278
3275
  });
3279
3276
  }
3280
3277
  Le.prototype.tokenize = function (e, r, t) {
3281
- for (var n, s = this.ruler.getRules(""), o = s.length, i = r, a = !1, c = e.md.options.maxNesting; i < t && (e.line = i = e.skipEmptyLines(i), !(i >= t)) && !(e.sCount[i] < e.blkIndent);) {
3282
- if (e.level >= c) {
3278
+ for (var n, s, o, i = this.ruler.getRules(""), a = i.length, c = r, l = !1, u = e.md.options.maxNesting; c < t && (e.line = c = e.skipEmptyLines(c), !(c >= t)) && !(e.sCount[c] < e.blkIndent);) {
3279
+ if (e.level >= u) {
3283
3280
  e.line = t;
3284
3281
  break;
3285
3282
  }
3286
- for (n = 0; n < o && !s[n](e, i, t, !1); n++);
3287
- e.tight = !a, e.isEmpty(e.line - 1) && (a = !0), (i = e.line) < t && e.isEmpty(i) && (a = !0, i++, e.line = i);
3283
+ for (o = e.line, s = 0; s < a; s++) if (n = i[s](e, c, t, !1)) {
3284
+ if (o >= e.line) throw new Error("block rule didn't increment state.line");
3285
+ break;
3286
+ }
3287
+ if (!n) throw new Error("none of the block rules matched");
3288
+ e.tight = !l, e.isEmpty(e.line - 1) && (l = !0), (c = e.line) < t && e.isEmpty(c) && (l = !0, c++, e.line = c);
3288
3289
  }
3289
3290
  }, Le.prototype.parse = function (e, r, t, n) {
3290
3291
  var s;
@@ -3321,7 +3322,7 @@ var markdownIt_min = {
3321
3322
  return !1;
3322
3323
  }
3323
3324
  }
3324
- for (var Ie = /(?:^|[^a-z0-9.+-])([a-z][a-z0-9.+-]*)$/i, Me = w.isSpace, Re = w.isSpace, Be = [], Ne = 0; Ne < 256; Ne++) Be.push(0);
3325
+ for (var Ie = /(?:^|[^a-z0-9.+-])([a-z][a-z0-9.+-]*)$/i, Re = D.isSpace, Me = D.isSpace, Be = [], Ne = 0; Ne < 256; Ne++) Be.push(0);
3325
3326
  "\\!\"#$%&'()*+,./:;<=>?@[]^_`{|}~-".split("").forEach(function (e) {
3326
3327
  Be[e.charCodeAt(0)] = 1;
3327
3328
  });
@@ -3396,45 +3397,45 @@ var markdownIt_min = {
3396
3397
  for (je(e, e.delimiters), r = 0; r < n; r++) t[r] && t[r].delimiters && je(e, t[r].delimiters);
3397
3398
  }
3398
3399
  },
3399
- Ve = w.normalizeReference,
3400
- Ze = w.isSpace,
3401
- $e = w.normalizeReference,
3402
- Ge = w.isSpace,
3400
+ Ve = D.normalizeReference,
3401
+ Ze = D.isSpace,
3402
+ $e = D.normalizeReference,
3403
+ Ge = D.isSpace,
3403
3404
  He = /^([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])?)*)$/,
3404
3405
  Je = /^([a-zA-Z][a-zA-Z0-9+.\-]{1,31}):([^<>\x00-\x20]*)$/,
3405
3406
  We = Ae.HTML_TAG_RE;
3406
- var Ye = w.has,
3407
- Ke = w.isValidEntityCode,
3408
- Qe = w.fromCodePoint,
3407
+ var Ye = D.has,
3408
+ Ke = D.isValidEntityCode,
3409
+ Qe = D.fromCodePoint,
3409
3410
  Xe = /^&#((?:x[a-f0-9]{1,6}|[0-9]{1,7}));/i,
3410
3411
  er = /^&([a-z][a-z0-9]{1,31});/i;
3411
- function rr(e, r) {
3412
- var t,
3412
+ function rr(e) {
3413
+ var r,
3414
+ t,
3413
3415
  n,
3414
3416
  s,
3415
3417
  o,
3416
3418
  i,
3417
3419
  a,
3418
3420
  c,
3419
- l,
3420
- u = {},
3421
- p = r.length;
3422
- if (p) {
3423
- var h = 0,
3424
- f = -2,
3425
- d = [];
3426
- for (t = 0; t < p; t++) if (s = r[t], d.push(0), r[h].marker === s.marker && f === s.token - 1 || (h = t), f = s.token, s.length = s.length || 0, s.close) {
3427
- for (u.hasOwnProperty(s.marker) || (u[s.marker] = [-1, -1, -1, -1, -1, -1]), i = u[s.marker][(s.open ? 3 : 0) + s.length % 3], a = n = h - d[h] - 1; n > i; n -= d[n] + 1) if ((o = r[n]).marker === s.marker && o.open && o.end < 0 && (c = !1, (o.close || s.open) && (o.length + s.length) % 3 == 0 && (o.length % 3 == 0 && s.length % 3 == 0 || (c = !0)), !c)) {
3428
- l = n > 0 && !r[n - 1].open ? d[n - 1] + 1 : 0, d[t] = t - n + l, d[n] = l, s.open = !1, o.end = t, o.close = !1, a = -1, f = -2;
3421
+ l = {},
3422
+ u = e.length;
3423
+ if (u) {
3424
+ var p = 0,
3425
+ h = -2,
3426
+ f = [];
3427
+ for (r = 0; r < u; r++) if (n = e[r], f.push(0), e[p].marker === n.marker && h === n.token - 1 || (p = r), h = n.token, n.length = n.length || 0, n.close) {
3428
+ for (l.hasOwnProperty(n.marker) || (l[n.marker] = [-1, -1, -1, -1, -1, -1]), o = l[n.marker][(n.open ? 3 : 0) + n.length % 3], i = t = p - f[p] - 1; t > o; t -= f[t] + 1) if ((s = e[t]).marker === n.marker && s.open && s.end < 0 && (a = !1, (s.close || n.open) && (s.length + n.length) % 3 == 0 && (s.length % 3 == 0 && n.length % 3 == 0 || (a = !0)), !a)) {
3429
+ c = t > 0 && !e[t - 1].open ? f[t - 1] + 1 : 0, f[r] = r - t + c, f[t] = c, n.open = !1, s.end = r, s.close = !1, i = -1, h = -2;
3429
3430
  break;
3430
3431
  }
3431
- -1 !== a && (u[s.marker][(s.open ? 3 : 0) + (s.length || 0) % 3] = a);
3432
+ -1 !== i && (l[n.marker][(n.open ? 3 : 0) + (n.length || 0) % 3] = i);
3432
3433
  }
3433
3434
  }
3434
3435
  }
3435
- var tr = w.isWhiteSpace,
3436
- nr = w.isPunctChar,
3437
- sr = w.isMdAsciiPunct;
3436
+ var tr = D.isWhiteSpace,
3437
+ nr = D.isPunctChar,
3438
+ sr = D.isMdAsciiPunct;
3438
3439
  function or(e, r, t, n) {
3439
3440
  this.src = e, this.env = t, this.md = r, this.tokens = n, this.tokens_meta = Array(n.length), this.pos = 0, this.posMax = this.src.length, this.level = 0, this.pending = "", this.pendingLevel = 0, this.cache = {}, this.delimiters = [], this._prev_delimiters = [], this.backticks = {}, this.backticksScanned = !1, this.linkLevel = 0;
3440
3441
  }
@@ -3476,7 +3477,7 @@ var markdownIt_min = {
3476
3477
  return t !== e.pos && (r || (e.pending += e.src.slice(e.pos, t)), e.pos = t, !0);
3477
3478
  }], ["linkify", function (e, r) {
3478
3479
  var t, n, s, o, i, a, c;
3479
- return !!e.md.options.linkify && !(e.linkLevel > 0) && !((t = e.pos) + 3 > e.posMax) && 58 === e.src.charCodeAt(t) && 47 === e.src.charCodeAt(t + 1) && 47 === e.src.charCodeAt(t + 2) && !!(n = e.pending.match(Ie)) && (s = n[1], !!(o = e.md.linkify.matchAtStart(e.src.slice(t - s.length))) && (i = (i = o.url).replace(/\*+$/, ""), a = e.md.normalizeLink(i), !!e.md.validateLink(a) && (r || (e.pending = e.pending.slice(0, -s.length), (c = e.push("link_open", "a", 1)).attrs = [["href", a]], c.markup = "linkify", c.info = "auto", (c = e.push("text", "", 0)).content = e.md.normalizeLinkText(i), (c = e.push("link_close", "a", -1)).markup = "linkify", c.info = "auto"), e.pos += i.length - s.length, !0)));
3480
+ return !!e.md.options.linkify && !(e.linkLevel > 0) && !((t = e.pos) + 3 > e.posMax) && 58 === e.src.charCodeAt(t) && 47 === e.src.charCodeAt(t + 1) && 47 === e.src.charCodeAt(t + 2) && !!(n = e.pending.match(Ie)) && (s = n[1], !!(o = e.md.linkify.matchAtStart(e.src.slice(t - s.length))) && !((i = o.url).length <= s.length) && (i = i.replace(/\*+$/, ""), a = e.md.normalizeLink(i), !!e.md.validateLink(a) && (r || (e.pending = e.pending.slice(0, -s.length), (c = e.push("link_open", "a", 1)).attrs = [["href", a]], c.markup = "linkify", c.info = "auto", (c = e.push("text", "", 0)).content = e.md.normalizeLinkText(i), (c = e.push("link_close", "a", -1)).markup = "linkify", c.info = "auto"), e.pos += i.length - s.length, !0)));
3480
3481
  }], ["newline", function (e, r) {
3481
3482
  var t,
3482
3483
  n,
@@ -3489,7 +3490,7 @@ var markdownIt_min = {
3489
3490
  e.pending = e.pending.slice(0, s), e.push("hardbreak", "br", 0);
3490
3491
  } else e.pending = e.pending.slice(0, -1), e.push("softbreak", "br", 0);
3491
3492
  } else e.push("softbreak", "br", 0);
3492
- for (o++; o < n && Me(e.src.charCodeAt(o));) o++;
3493
+ for (o++; o < n && Re(e.src.charCodeAt(o));) o++;
3493
3494
  return e.pos = o, !0;
3494
3495
  }], ["escape", function (e, r) {
3495
3496
  var t,
@@ -3502,7 +3503,7 @@ var markdownIt_min = {
3502
3503
  if (92 !== e.src.charCodeAt(a)) return !1;
3503
3504
  if (++a >= c) return !1;
3504
3505
  if (10 === (t = e.src.charCodeAt(a))) {
3505
- for (r || e.push("hardbreak", "br", 0), a++; a < c && (t = e.src.charCodeAt(a), Re(t));) a++;
3506
+ for (r || e.push("hardbreak", "br", 0), a++; a < c && (t = e.src.charCodeAt(a), Me(t));) a++;
3506
3507
  return e.pos = a, !0;
3507
3508
  }
3508
3509
  return o = e.src[a], t >= 55296 && t <= 56319 && a + 1 < c && (n = e.src.charCodeAt(a + 1)) >= 56320 && n <= 57343 && (o += e.src[a + 1], a++), s = "\\" + o, r || (i = e.push("text_special", "", 0), t < 256 && 0 !== Be[t] ? i.content = o : i.content = s, i.markup = s, i.info = "escape"), e.pos = a + 1, !0;
@@ -3519,7 +3520,7 @@ var markdownIt_min = {
3519
3520
  if (96 !== e.src.charCodeAt(u)) return !1;
3520
3521
  for (t = u, u++, n = e.posMax; u < n && 96 === e.src.charCodeAt(u);) u++;
3521
3522
  if (c = (s = e.src.slice(t, u)).length, e.backticksScanned && (e.backticks[c] || 0) <= t) return r || (e.pending += s), e.pos += c, !0;
3522
- for (i = a = u; -1 !== (i = e.src.indexOf("`", a));) {
3523
+ for (a = u; -1 !== (i = e.src.indexOf("`", a));) {
3523
3524
  for (a = i + 1; a < n && 96 === e.src.charCodeAt(a);) a++;
3524
3525
  if ((l = a - i) === c) return r || ((o = e.push("code_inline", "code", 0)).markup = s, o.content = e.src.slice(u, i).replace(/\n/g, " ").replace(/^ (.+) $/, "$1")), e.pos = a, !0;
3525
3526
  e.backticks[l] = i;
@@ -3615,7 +3616,7 @@ var markdownIt_min = {
3615
3616
  return !!e.md.options.html && (s = e.posMax, !(60 !== e.src.charCodeAt(a) || a + 2 >= s) && !(33 !== (t = e.src.charCodeAt(a + 1)) && 63 !== t && 47 !== t && !function (e) {
3616
3617
  var r = 32 | e;
3617
3618
  return r >= 97 && r <= 122;
3618
- }(t)) && !!(n = e.src.slice(a).match(We)) && (r || ((o = e.push("html_inline", "", 0)).content = e.src.slice(a, a + n[0].length), i = o.content, /^<a[>\s]/i.test(i) && e.linkLevel++, function (e) {
3619
+ }(t)) && !!(n = e.src.slice(a).match(We)) && (r || ((o = e.push("html_inline", "", 0)).content = n[0], i = o.content, /^<a[>\s]/i.test(i) && e.linkLevel++, function (e) {
3619
3620
  return /^<\/a\s*>/i.test(e);
3620
3621
  }(o.content) && e.linkLevel--), e.pos += n[0].length, !0));
3621
3622
  }], ["entity", function (e, t) {
@@ -3635,7 +3636,7 @@ var markdownIt_min = {
3635
3636
  var r,
3636
3637
  t = e.tokens_meta,
3637
3638
  n = e.tokens_meta.length;
3638
- for (rr(0, e.delimiters), r = 0; r < n; r++) t[r] && t[r].delimiters && rr(0, t[r].delimiters);
3639
+ for (rr(e.delimiters), r = 0; r < n; r++) t[r] && t[r].delimiters && rr(t[r].delimiters);
3639
3640
  }], ["strikethrough", Pe.postProcess], ["emphasis", Ue.postProcess], ["fragments_join", function (e) {
3640
3641
  var r,
3641
3642
  t,
@@ -3659,14 +3660,22 @@ var markdownIt_min = {
3659
3660
  i = e.md.options.maxNesting,
3660
3661
  a = e.cache;
3661
3662
  if (void 0 === a[n]) {
3662
- if (e.level < i) for (t = 0; t < o && (e.level++, r = s[t](e, !0), e.level--, !r); t++);else e.pos = e.posMax;
3663
+ if (e.level < i) {
3664
+ for (t = 0; t < o; t++) if (e.level++, r = s[t](e, !0), e.level--, r) {
3665
+ if (n >= e.pos) throw new Error("inline rule didn't increment state.pos");
3666
+ break;
3667
+ }
3668
+ } else e.pos = e.posMax;
3663
3669
  r || e.pos++, a[n] = e.pos;
3664
3670
  } else e.pos = a[n];
3665
3671
  }, lr.prototype.tokenize = function (e) {
3666
- for (var r, t, n = this.ruler.getRules(""), s = n.length, o = e.posMax, i = e.md.options.maxNesting; e.pos < o;) {
3667
- if (e.level < i) for (t = 0; t < s && !(r = n[t](e, !1)); t++);
3672
+ for (var r, t, n, s = this.ruler.getRules(""), o = s.length, i = e.posMax, a = e.md.options.maxNesting; e.pos < i;) {
3673
+ if (n = e.pos, e.level < a) for (t = 0; t < o; t++) if (r = s[t](e, !1)) {
3674
+ if (n >= e.pos) throw new Error("inline rule didn't increment state.pos");
3675
+ break;
3676
+ }
3668
3677
  if (r) {
3669
- if (e.pos >= o) break;
3678
+ if (e.pos >= i) break;
3670
3679
  } else e.pending += e.src[e.pos++];
3671
3680
  }
3672
3681
  e.pending && e.pushPending();
@@ -3677,30 +3686,35 @@ var markdownIt_min = {
3677
3686
  a = new this.State(e, r, t, n);
3678
3687
  for (this.tokenize(a), i = (o = this.ruler2.getRules("")).length, s = 0; s < i; s++) o[s](a);
3679
3688
  }, lr.prototype.State = ir;
3680
- var ur = lr;
3681
- function pr(e) {
3682
- var r = Array.prototype.slice.call(arguments, 1);
3683
- return r.forEach(function (r) {
3689
+ var ur = lr,
3690
+ pr = function (e) {
3691
+ var r = {};
3692
+ e = e || {}, r.src_Any = C.source, r.src_Cc = A.source, r.src_Z = x.source, r.src_P = t.source, r.src_ZPCc = [r.src_Z, r.src_P, r.src_Cc].join("|"), r.src_ZCc = [r.src_Z, r.src_Cc].join("|");
3693
+ var n = "[><\uff5c]";
3694
+ return r.src_pseudo_letter = "(?:(?![><\uff5c]|" + r.src_ZPCc + ")" + r.src_Any + ")", r.src_ip4 = "(?:(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\\.){3}(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)", r.src_auth = "(?:(?:(?!" + r.src_ZCc + "|[@/\\[\\]()]).)+@)?", r.src_port = "(?::(?:6(?:[0-4]\\d{3}|5(?:[0-4]\\d{2}|5(?:[0-2]\\d|3[0-5])))|[1-5]?\\d{1,4}))?", r.src_host_terminator = "(?=$|[><\uff5c]|" + r.src_ZPCc + ")(?!" + (e["---"] ? "-(?!--)|" : "-|") + "_|:\\d|\\.-|\\.(?!$|" + r.src_ZPCc + "))", r.src_path = "(?:[/?#](?:(?!" + r.src_ZCc + "|" + n + "|[()[\\]{}.,\"'?!\\-;]).|\\[(?:(?!" + r.src_ZCc + "|\\]).)*\\]|\\((?:(?!" + r.src_ZCc + "|[)]).)*\\)|\\{(?:(?!" + r.src_ZCc + '|[}]).)*\\}|\\"(?:(?!' + r.src_ZCc + '|["]).)+\\"|\\\'(?:(?!' + r.src_ZCc + "|[']).)+\\'|\\'(?=" + r.src_pseudo_letter + "|[-])|\\.{2,}[a-zA-Z0-9%/&]|\\.(?!" + r.src_ZCc + "|[.]|$)|" + (e["---"] ? "\\-(?!--(?:[^-]|$))(?:-*)|" : "\\-+|") + ",(?!" + r.src_ZCc + "|$)|;(?!" + r.src_ZCc + "|$)|\\!+(?!" + r.src_ZCc + "|[!]|$)|\\?(?!" + r.src_ZCc + "|[?]|$))+|\\/)?", r.src_email_name = '[\\-;:&=\\+\\$,\\.a-zA-Z0-9_][\\-;:&=\\+\\$,\\"\\.a-zA-Z0-9_]*', r.src_xn = "xn--[a-z0-9\\-]{1,59}", r.src_domain_root = "(?:" + r.src_xn + "|" + r.src_pseudo_letter + "{1,63})", r.src_domain = "(?:" + r.src_xn + "|(?:" + r.src_pseudo_letter + ")|(?:" + r.src_pseudo_letter + "(?:-|" + r.src_pseudo_letter + "){0,61}" + r.src_pseudo_letter + "))", r.src_host = "(?:(?:(?:(?:" + r.src_domain + ")\\.)*" + r.src_domain + "))", r.tpl_host_fuzzy = "(?:" + r.src_ip4 + "|(?:(?:(?:" + r.src_domain + ")\\.)+(?:%TLDS%)))", r.tpl_host_no_ip_fuzzy = "(?:(?:(?:" + r.src_domain + ")\\.)+(?:%TLDS%))", r.src_host_strict = r.src_host + r.src_host_terminator, r.tpl_host_fuzzy_strict = r.tpl_host_fuzzy + r.src_host_terminator, r.src_host_port_strict = r.src_host + r.src_port + r.src_host_terminator, r.tpl_host_port_fuzzy_strict = r.tpl_host_fuzzy + r.src_port + r.src_host_terminator, r.tpl_host_port_no_ip_fuzzy_strict = r.tpl_host_no_ip_fuzzy + r.src_port + r.src_host_terminator, r.tpl_host_fuzzy_test = "localhost|www\\.|\\.\\d{1,3}\\.|(?:\\.(?:%TLDS%)(?:" + r.src_ZPCc + "|>|$))", r.tpl_email_fuzzy = '(^|[><\uff5c]|"|\\(|' + r.src_ZCc + ")(" + r.src_email_name + "@" + r.tpl_host_fuzzy_strict + ")", r.tpl_link_fuzzy = "(^|(?![.:/\\-_@])(?:[$+<=>^`|\uff5c]|" + r.src_ZPCc + "))((?![$+<=>^`|\uff5c])" + r.tpl_host_port_fuzzy_strict + r.src_path + ")", r.tpl_link_no_ip_fuzzy = "(^|(?![.:/\\-_@])(?:[$+<=>^`|\uff5c]|" + r.src_ZPCc + "))((?![$+<=>^`|\uff5c])" + r.tpl_host_port_no_ip_fuzzy_strict + r.src_path + ")", r;
3695
+ };
3696
+ function hr(e) {
3697
+ return Array.prototype.slice.call(arguments, 1).forEach(function (r) {
3684
3698
  r && Object.keys(r).forEach(function (t) {
3685
3699
  e[t] = r[t];
3686
3700
  });
3687
3701
  }), e;
3688
3702
  }
3689
- function hr(e) {
3690
- return Object.prototype.toString.call(e);
3691
- }
3692
3703
  function fr(e) {
3693
- return "[object Function]" === hr(e);
3704
+ return Object.prototype.toString.call(e);
3694
3705
  }
3695
3706
  function dr(e) {
3707
+ return "[object Function]" === fr(e);
3708
+ }
3709
+ function mr(e) {
3696
3710
  return e.replace(/[.?*+^$[\]\\(){}|-]/g, "\\$&");
3697
3711
  }
3698
- var mr = {
3712
+ var gr = {
3699
3713
  fuzzyLink: !0,
3700
3714
  fuzzyEmail: !0,
3701
3715
  fuzzyIP: !1
3702
3716
  };
3703
- var gr = {
3717
+ var _r = {
3704
3718
  "http:": {
3705
3719
  validate: function (e, r, t) {
3706
3720
  var n = e.slice(r);
@@ -3722,19 +3736,17 @@ var markdownIt_min = {
3722
3736
  }
3723
3737
  }
3724
3738
  },
3725
- _r = "biz|com|edu|gov|net|org|pro|web|xxx|aero|asia|coop|info|museum|name|shop|\u0440\u0444".split("|");
3726
- function kr(e) {
3727
- var r = e.re = function (e) {
3728
- var r = {};
3729
- return e = e || {}, r.src_Any = y.source, r.src_Cc = A.source, r.src_Z = x.source, r.src_P = t.source, r.src_ZPCc = [r.src_Z, r.src_P, r.src_Cc].join("|"), r.src_ZCc = [r.src_Z, r.src_Cc].join("|"), r.src_pseudo_letter = "(?:(?![><\uff5c]|" + r.src_ZPCc + ")" + r.src_Any + ")", r.src_ip4 = "(?:(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\\.){3}(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)", r.src_auth = "(?:(?:(?!" + r.src_ZCc + "|[@/\\[\\]()]).)+@)?", r.src_port = "(?::(?:6(?:[0-4]\\d{3}|5(?:[0-4]\\d{2}|5(?:[0-2]\\d|3[0-5])))|[1-5]?\\d{1,4}))?", r.src_host_terminator = "(?=$|[><\uff5c]|" + r.src_ZPCc + ")(?!" + (e["---"] ? "-(?!--)|" : "-|") + "_|:\\d|\\.-|\\.(?!$|" + r.src_ZPCc + "))", r.src_path = "(?:[/?#](?:(?!" + r.src_ZCc + "|[><\uff5c]|[()[\\]{}.,\"'?!\\-;]).|\\[(?:(?!" + r.src_ZCc + "|\\]).)*\\]|\\((?:(?!" + r.src_ZCc + "|[)]).)*\\)|\\{(?:(?!" + r.src_ZCc + '|[}]).)*\\}|\\"(?:(?!' + r.src_ZCc + '|["]).)+\\"|\\\'(?:(?!' + r.src_ZCc + "|[']).)+\\'|\\'(?=" + r.src_pseudo_letter + "|[-])|\\.{2,}[a-zA-Z0-9%/&]|\\.(?!" + r.src_ZCc + "|[.]|$)|" + (e["---"] ? "\\-(?!--(?:[^-]|$))(?:-*)|" : "\\-+|") + ",(?!" + r.src_ZCc + "|$)|;(?!" + r.src_ZCc + "|$)|\\!+(?!" + r.src_ZCc + "|[!]|$)|\\?(?!" + r.src_ZCc + "|[?]|$))+|\\/)?", r.src_email_name = '[\\-;:&=\\+\\$,\\.a-zA-Z0-9_][\\-;:&=\\+\\$,\\"\\.a-zA-Z0-9_]*', r.src_xn = "xn--[a-z0-9\\-]{1,59}", r.src_domain_root = "(?:" + r.src_xn + "|" + r.src_pseudo_letter + "{1,63})", r.src_domain = "(?:" + r.src_xn + "|(?:" + r.src_pseudo_letter + ")|(?:" + r.src_pseudo_letter + "(?:-|" + r.src_pseudo_letter + "){0,61}" + r.src_pseudo_letter + "))", r.src_host = "(?:(?:(?:(?:" + r.src_domain + ")\\.)*" + r.src_domain + "))", r.tpl_host_fuzzy = "(?:" + r.src_ip4 + "|(?:(?:(?:" + r.src_domain + ")\\.)+(?:%TLDS%)))", r.tpl_host_no_ip_fuzzy = "(?:(?:(?:" + r.src_domain + ")\\.)+(?:%TLDS%))", r.src_host_strict = r.src_host + r.src_host_terminator, r.tpl_host_fuzzy_strict = r.tpl_host_fuzzy + r.src_host_terminator, r.src_host_port_strict = r.src_host + r.src_port + r.src_host_terminator, r.tpl_host_port_fuzzy_strict = r.tpl_host_fuzzy + r.src_port + r.src_host_terminator, r.tpl_host_port_no_ip_fuzzy_strict = r.tpl_host_no_ip_fuzzy + r.src_port + r.src_host_terminator, r.tpl_host_fuzzy_test = "localhost|www\\.|\\.\\d{1,3}\\.|(?:\\.(?:%TLDS%)(?:" + r.src_ZPCc + "|>|$))", r.tpl_email_fuzzy = '(^|[><\uff5c]|"|\\(|' + r.src_ZCc + ")(" + r.src_email_name + "@" + r.tpl_host_fuzzy_strict + ")", r.tpl_link_fuzzy = "(^|(?![.:/\\-_@])(?:[$+<=>^`|\uff5c]|" + r.src_ZPCc + "))((?![$+<=>^`|\uff5c])" + r.tpl_host_port_fuzzy_strict + r.src_path + ")", r.tpl_link_no_ip_fuzzy = "(^|(?![.:/\\-_@])(?:[$+<=>^`|\uff5c]|" + r.src_ZPCc + "))((?![$+<=>^`|\uff5c])" + r.tpl_host_port_no_ip_fuzzy_strict + r.src_path + ")", r;
3730
- }(e.__opts__),
3731
- n = e.__tlds__.slice();
3732
- function s(e) {
3739
+ kr = "a[cdefgilmnoqrstuwxz]|b[abdefghijmnorstvwyz]|c[acdfghiklmnoruvwxyz]|d[ejkmoz]|e[cegrstu]|f[ijkmor]|g[abdefghilmnpqrstuwy]|h[kmnrtu]|i[delmnoqrst]|j[emop]|k[eghimnprwyz]|l[abcikrstuvy]|m[acdeghklmnopqrstuvwxyz]|n[acefgilopruz]|om|p[aefghklmnrstwy]|qa|r[eosuw]|s[abcdeghijklmnortuvxyz]|t[cdfghjklmnortvwz]|u[agksyz]|v[aceginu]|w[fs]|y[et]|z[amw]",
3740
+ br = "biz|com|edu|gov|net|org|pro|web|xxx|aero|asia|coop|info|museum|name|shop|\u0440\u0444".split("|");
3741
+ function vr(e) {
3742
+ var r = e.re = pr(e.__opts__),
3743
+ t = e.__tlds__.slice();
3744
+ function n(e) {
3733
3745
  return e.replace("%TLDS%", r.src_tlds);
3734
3746
  }
3735
- e.onCompile(), e.__tlds_replaced__ || n.push("a[cdefgilmnoqrstuwxz]|b[abdefghijmnorstvwyz]|c[acdfghiklmnoruvwxyz]|d[ejkmoz]|e[cegrstu]|f[ijkmor]|g[abdefghilmnpqrstuwy]|h[kmnrtu]|i[delmnoqrst]|j[emop]|k[eghimnprwyz]|l[abcikrstuvy]|m[acdeghklmnopqrstuvwxyz]|n[acefgilopruz]|om|p[aefghklmnrstwy]|qa|r[eosuw]|s[abcdeghijklmnortuvxyz]|t[cdfghjklmnortvwz]|u[agksyz]|v[aceginu]|w[fs]|y[et]|z[amw]"), n.push(r.src_xn), r.src_tlds = n.join("|"), r.email_fuzzy = RegExp(s(r.tpl_email_fuzzy), "i"), r.link_fuzzy = RegExp(s(r.tpl_link_fuzzy), "i"), r.link_no_ip_fuzzy = RegExp(s(r.tpl_link_no_ip_fuzzy), "i"), r.host_fuzzy_test = RegExp(s(r.tpl_host_fuzzy_test), "i");
3736
- var o = [];
3737
- function i(e, r) {
3747
+ e.onCompile(), e.__tlds_replaced__ || t.push(kr), t.push(r.src_xn), r.src_tlds = t.join("|"), r.email_fuzzy = RegExp(n(r.tpl_email_fuzzy), "i"), r.link_fuzzy = RegExp(n(r.tpl_link_fuzzy), "i"), r.link_no_ip_fuzzy = RegExp(n(r.tpl_link_no_ip_fuzzy), "i"), r.host_fuzzy_test = RegExp(n(r.tpl_host_fuzzy_test), "i");
3748
+ var s = [];
3749
+ function o(e, r) {
3738
3750
  throw new Error('(LinkifyIt) Invalid schema "' + e + '": ' + r);
3739
3751
  }
3740
3752
  e.__compiled__ = {}, Object.keys(e.__schemas__).forEach(function (r) {
@@ -3744,21 +3756,21 @@ var markdownIt_min = {
3744
3756
  validate: null,
3745
3757
  link: null
3746
3758
  };
3747
- if (e.__compiled__[r] = n, "[object Object]" === hr(t)) return !function (e) {
3748
- return "[object RegExp]" === hr(e);
3749
- }(t.validate) ? fr(t.validate) ? n.validate = t.validate : i(r, t) : n.validate = function (e) {
3759
+ if (e.__compiled__[r] = n, "[object Object]" === fr(t)) return !function (e) {
3760
+ return "[object RegExp]" === fr(e);
3761
+ }(t.validate) ? dr(t.validate) ? n.validate = t.validate : o(r, t) : n.validate = function (e) {
3750
3762
  return function (r, t) {
3751
3763
  var n = r.slice(t);
3752
3764
  return e.test(n) ? n.match(e)[0].length : 0;
3753
3765
  };
3754
- }(t.validate), void (fr(t.normalize) ? n.normalize = t.normalize : t.normalize ? i(r, t) : n.normalize = function (e, r) {
3766
+ }(t.validate), void (dr(t.normalize) ? n.normalize = t.normalize : t.normalize ? o(r, t) : n.normalize = function (e, r) {
3755
3767
  r.normalize(e);
3756
3768
  });
3757
3769
  !function (e) {
3758
- return "[object String]" === hr(e);
3759
- }(t) ? i(r, t) : o.push(r);
3770
+ return "[object String]" === fr(e);
3771
+ }(t) ? o(r, t) : s.push(r);
3760
3772
  }
3761
- }), o.forEach(function (r) {
3773
+ }), s.forEach(function (r) {
3762
3774
  e.__compiled__[e.__schemas__[r]] && (e.__compiled__[r].validate = e.__compiled__[e.__schemas__[r]].validate, e.__compiled__[r].normalize = e.__compiled__[e.__schemas__[r]].normalize);
3763
3775
  }), e.__compiled__[""] = {
3764
3776
  validate: null,
@@ -3766,35 +3778,35 @@ var markdownIt_min = {
3766
3778
  r.normalize(e);
3767
3779
  }
3768
3780
  };
3769
- var a = Object.keys(e.__compiled__).filter(function (r) {
3781
+ var i = Object.keys(e.__compiled__).filter(function (r) {
3770
3782
  return r.length > 0 && e.__compiled__[r];
3771
- }).map(dr).join("|");
3772
- e.re.schema_test = RegExp("(^|(?!_)(?:[><\uff5c]|" + r.src_ZPCc + "))(" + a + ")", "i"), e.re.schema_search = RegExp("(^|(?!_)(?:[><\uff5c]|" + r.src_ZPCc + "))(" + a + ")", "ig"), e.re.schema_at_start = RegExp("^" + e.re.schema_search.source, "i"), e.re.pretest = RegExp("(" + e.re.schema_test.source + ")|(" + e.re.host_fuzzy_test.source + ")|@", "i"), function (e) {
3783
+ }).map(mr).join("|");
3784
+ e.re.schema_test = RegExp("(^|(?!_)(?:[><\uff5c]|" + r.src_ZPCc + "))(" + i + ")", "i"), e.re.schema_search = RegExp("(^|(?!_)(?:[><\uff5c]|" + r.src_ZPCc + "))(" + i + ")", "ig"), e.re.schema_at_start = RegExp("^" + e.re.schema_search.source, "i"), e.re.pretest = RegExp("(" + e.re.schema_test.source + ")|(" + e.re.host_fuzzy_test.source + ")|@", "i"), function (e) {
3773
3785
  e.__index__ = -1, e.__text_cache__ = "";
3774
3786
  }(e);
3775
3787
  }
3776
- function br(e, r) {
3788
+ function yr(e, r) {
3777
3789
  var t = e.__index__,
3778
3790
  n = e.__last_index__,
3779
3791
  s = e.__text_cache__.slice(t, n);
3780
3792
  this.schema = e.__schema__.toLowerCase(), this.index = t + r, this.lastIndex = n + r, this.raw = s, this.text = s, this.url = s;
3781
3793
  }
3782
- function vr(e, r) {
3783
- var t = new br(e, r);
3794
+ function Cr(e, r) {
3795
+ var t = new yr(e, r);
3784
3796
  return e.__compiled__[t.schema].normalize(t, e), t;
3785
3797
  }
3786
- function Cr(e, r) {
3787
- if (!(this instanceof Cr)) return new Cr(e, r);
3798
+ function Ar(e, r) {
3799
+ if (!(this instanceof Ar)) return new Ar(e, r);
3788
3800
  var t;
3789
3801
  r || (t = e, Object.keys(t || {}).reduce(function (e, r) {
3790
- return e || mr.hasOwnProperty(r);
3791
- }, !1) && (r = e, e = {})), this.__opts__ = pr({}, mr, r), this.__index__ = -1, this.__last_index__ = -1, this.__schema__ = "", this.__text_cache__ = "", this.__schemas__ = pr({}, gr, e), this.__compiled__ = {}, this.__tlds__ = _r, this.__tlds_replaced__ = !1, this.re = {}, kr(this);
3792
- }
3793
- Cr.prototype.add = function (e, r) {
3794
- return this.__schemas__[e] = r, kr(this), this;
3795
- }, Cr.prototype.set = function (e) {
3796
- return this.__opts__ = pr(this.__opts__, e), this;
3797
- }, Cr.prototype.test = function (e) {
3802
+ return e || gr.hasOwnProperty(r);
3803
+ }, !1) && (r = e, e = {})), this.__opts__ = hr({}, gr, r), this.__index__ = -1, this.__last_index__ = -1, this.__schema__ = "", this.__text_cache__ = "", this.__schemas__ = hr({}, _r, e), this.__compiled__ = {}, this.__tlds__ = br, this.__tlds_replaced__ = !1, this.re = {}, vr(this);
3804
+ }
3805
+ Ar.prototype.add = function (e, r) {
3806
+ return this.__schemas__[e] = r, vr(this), this;
3807
+ }, Ar.prototype.set = function (e) {
3808
+ return this.__opts__ = hr(this.__opts__, e), this;
3809
+ }, Ar.prototype.test = function (e) {
3798
3810
  if (this.__text_cache__ = e, this.__index__ = -1, !e.length) return !1;
3799
3811
  var r, t, n, s, o, i, a, c;
3800
3812
  if (this.re.schema_test.test(e)) for ((a = this.re.schema_search).lastIndex = 0; null !== (r = a.exec(e));) if (s = this.testSchemaAt(e, r[2], a.lastIndex)) {
@@ -3802,74 +3814,82 @@ var markdownIt_min = {
3802
3814
  break;
3803
3815
  }
3804
3816
  return this.__opts__.fuzzyLink && this.__compiled__["http:"] && (c = e.search(this.re.host_fuzzy_test)) >= 0 && (this.__index__ < 0 || c < this.__index__) && null !== (t = e.match(this.__opts__.fuzzyIP ? this.re.link_fuzzy : this.re.link_no_ip_fuzzy)) && (o = t.index + t[1].length, (this.__index__ < 0 || o < this.__index__) && (this.__schema__ = "", this.__index__ = o, this.__last_index__ = t.index + t[0].length)), this.__opts__.fuzzyEmail && this.__compiled__["mailto:"] && e.indexOf("@") >= 0 && null !== (n = e.match(this.re.email_fuzzy)) && (o = n.index + n[1].length, i = n.index + n[0].length, (this.__index__ < 0 || o < this.__index__ || o === this.__index__ && i > this.__last_index__) && (this.__schema__ = "mailto:", this.__index__ = o, this.__last_index__ = i)), this.__index__ >= 0;
3805
- }, Cr.prototype.pretest = function (e) {
3817
+ }, Ar.prototype.pretest = function (e) {
3806
3818
  return this.re.pretest.test(e);
3807
- }, Cr.prototype.testSchemaAt = function (e, r, t) {
3819
+ }, Ar.prototype.testSchemaAt = function (e, r, t) {
3808
3820
  return this.__compiled__[r.toLowerCase()] ? this.__compiled__[r.toLowerCase()].validate(e, t, this) : 0;
3809
- }, Cr.prototype.match = function (e) {
3821
+ }, Ar.prototype.match = function (e) {
3810
3822
  var r = 0,
3811
3823
  t = [];
3812
- this.__index__ >= 0 && this.__text_cache__ === e && (t.push(vr(this, r)), r = this.__last_index__);
3813
- for (var n = r ? e.slice(r) : e; this.test(n);) t.push(vr(this, r)), n = n.slice(this.__last_index__), r += this.__last_index__;
3824
+ this.__index__ >= 0 && this.__text_cache__ === e && (t.push(Cr(this, r)), r = this.__last_index__);
3825
+ for (var n = r ? e.slice(r) : e; this.test(n);) t.push(Cr(this, r)), n = n.slice(this.__last_index__), r += this.__last_index__;
3814
3826
  return t.length ? t : null;
3815
- }, Cr.prototype.matchAtStart = function (e) {
3827
+ }, Ar.prototype.matchAtStart = function (e) {
3816
3828
  if (this.__text_cache__ = e, this.__index__ = -1, !e.length) return null;
3817
3829
  var r = this.re.schema_at_start.exec(e);
3818
3830
  if (!r) return null;
3819
3831
  var t = this.testSchemaAt(e, r[2], r[0].length);
3820
- return t ? (this.__schema__ = r[2], this.__index__ = r.index + r[1].length, this.__last_index__ = r.index + r[0].length + t, vr(this, 0)) : null;
3821
- }, Cr.prototype.tlds = function (e, r) {
3832
+ return t ? (this.__schema__ = r[2], this.__index__ = r.index + r[1].length, this.__last_index__ = r.index + r[0].length + t, Cr(this, 0)) : null;
3833
+ }, Ar.prototype.tlds = function (e, r) {
3822
3834
  return e = Array.isArray(e) ? e : [e], r ? (this.__tlds__ = this.__tlds__.concat(e).sort().filter(function (e, r, t) {
3823
3835
  return e !== t[r - 1];
3824
- }).reverse(), kr(this), this) : (this.__tlds__ = e.slice(), this.__tlds_replaced__ = !0, kr(this), this);
3825
- }, Cr.prototype.normalize = function (e) {
3836
+ }).reverse(), vr(this), this) : (this.__tlds__ = e.slice(), this.__tlds_replaced__ = !0, vr(this), this);
3837
+ }, Ar.prototype.normalize = function (e) {
3826
3838
  e.schema || (e.url = "http://" + e.url), "mailto:" !== e.schema || /^mailto:/i.test(e.url) || (e.url = "mailto:" + e.url);
3827
- }, Cr.prototype.onCompile = function () {};
3828
- var yr = Cr,
3829
- Ar = 2147483647,
3830
- xr = 36,
3831
- Dr = /^xn--/,
3832
- wr = /[^\x20-\x7E]/,
3833
- Er = /[\x2E\u3002\uFF0E\uFF61]/g,
3834
- qr = {
3839
+ }, Ar.prototype.onCompile = function () {};
3840
+ var xr = Ar,
3841
+ wr = 2147483647,
3842
+ Dr = 36,
3843
+ Er = 1,
3844
+ qr = 26,
3845
+ Sr = 38,
3846
+ Fr = 700,
3847
+ Lr = 72,
3848
+ zr = 128,
3849
+ Tr = "-",
3850
+ Ir = /^xn--/,
3851
+ Rr = /[^\x20-\x7E]/,
3852
+ Mr = /[\x2E\u3002\uFF0E\uFF61]/g,
3853
+ Br = {
3835
3854
  overflow: "Overflow: input needs wider integers to process",
3836
3855
  "not-basic": "Illegal input >= 0x80 (not a basic code point)",
3837
3856
  "invalid-input": "Invalid input"
3838
3857
  },
3839
- Sr = Math.floor,
3840
- Fr = String.fromCharCode;
3858
+ Nr = Dr - Er,
3859
+ Or = Math.floor,
3860
+ Pr = String.fromCharCode;
3841
3861
  /*! https://mths.be/punycode v1.4.1 by @mathias */
3842
- function Lr(e) {
3843
- throw new RangeError(qr[e]);
3862
+ function jr(e) {
3863
+ throw new RangeError(Br[e]);
3844
3864
  }
3845
- function zr(e, r) {
3865
+ function Ur(e, r) {
3846
3866
  for (var t = e.length, n = []; t--;) n[t] = r(e[t]);
3847
3867
  return n;
3848
3868
  }
3849
- function Tr(e, r) {
3869
+ function Vr(e, r) {
3850
3870
  var t = e.split("@"),
3851
3871
  n = "";
3852
- return t.length > 1 && (n = t[0] + "@", e = t[1]), n + zr((e = e.replace(Er, ".")).split("."), r).join(".");
3872
+ return t.length > 1 && (n = t[0] + "@", e = t[1]), n + Ur((e = e.replace(Mr, ".")).split("."), r).join(".");
3853
3873
  }
3854
- function Ir(e) {
3874
+ function Zr(e) {
3855
3875
  for (var r, t, n = [], s = 0, o = e.length; s < o;) (r = e.charCodeAt(s++)) >= 55296 && r <= 56319 && s < o ? 56320 == (64512 & (t = e.charCodeAt(s++))) ? n.push(((1023 & r) << 10) + (1023 & t) + 65536) : (n.push(r), s--) : n.push(r);
3856
3876
  return n;
3857
3877
  }
3858
- function Mr(e) {
3859
- return zr(e, function (e) {
3878
+ function $r(e) {
3879
+ return Ur(e, function (e) {
3860
3880
  var r = "";
3861
- return e > 65535 && (r += Fr((e -= 65536) >>> 10 & 1023 | 55296), e = 56320 | 1023 & e), r += Fr(e);
3881
+ return e > 65535 && (r += Pr((e -= 65536) >>> 10 & 1023 | 55296), e = 56320 | 1023 & e), r += Pr(e);
3862
3882
  }).join("");
3863
3883
  }
3864
- function Rr(e, r) {
3884
+ function Gr(e, r) {
3865
3885
  return e + 22 + 75 * (e < 26) - ((0 != r) << 5);
3866
3886
  }
3867
- function Br(e, r, t) {
3887
+ function Hr(e, r, t) {
3868
3888
  var n = 0;
3869
- for (e = t ? Sr(e / 700) : e >> 1, e += Sr(e / r); e > 455; n += xr) e = Sr(e / 35);
3870
- return Sr(n + 36 * e / (e + 38));
3889
+ for (e = t ? Or(e / Fr) : e >> 1, e += Or(e / r); e > Nr * qr >> 1; n += Dr) e = Or(e / Nr);
3890
+ return Or(n + (Nr + 1) * e / (e + Sr));
3871
3891
  }
3872
- function Nr(e) {
3892
+ function Jr(e) {
3873
3893
  var r,
3874
3894
  t,
3875
3895
  n,
@@ -3884,16 +3904,16 @@ var markdownIt_min = {
3884
3904
  h = [],
3885
3905
  f = e.length,
3886
3906
  d = 0,
3887
- m = 128,
3888
- g = 72;
3889
- for ((t = e.lastIndexOf("-")) < 0 && (t = 0), n = 0; n < t; ++n) e.charCodeAt(n) >= 128 && Lr("not-basic"), h.push(e.charCodeAt(n));
3907
+ m = zr,
3908
+ g = Lr;
3909
+ for ((t = e.lastIndexOf(Tr)) < 0 && (t = 0), n = 0; n < t; ++n) e.charCodeAt(n) >= 128 && jr("not-basic"), h.push(e.charCodeAt(n));
3890
3910
  for (s = t > 0 ? t + 1 : 0; s < f;) {
3891
- for (o = d, i = 1, a = xr; s >= f && Lr("invalid-input"), ((c = (p = e.charCodeAt(s++)) - 48 < 10 ? p - 22 : p - 65 < 26 ? p - 65 : p - 97 < 26 ? p - 97 : xr) >= xr || c > Sr((Ar - d) / i)) && Lr("overflow"), d += c * i, !(c < (l = a <= g ? 1 : a >= g + 26 ? 26 : a - g)); a += xr) i > Sr(Ar / (u = xr - l)) && Lr("overflow"), i *= u;
3892
- g = Br(d - o, r = h.length + 1, 0 == o), Sr(d / r) > Ar - m && Lr("overflow"), m += Sr(d / r), d %= r, h.splice(d++, 0, m);
3911
+ for (o = d, i = 1, a = Dr; s >= f && jr("invalid-input"), ((c = (p = e.charCodeAt(s++)) - 48 < 10 ? p - 22 : p - 65 < 26 ? p - 65 : p - 97 < 26 ? p - 97 : Dr) >= Dr || c > Or((wr - d) / i)) && jr("overflow"), d += c * i, !(c < (l = a <= g ? Er : a >= g + qr ? qr : a - g)); a += Dr) i > Or(wr / (u = Dr - l)) && jr("overflow"), i *= u;
3912
+ g = Hr(d - o, r = h.length + 1, 0 == o), Or(d / r) > wr - m && jr("overflow"), m += Or(d / r), d %= r, h.splice(d++, 0, m);
3893
3913
  }
3894
- return Mr(h);
3914
+ return $r(h);
3895
3915
  }
3896
- function Or(e) {
3916
+ function Wr(e) {
3897
3917
  var r,
3898
3918
  t,
3899
3919
  n,
@@ -3910,51 +3930,51 @@ var markdownIt_min = {
3910
3930
  d,
3911
3931
  m,
3912
3932
  g = [];
3913
- for (h = (e = Ir(e)).length, r = 128, t = 0, o = 72, i = 0; i < h; ++i) (p = e[i]) < 128 && g.push(Fr(p));
3914
- for (n = s = g.length, s && g.push("-"); n < h;) {
3915
- for (a = Ar, i = 0; i < h; ++i) (p = e[i]) >= r && p < a && (a = p);
3916
- for (a - r > Sr((Ar - t) / (f = n + 1)) && Lr("overflow"), t += (a - r) * f, r = a, i = 0; i < h; ++i) if ((p = e[i]) < r && ++t > Ar && Lr("overflow"), p == r) {
3917
- for (c = t, l = xr; !(c < (u = l <= o ? 1 : l >= o + 26 ? 26 : l - o)); l += xr) m = c - u, d = xr - u, g.push(Fr(Rr(u + m % d, 0))), c = Sr(m / d);
3918
- g.push(Fr(Rr(c, 0))), o = Br(t, f, n == s), t = 0, ++n;
3933
+ for (h = (e = Zr(e)).length, r = zr, t = 0, o = Lr, i = 0; i < h; ++i) (p = e[i]) < 128 && g.push(Pr(p));
3934
+ for (n = s = g.length, s && g.push(Tr); n < h;) {
3935
+ for (a = wr, i = 0; i < h; ++i) (p = e[i]) >= r && p < a && (a = p);
3936
+ for (a - r > Or((wr - t) / (f = n + 1)) && jr("overflow"), t += (a - r) * f, r = a, i = 0; i < h; ++i) if ((p = e[i]) < r && ++t > wr && jr("overflow"), p == r) {
3937
+ for (c = t, l = Dr; !(c < (u = l <= o ? Er : l >= o + qr ? qr : l - o)); l += Dr) m = c - u, d = Dr - u, g.push(Pr(Gr(u + m % d, 0))), c = Or(m / d);
3938
+ g.push(Pr(Gr(c, 0))), o = Hr(t, f, n == s), t = 0, ++n;
3919
3939
  }
3920
3940
  ++t, ++r;
3921
3941
  }
3922
3942
  return g.join("");
3923
3943
  }
3924
- function Pr(e) {
3925
- return Tr(e, function (e) {
3926
- return Dr.test(e) ? Nr(e.slice(4).toLowerCase()) : e;
3944
+ function Yr(e) {
3945
+ return Vr(e, function (e) {
3946
+ return Ir.test(e) ? Jr(e.slice(4).toLowerCase()) : e;
3927
3947
  });
3928
3948
  }
3929
- function jr(e) {
3930
- return Tr(e, function (e) {
3931
- return wr.test(e) ? "xn--" + Or(e) : e;
3949
+ function Kr(e) {
3950
+ return Vr(e, function (e) {
3951
+ return Rr.test(e) ? "xn--" + Wr(e) : e;
3932
3952
  });
3933
3953
  }
3934
- var Ur = "1.4.1",
3935
- Vr = {
3936
- decode: Ir,
3937
- encode: Mr
3954
+ var Qr = "1.4.1",
3955
+ Xr = {
3956
+ decode: Zr,
3957
+ encode: $r
3938
3958
  },
3939
- Zr = {
3940
- version: Ur,
3941
- ucs2: Vr,
3942
- toASCII: jr,
3943
- toUnicode: Pr,
3944
- encode: Or,
3945
- decode: Nr
3959
+ et = {
3960
+ version: Qr,
3961
+ ucs2: Xr,
3962
+ toASCII: Kr,
3963
+ toUnicode: Yr,
3964
+ encode: Wr,
3965
+ decode: Jr
3946
3966
  },
3947
- $r = e(Object.freeze({
3967
+ rt = e(Object.freeze({
3948
3968
  __proto__: null,
3949
- decode: Nr,
3950
- encode: Or,
3951
- toUnicode: Pr,
3952
- toASCII: jr,
3953
- version: Ur,
3954
- ucs2: Vr,
3955
- default: Zr
3969
+ decode: Jr,
3970
+ encode: Wr,
3971
+ toUnicode: Yr,
3972
+ toASCII: Kr,
3973
+ version: Qr,
3974
+ ucs2: Xr,
3975
+ default: et
3956
3976
  })),
3957
- Gr = {
3977
+ tt = {
3958
3978
  default: {
3959
3979
  options: {
3960
3980
  html: !1,
@@ -4024,42 +4044,42 @@ var markdownIt_min = {
4024
4044
  }
4025
4045
  }
4026
4046
  },
4027
- Hr = /^(vbscript|javascript|file|data):/,
4028
- Jr = /^data:image\/(gif|png|jpeg|webp);/;
4029
- function Wr(e) {
4047
+ nt = /^(vbscript|javascript|file|data):/,
4048
+ st = /^data:image\/(gif|png|jpeg|webp);/;
4049
+ function ot(e) {
4030
4050
  var r = e.trim().toLowerCase();
4031
- return !Hr.test(r) || !!Jr.test(r);
4051
+ return !nt.test(r) || !!st.test(r);
4032
4052
  }
4033
- var Yr = ["http:", "https:", "mailto:"];
4034
- function Kr(e) {
4035
- var r = C.parse(e, !0);
4036
- if (r.hostname && (!r.protocol || Yr.indexOf(r.protocol) >= 0)) try {
4037
- r.hostname = $r.toASCII(r.hostname);
4053
+ var it = ["http:", "https:", "mailto:"];
4054
+ function at(e) {
4055
+ var r = y.parse(e, !0);
4056
+ if (r.hostname && (!r.protocol || it.indexOf(r.protocol) >= 0)) try {
4057
+ r.hostname = rt.toASCII(r.hostname);
4038
4058
  } catch (e) {}
4039
- return C.encode(C.format(r));
4059
+ return y.encode(y.format(r));
4040
4060
  }
4041
- function Qr(e) {
4042
- var r = C.parse(e, !0);
4043
- if (r.hostname && (!r.protocol || Yr.indexOf(r.protocol) >= 0)) try {
4044
- r.hostname = $r.toUnicode(r.hostname);
4061
+ function ct(e) {
4062
+ var r = y.parse(e, !0);
4063
+ if (r.hostname && (!r.protocol || it.indexOf(r.protocol) >= 0)) try {
4064
+ r.hostname = rt.toUnicode(r.hostname);
4045
4065
  } catch (e) {}
4046
- return C.decode(C.format(r), C.decode.defaultChars + "%");
4066
+ return y.decode(y.format(r), y.decode.defaultChars + "%");
4047
4067
  }
4048
- function Xr(e, r) {
4049
- if (!(this instanceof Xr)) return new Xr(e, r);
4050
- r || w.isString(e) || (r = e || {}, e = "default"), this.inline = new ur(), this.block = new ze(), this.core = new ue(), this.renderer = new B(), this.linkify = new yr(), this.validateLink = Wr, this.normalizeLink = Kr, this.normalizeLinkText = Qr, this.utils = w, this.helpers = w.assign({}, L), this.options = {}, this.configure(e), r && this.set(r);
4068
+ function lt(e, r) {
4069
+ if (!(this instanceof lt)) return new lt(e, r);
4070
+ r || D.isString(e) || (r = e || {}, e = "default"), this.inline = new ur(), this.block = new ze(), this.core = new ue(), this.renderer = new B(), this.linkify = new xr(), this.validateLink = ot, this.normalizeLink = at, this.normalizeLinkText = ct, this.utils = D, this.helpers = D.assign({}, L), this.options = {}, this.configure(e), r && this.set(r);
4051
4071
  }
4052
- return Xr.prototype.set = function (e) {
4053
- return w.assign(this.options, e), this;
4054
- }, Xr.prototype.configure = function (e) {
4072
+ return lt.prototype.set = function (e) {
4073
+ return D.assign(this.options, e), this;
4074
+ }, lt.prototype.configure = function (e) {
4055
4075
  var r,
4056
4076
  t = this;
4057
- if (w.isString(e) && !(e = Gr[r = e])) throw new Error('Wrong `markdown-it` preset "' + r + '", check name');
4077
+ if (D.isString(e) && !(e = tt[r = e])) throw new Error('Wrong `markdown-it` preset "' + r + '", check name');
4058
4078
  if (!e) throw new Error("Wrong `markdown-it` preset, can't be empty");
4059
4079
  return e.options && t.set(e.options), e.components && Object.keys(e.components).forEach(function (r) {
4060
4080
  e.components[r].rules && t[r].ruler.enableOnly(e.components[r].rules), e.components[r].rules2 && t[r].ruler2.enableOnly(e.components[r].rules2);
4061
4081
  }), this;
4062
- }, Xr.prototype.enable = function (e, r) {
4082
+ }, lt.prototype.enable = function (e, r) {
4063
4083
  var t = [];
4064
4084
  Array.isArray(e) || (e = [e]), ["core", "block", "inline"].forEach(function (r) {
4065
4085
  t = t.concat(this[r].ruler.enable(e, !0));
@@ -4069,7 +4089,7 @@ var markdownIt_min = {
4069
4089
  });
4070
4090
  if (n.length && !r) throw new Error("MarkdownIt. Failed to enable unknown rule(s): " + n);
4071
4091
  return this;
4072
- }, Xr.prototype.disable = function (e, r) {
4092
+ }, lt.prototype.disable = function (e, r) {
4073
4093
  var t = [];
4074
4094
  Array.isArray(e) || (e = [e]), ["core", "block", "inline"].forEach(function (r) {
4075
4095
  t = t.concat(this[r].ruler.disable(e, !0));
@@ -4079,21 +4099,21 @@ var markdownIt_min = {
4079
4099
  });
4080
4100
  if (n.length && !r) throw new Error("MarkdownIt. Failed to disable unknown rule(s): " + n);
4081
4101
  return this;
4082
- }, Xr.prototype.use = function (e) {
4102
+ }, lt.prototype.use = function (e) {
4083
4103
  var r = [this].concat(Array.prototype.slice.call(arguments, 1));
4084
4104
  return e.apply(e, r), this;
4085
- }, Xr.prototype.parse = function (e, r) {
4105
+ }, lt.prototype.parse = function (e, r) {
4086
4106
  if ("string" != typeof e) throw new Error("Input data should be a String");
4087
4107
  var t = new this.core.State(e, this, r);
4088
4108
  return this.core.process(t), t.tokens;
4089
- }, Xr.prototype.render = function (e, r) {
4109
+ }, lt.prototype.render = function (e, r) {
4090
4110
  return r = r || {}, this.renderer.render(this.parse(e, r), this.options, r);
4091
- }, Xr.prototype.parseInline = function (e, r) {
4111
+ }, lt.prototype.parseInline = function (e, r) {
4092
4112
  var t = new this.core.State(e, this, r);
4093
4113
  return t.inlineMode = !0, this.core.process(t), t.tokens;
4094
- }, Xr.prototype.renderInline = function (e, r) {
4114
+ }, lt.prototype.renderInline = function (e, r) {
4095
4115
  return r = r || {}, this.renderer.render(this.parseInline(e, r), this.options, r);
4096
- }, Xr;
4116
+ }, lt;
4097
4117
  });
4098
4118
  })(markdownIt_min);
4099
4119
  var markdownit = /*@__PURE__*/getDefaultExportFromCjs(markdownIt_minExports);
@@ -4873,192 +4893,2488 @@ class MarkdownSerializerState {
4873
4893
  ensureNewLine() {
4874
4894
  if (!this.atBlank()) this.out += "\n";
4875
4895
  }
4876
- /**
4877
- Prepare the state for writing output (closing closed paragraphs,
4878
- adding delimiters, and so on), and then optionally add content
4879
- (unescaped) to the output.
4880
- */
4881
- write(content) {
4882
- this.flushClose();
4883
- if (this.delim && this.atBlank()) this.out += this.delim;
4884
- if (content) this.out += content;
4896
+ /**
4897
+ Prepare the state for writing output (closing closed paragraphs,
4898
+ adding delimiters, and so on), and then optionally add content
4899
+ (unescaped) to the output.
4900
+ */
4901
+ write(content) {
4902
+ this.flushClose();
4903
+ if (this.delim && this.atBlank()) this.out += this.delim;
4904
+ if (content) this.out += content;
4905
+ }
4906
+ /**
4907
+ Close the block for the given node.
4908
+ */
4909
+ closeBlock(node) {
4910
+ this.closed = node;
4911
+ }
4912
+ /**
4913
+ Add the given text to the document. When escape is not `false`,
4914
+ it will be escaped.
4915
+ */
4916
+ text(text) {
4917
+ let escape = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : true;
4918
+ let lines = text.split("\n");
4919
+ for (let i = 0; i < lines.length; i++) {
4920
+ this.write();
4921
+ // Escape exclamation marks in front of links
4922
+ if (!escape && lines[i][0] == "[" && /(^|[^\\])\!$/.test(this.out)) this.out = this.out.slice(0, this.out.length - 1) + "\\!";
4923
+ this.out += escape ? this.esc(lines[i], this.atBlockStart) : lines[i];
4924
+ if (i != lines.length - 1) this.out += "\n";
4925
+ }
4926
+ }
4927
+ /**
4928
+ Render the given node as a block.
4929
+ */
4930
+ render(node, parent, index) {
4931
+ if (typeof parent == "number") throw new Error("!");
4932
+ if (!this.nodes[node.type.name]) throw new Error("Token type `" + node.type.name + "` not supported by Markdown renderer");
4933
+ this.nodes[node.type.name](this, node, parent, index);
4934
+ }
4935
+ /**
4936
+ Render the contents of `parent` as block nodes.
4937
+ */
4938
+ renderContent(parent) {
4939
+ parent.forEach((node, _, i) => this.render(node, parent, i));
4940
+ }
4941
+ /**
4942
+ Render the contents of `parent` as inline content.
4943
+ */
4944
+ renderInline(parent) {
4945
+ this.atBlockStart = true;
4946
+ let active = [],
4947
+ trailing = "";
4948
+ let progress = (node, offset, index) => {
4949
+ let marks = node ? node.marks : [];
4950
+ // Remove marks from `hard_break` that are the last node inside
4951
+ // that mark to prevent parser edge cases with new lines just
4952
+ // before closing marks.
4953
+ // (FIXME it'd be nice if we had a schema-agnostic way to
4954
+ // identify nodes that serialize as hard breaks)
4955
+ if (node && node.type.name === "hard_break") marks = marks.filter(m => {
4956
+ if (index + 1 == parent.childCount) return false;
4957
+ let next = parent.child(index + 1);
4958
+ return m.isInSet(next.marks) && (!next.isText || /\S/.test(next.text));
4959
+ });
4960
+ let leading = trailing;
4961
+ trailing = "";
4962
+ // If whitespace has to be expelled from the node, adjust
4963
+ // leading and trailing accordingly.
4964
+ if (node && node.isText && marks.some(mark => {
4965
+ let info = this.marks[mark.type.name];
4966
+ return info && info.expelEnclosingWhitespace && !(mark.isInSet(active) || index < parent.childCount - 1 && mark.isInSet(parent.child(index + 1).marks));
4967
+ })) {
4968
+ let [_, lead, inner, trail] = /^(\s*)(.*?)(\s*)$/m.exec(node.text);
4969
+ leading += lead;
4970
+ trailing = trail;
4971
+ if (lead || trail) {
4972
+ node = inner ? node.withText(inner) : null;
4973
+ if (!node) marks = active;
4974
+ }
4975
+ }
4976
+ let inner = marks.length ? marks[marks.length - 1] : null;
4977
+ let noEsc = inner && this.marks[inner.type.name].escape === false;
4978
+ let len = marks.length - (noEsc ? 1 : 0);
4979
+ // Try to reorder 'mixable' marks, such as em and strong, which
4980
+ // in Markdown may be opened and closed in different order, so
4981
+ // that order of the marks for the token matches the order in
4982
+ // active.
4983
+ outer: for (let i = 0; i < len; i++) {
4984
+ let mark = marks[i];
4985
+ if (!this.marks[mark.type.name].mixable) break;
4986
+ for (let j = 0; j < active.length; j++) {
4987
+ let other = active[j];
4988
+ if (!this.marks[other.type.name].mixable) break;
4989
+ if (mark.eq(other)) {
4990
+ if (i > j) marks = marks.slice(0, j).concat(mark).concat(marks.slice(j, i)).concat(marks.slice(i + 1, len));else if (j > i) marks = marks.slice(0, i).concat(marks.slice(i + 1, j)).concat(mark).concat(marks.slice(j, len));
4991
+ continue outer;
4992
+ }
4993
+ }
4994
+ }
4995
+ // Find the prefix of the mark set that didn't change
4996
+ let keep = 0;
4997
+ while (keep < Math.min(active.length, len) && marks[keep].eq(active[keep])) ++keep;
4998
+ // Close the marks that need to be closed
4999
+ while (keep < active.length) this.text(this.markString(active.pop(), false, parent, index), false);
5000
+ // Output any previously expelled trailing whitespace outside the marks
5001
+ if (leading) this.text(leading);
5002
+ // Open the marks that need to be opened
5003
+ if (node) {
5004
+ while (active.length < len) {
5005
+ let add = marks[active.length];
5006
+ active.push(add);
5007
+ this.text(this.markString(add, true, parent, index), false);
5008
+ }
5009
+ // Render the node. Special case code marks, since their content
5010
+ // may not be escaped.
5011
+ if (noEsc && node.isText) this.text(this.markString(inner, true, parent, index) + node.text + this.markString(inner, false, parent, index + 1), false);else this.render(node, parent, index);
5012
+ }
5013
+ };
5014
+ parent.forEach(progress);
5015
+ progress(null, 0, parent.childCount);
5016
+ this.atBlockStart = false;
5017
+ }
5018
+ /**
5019
+ Render a node's content as a list. `delim` should be the extra
5020
+ indentation added to all lines except the first in an item,
5021
+ `firstDelim` is a function going from an item index to a
5022
+ delimiter for the first line of the item.
5023
+ */
5024
+ renderList(node, delim, firstDelim) {
5025
+ if (this.closed && this.closed.type == node.type) this.flushClose(3);else if (this.inTightList) this.flushClose(1);
5026
+ let isTight = typeof node.attrs.tight != "undefined" ? node.attrs.tight : this.options.tightLists;
5027
+ let prevTight = this.inTightList;
5028
+ this.inTightList = isTight;
5029
+ node.forEach((child, _, i) => {
5030
+ if (i && isTight) this.flushClose(1);
5031
+ this.wrapBlock(delim, firstDelim(i), node, () => this.render(child, node, i));
5032
+ });
5033
+ this.inTightList = prevTight;
5034
+ }
5035
+ /**
5036
+ Escape the given string so that it can safely appear in Markdown
5037
+ content. If `startOfLine` is true, also escape characters that
5038
+ have special meaning only at the start of the line.
5039
+ */
5040
+ esc(str) {
5041
+ let startOfLine = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
5042
+ str = str.replace(/[`*\\~\[\]_]/g, (m, i) => m == "_" && i > 0 && i + 1 < str.length && str[i - 1].match(/\w/) && str[i + 1].match(/\w/) ? m : "\\" + m);
5043
+ if (startOfLine) str = str.replace(/^[#\-*+>]/, "\\$&").replace(/^(\s*\d+)\./, "$1\\.");
5044
+ if (this.options.escapeExtraCharacters) str = str.replace(this.options.escapeExtraCharacters, "\\$&");
5045
+ return str;
5046
+ }
5047
+ /**
5048
+ @internal
5049
+ */
5050
+ quote(str) {
5051
+ let wrap = str.indexOf('"') == -1 ? '""' : str.indexOf("'") == -1 ? "''" : "()";
5052
+ return wrap[0] + str + wrap[1];
5053
+ }
5054
+ /**
5055
+ Repeat the given string `n` times.
5056
+ */
5057
+ repeat(str, n) {
5058
+ let out = "";
5059
+ for (let i = 0; i < n; i++) out += str;
5060
+ return out;
5061
+ }
5062
+ /**
5063
+ Get the markdown string for a given opening or closing mark.
5064
+ */
5065
+ markString(mark, open, parent, index) {
5066
+ let info = this.marks[mark.type.name];
5067
+ let value = open ? info.open : info.close;
5068
+ return typeof value == "string" ? value : value(this, mark, parent, index);
5069
+ }
5070
+ /**
5071
+ Get leading and trailing whitespace from a string. Values of
5072
+ leading or trailing property of the return object will be undefined
5073
+ if there is no match.
5074
+ */
5075
+ getEnclosingWhitespace(text) {
5076
+ return {
5077
+ leading: (text.match(/^(\s+)/) || [undefined])[0],
5078
+ trailing: (text.match(/(\s+)$/) || [undefined])[0]
5079
+ };
5080
+ }
5081
+ }
5082
+
5083
+ /**
5084
+ * marked v9.1.2 - a markdown parser
5085
+ * Copyright (c) 2011-2023, Christopher Jeffrey. (MIT Licensed)
5086
+ * https://github.com/markedjs/marked
5087
+ */
5088
+
5089
+ /**
5090
+ * DO NOT EDIT THIS FILE
5091
+ * The code in this file is generated from files in ./src/
5092
+ */
5093
+
5094
+ /**
5095
+ * Gets the original marked default options.
5096
+ */
5097
+ function _getDefaults() {
5098
+ return {
5099
+ async: false,
5100
+ breaks: false,
5101
+ extensions: null,
5102
+ gfm: true,
5103
+ hooks: null,
5104
+ pedantic: false,
5105
+ renderer: null,
5106
+ silent: false,
5107
+ tokenizer: null,
5108
+ walkTokens: null
5109
+ };
5110
+ }
5111
+ let _defaults = _getDefaults();
5112
+ function changeDefaults(newDefaults) {
5113
+ _defaults = newDefaults;
5114
+ }
5115
+
5116
+ /**
5117
+ * Helpers
5118
+ */
5119
+ const escapeTest = /[&<>"']/;
5120
+ const escapeReplace = new RegExp(escapeTest.source, 'g');
5121
+ const escapeTestNoEncode = /[<>"']|&(?!(#\d{1,7}|#[Xx][a-fA-F0-9]{1,6}|\w+);)/;
5122
+ const escapeReplaceNoEncode = new RegExp(escapeTestNoEncode.source, 'g');
5123
+ const escapeReplacements = {
5124
+ '&': '&amp;',
5125
+ '<': '&lt;',
5126
+ '>': '&gt;',
5127
+ '"': '&quot;',
5128
+ "'": '&#39;'
5129
+ };
5130
+ const getEscapeReplacement = ch => escapeReplacements[ch];
5131
+ function escape(html, encode) {
5132
+ if (encode) {
5133
+ if (escapeTest.test(html)) {
5134
+ return html.replace(escapeReplace, getEscapeReplacement);
5135
+ }
5136
+ } else {
5137
+ if (escapeTestNoEncode.test(html)) {
5138
+ return html.replace(escapeReplaceNoEncode, getEscapeReplacement);
5139
+ }
5140
+ }
5141
+ return html;
5142
+ }
5143
+ const unescapeTest = /&(#(?:\d+)|(?:#x[0-9A-Fa-f]+)|(?:\w+));?/ig;
5144
+ function unescape(html) {
5145
+ // explicitly match decimal, hex, and named HTML entities
5146
+ return html.replace(unescapeTest, (_, n) => {
5147
+ n = n.toLowerCase();
5148
+ if (n === 'colon') return ':';
5149
+ if (n.charAt(0) === '#') {
5150
+ return n.charAt(1) === 'x' ? String.fromCharCode(parseInt(n.substring(2), 16)) : String.fromCharCode(+n.substring(1));
5151
+ }
5152
+ return '';
5153
+ });
5154
+ }
5155
+ const caret = /(^|[^\[])\^/g;
5156
+ function edit(regex, opt) {
5157
+ regex = typeof regex === 'string' ? regex : regex.source;
5158
+ opt = opt || '';
5159
+ const obj = {
5160
+ replace: (name, val) => {
5161
+ val = typeof val === 'object' && 'source' in val ? val.source : val;
5162
+ val = val.replace(caret, '$1');
5163
+ regex = regex.replace(name, val);
5164
+ return obj;
5165
+ },
5166
+ getRegex: () => {
5167
+ return new RegExp(regex, opt);
5168
+ }
5169
+ };
5170
+ return obj;
5171
+ }
5172
+ function cleanUrl(href) {
5173
+ try {
5174
+ href = encodeURI(href).replace(/%25/g, '%');
5175
+ } catch (e) {
5176
+ return null;
5177
+ }
5178
+ return href;
5179
+ }
5180
+ const noopTest = {
5181
+ exec: () => null
5182
+ };
5183
+ function splitCells(tableRow, count) {
5184
+ // ensure that every cell-delimiting pipe has a space
5185
+ // before it to distinguish it from an escaped pipe
5186
+ const row = tableRow.replace(/\|/g, (match, offset, str) => {
5187
+ let escaped = false;
5188
+ let curr = offset;
5189
+ while (--curr >= 0 && str[curr] === '\\') escaped = !escaped;
5190
+ if (escaped) {
5191
+ // odd number of slashes means | is escaped
5192
+ // so we leave it alone
5193
+ return '|';
5194
+ } else {
5195
+ // add space before unescaped |
5196
+ return ' |';
5197
+ }
5198
+ }),
5199
+ cells = row.split(/ \|/);
5200
+ let i = 0;
5201
+ // First/last cell in a row cannot be empty if it has no leading/trailing pipe
5202
+ if (!cells[0].trim()) {
5203
+ cells.shift();
5204
+ }
5205
+ if (cells.length > 0 && !cells[cells.length - 1].trim()) {
5206
+ cells.pop();
5207
+ }
5208
+ if (count) {
5209
+ if (cells.length > count) {
5210
+ cells.splice(count);
5211
+ } else {
5212
+ while (cells.length < count) cells.push('');
5213
+ }
5214
+ }
5215
+ for (; i < cells.length; i++) {
5216
+ // leading or trailing whitespace is ignored per the gfm spec
5217
+ cells[i] = cells[i].trim().replace(/\\\|/g, '|');
5218
+ }
5219
+ return cells;
5220
+ }
5221
+ /**
5222
+ * Remove trailing 'c's. Equivalent to str.replace(/c*$/, '').
5223
+ * /c*$/ is vulnerable to REDOS.
5224
+ *
5225
+ * @param str
5226
+ * @param c
5227
+ * @param invert Remove suffix of non-c chars instead. Default falsey.
5228
+ */
5229
+ function rtrim(str, c, invert) {
5230
+ const l = str.length;
5231
+ if (l === 0) {
5232
+ return '';
5233
+ }
5234
+ // Length of suffix matching the invert condition.
5235
+ let suffLen = 0;
5236
+ // Step left until we fail to match the invert condition.
5237
+ while (suffLen < l) {
5238
+ const currChar = str.charAt(l - suffLen - 1);
5239
+ if (currChar === c && !invert) {
5240
+ suffLen++;
5241
+ } else if (currChar !== c && invert) {
5242
+ suffLen++;
5243
+ } else {
5244
+ break;
5245
+ }
5246
+ }
5247
+ return str.slice(0, l - suffLen);
5248
+ }
5249
+ function findClosingBracket(str, b) {
5250
+ if (str.indexOf(b[1]) === -1) {
5251
+ return -1;
5252
+ }
5253
+ let level = 0;
5254
+ for (let i = 0; i < str.length; i++) {
5255
+ if (str[i] === '\\') {
5256
+ i++;
5257
+ } else if (str[i] === b[0]) {
5258
+ level++;
5259
+ } else if (str[i] === b[1]) {
5260
+ level--;
5261
+ if (level < 0) {
5262
+ return i;
5263
+ }
5264
+ }
5265
+ }
5266
+ return -1;
5267
+ }
5268
+ function outputLink(cap, link, raw, lexer) {
5269
+ const href = link.href;
5270
+ const title = link.title ? escape(link.title) : null;
5271
+ const text = cap[1].replace(/\\([\[\]])/g, '$1');
5272
+ if (cap[0].charAt(0) !== '!') {
5273
+ lexer.state.inLink = true;
5274
+ const token = {
5275
+ type: 'link',
5276
+ raw,
5277
+ href,
5278
+ title,
5279
+ text,
5280
+ tokens: lexer.inlineTokens(text)
5281
+ };
5282
+ lexer.state.inLink = false;
5283
+ return token;
5284
+ }
5285
+ return {
5286
+ type: 'image',
5287
+ raw,
5288
+ href,
5289
+ title,
5290
+ text: escape(text)
5291
+ };
5292
+ }
5293
+ function indentCodeCompensation(raw, text) {
5294
+ const matchIndentToCode = raw.match(/^(\s+)(?:```)/);
5295
+ if (matchIndentToCode === null) {
5296
+ return text;
5297
+ }
5298
+ const indentToCode = matchIndentToCode[1];
5299
+ return text.split('\n').map(node => {
5300
+ const matchIndentInNode = node.match(/^\s+/);
5301
+ if (matchIndentInNode === null) {
5302
+ return node;
5303
+ }
5304
+ const [indentInNode] = matchIndentInNode;
5305
+ if (indentInNode.length >= indentToCode.length) {
5306
+ return node.slice(indentToCode.length);
5307
+ }
5308
+ return node;
5309
+ }).join('\n');
5310
+ }
5311
+ /**
5312
+ * Tokenizer
5313
+ */
5314
+ class _Tokenizer {
5315
+ options;
5316
+ // TODO: Fix this rules type
5317
+ rules;
5318
+ lexer;
5319
+ constructor(options) {
5320
+ this.options = options || _defaults;
5321
+ }
5322
+ space(src) {
5323
+ const cap = this.rules.block.newline.exec(src);
5324
+ if (cap && cap[0].length > 0) {
5325
+ return {
5326
+ type: 'space',
5327
+ raw: cap[0]
5328
+ };
5329
+ }
5330
+ }
5331
+ code(src) {
5332
+ const cap = this.rules.block.code.exec(src);
5333
+ if (cap) {
5334
+ const text = cap[0].replace(/^ {1,4}/gm, '');
5335
+ return {
5336
+ type: 'code',
5337
+ raw: cap[0],
5338
+ codeBlockStyle: 'indented',
5339
+ text: !this.options.pedantic ? rtrim(text, '\n') : text
5340
+ };
5341
+ }
5342
+ }
5343
+ fences(src) {
5344
+ const cap = this.rules.block.fences.exec(src);
5345
+ if (cap) {
5346
+ const raw = cap[0];
5347
+ const text = indentCodeCompensation(raw, cap[3] || '');
5348
+ return {
5349
+ type: 'code',
5350
+ raw,
5351
+ lang: cap[2] ? cap[2].trim().replace(this.rules.inline._escapes, '$1') : cap[2],
5352
+ text
5353
+ };
5354
+ }
5355
+ }
5356
+ heading(src) {
5357
+ const cap = this.rules.block.heading.exec(src);
5358
+ if (cap) {
5359
+ let text = cap[2].trim();
5360
+ // remove trailing #s
5361
+ if (/#$/.test(text)) {
5362
+ const trimmed = rtrim(text, '#');
5363
+ if (this.options.pedantic) {
5364
+ text = trimmed.trim();
5365
+ } else if (!trimmed || / $/.test(trimmed)) {
5366
+ // CommonMark requires space before trailing #s
5367
+ text = trimmed.trim();
5368
+ }
5369
+ }
5370
+ return {
5371
+ type: 'heading',
5372
+ raw: cap[0],
5373
+ depth: cap[1].length,
5374
+ text,
5375
+ tokens: this.lexer.inline(text)
5376
+ };
5377
+ }
5378
+ }
5379
+ hr(src) {
5380
+ const cap = this.rules.block.hr.exec(src);
5381
+ if (cap) {
5382
+ return {
5383
+ type: 'hr',
5384
+ raw: cap[0]
5385
+ };
5386
+ }
5387
+ }
5388
+ blockquote(src) {
5389
+ const cap = this.rules.block.blockquote.exec(src);
5390
+ if (cap) {
5391
+ const text = rtrim(cap[0].replace(/^ *>[ \t]?/gm, ''), '\n');
5392
+ const top = this.lexer.state.top;
5393
+ this.lexer.state.top = true;
5394
+ const tokens = this.lexer.blockTokens(text);
5395
+ this.lexer.state.top = top;
5396
+ return {
5397
+ type: 'blockquote',
5398
+ raw: cap[0],
5399
+ tokens,
5400
+ text
5401
+ };
5402
+ }
5403
+ }
5404
+ list(src) {
5405
+ let cap = this.rules.block.list.exec(src);
5406
+ if (cap) {
5407
+ let bull = cap[1].trim();
5408
+ const isordered = bull.length > 1;
5409
+ const list = {
5410
+ type: 'list',
5411
+ raw: '',
5412
+ ordered: isordered,
5413
+ start: isordered ? +bull.slice(0, -1) : '',
5414
+ loose: false,
5415
+ items: []
5416
+ };
5417
+ bull = isordered ? `\\d{1,9}\\${bull.slice(-1)}` : `\\${bull}`;
5418
+ if (this.options.pedantic) {
5419
+ bull = isordered ? bull : '[*+-]';
5420
+ }
5421
+ // Get next list item
5422
+ const itemRegex = new RegExp(`^( {0,3}${bull})((?:[\t ][^\\n]*)?(?:\\n|$))`);
5423
+ let raw = '';
5424
+ let itemContents = '';
5425
+ let endsWithBlankLine = false;
5426
+ // Check if current bullet point can start a new List Item
5427
+ while (src) {
5428
+ let endEarly = false;
5429
+ if (!(cap = itemRegex.exec(src))) {
5430
+ break;
5431
+ }
5432
+ if (this.rules.block.hr.test(src)) {
5433
+ // End list if bullet was actually HR (possibly move into itemRegex?)
5434
+ break;
5435
+ }
5436
+ raw = cap[0];
5437
+ src = src.substring(raw.length);
5438
+ let line = cap[2].split('\n', 1)[0].replace(/^\t+/, t => ' '.repeat(3 * t.length));
5439
+ let nextLine = src.split('\n', 1)[0];
5440
+ let indent = 0;
5441
+ if (this.options.pedantic) {
5442
+ indent = 2;
5443
+ itemContents = line.trimStart();
5444
+ } else {
5445
+ indent = cap[2].search(/[^ ]/); // Find first non-space char
5446
+ indent = indent > 4 ? 1 : indent; // Treat indented code blocks (> 4 spaces) as having only 1 indent
5447
+ itemContents = line.slice(indent);
5448
+ indent += cap[1].length;
5449
+ }
5450
+ let blankLine = false;
5451
+ if (!line && /^ *$/.test(nextLine)) {
5452
+ // Items begin with at most one blank line
5453
+ raw += nextLine + '\n';
5454
+ src = src.substring(nextLine.length + 1);
5455
+ endEarly = true;
5456
+ }
5457
+ if (!endEarly) {
5458
+ const nextBulletRegex = new RegExp(`^ {0,${Math.min(3, indent - 1)}}(?:[*+-]|\\d{1,9}[.)])((?:[ \t][^\\n]*)?(?:\\n|$))`);
5459
+ const hrRegex = new RegExp(`^ {0,${Math.min(3, indent - 1)}}((?:- *){3,}|(?:_ *){3,}|(?:\\* *){3,})(?:\\n+|$)`);
5460
+ const fencesBeginRegex = new RegExp(`^ {0,${Math.min(3, indent - 1)}}(?:\`\`\`|~~~)`);
5461
+ const headingBeginRegex = new RegExp(`^ {0,${Math.min(3, indent - 1)}}#`);
5462
+ // Check if following lines should be included in List Item
5463
+ while (src) {
5464
+ const rawLine = src.split('\n', 1)[0];
5465
+ nextLine = rawLine;
5466
+ // Re-align to follow commonmark nesting rules
5467
+ if (this.options.pedantic) {
5468
+ nextLine = nextLine.replace(/^ {1,4}(?=( {4})*[^ ])/g, ' ');
5469
+ }
5470
+ // End list item if found code fences
5471
+ if (fencesBeginRegex.test(nextLine)) {
5472
+ break;
5473
+ }
5474
+ // End list item if found start of new heading
5475
+ if (headingBeginRegex.test(nextLine)) {
5476
+ break;
5477
+ }
5478
+ // End list item if found start of new bullet
5479
+ if (nextBulletRegex.test(nextLine)) {
5480
+ break;
5481
+ }
5482
+ // Horizontal rule found
5483
+ if (hrRegex.test(src)) {
5484
+ break;
5485
+ }
5486
+ if (nextLine.search(/[^ ]/) >= indent || !nextLine.trim()) {
5487
+ // Dedent if possible
5488
+ itemContents += '\n' + nextLine.slice(indent);
5489
+ } else {
5490
+ // not enough indentation
5491
+ if (blankLine) {
5492
+ break;
5493
+ }
5494
+ // paragraph continuation unless last line was a different block level element
5495
+ if (line.search(/[^ ]/) >= 4) {
5496
+ // indented code block
5497
+ break;
5498
+ }
5499
+ if (fencesBeginRegex.test(line)) {
5500
+ break;
5501
+ }
5502
+ if (headingBeginRegex.test(line)) {
5503
+ break;
5504
+ }
5505
+ if (hrRegex.test(line)) {
5506
+ break;
5507
+ }
5508
+ itemContents += '\n' + nextLine;
5509
+ }
5510
+ if (!blankLine && !nextLine.trim()) {
5511
+ // Check if current line is blank
5512
+ blankLine = true;
5513
+ }
5514
+ raw += rawLine + '\n';
5515
+ src = src.substring(rawLine.length + 1);
5516
+ line = nextLine.slice(indent);
5517
+ }
5518
+ }
5519
+ if (!list.loose) {
5520
+ // If the previous item ended with a blank line, the list is loose
5521
+ if (endsWithBlankLine) {
5522
+ list.loose = true;
5523
+ } else if (/\n *\n *$/.test(raw)) {
5524
+ endsWithBlankLine = true;
5525
+ }
5526
+ }
5527
+ let istask = null;
5528
+ let ischecked;
5529
+ // Check for task list items
5530
+ if (this.options.gfm) {
5531
+ istask = /^\[[ xX]\] /.exec(itemContents);
5532
+ if (istask) {
5533
+ ischecked = istask[0] !== '[ ] ';
5534
+ itemContents = itemContents.replace(/^\[[ xX]\] +/, '');
5535
+ }
5536
+ }
5537
+ list.items.push({
5538
+ type: 'list_item',
5539
+ raw,
5540
+ task: !!istask,
5541
+ checked: ischecked,
5542
+ loose: false,
5543
+ text: itemContents,
5544
+ tokens: []
5545
+ });
5546
+ list.raw += raw;
5547
+ }
5548
+ // Do not consume newlines at end of final item. Alternatively, make itemRegex *start* with any newlines to simplify/speed up endsWithBlankLine logic
5549
+ list.items[list.items.length - 1].raw = raw.trimEnd();
5550
+ list.items[list.items.length - 1].text = itemContents.trimEnd();
5551
+ list.raw = list.raw.trimEnd();
5552
+ // Item child tokens handled here at end because we needed to have the final item to trim it first
5553
+ for (let i = 0; i < list.items.length; i++) {
5554
+ this.lexer.state.top = false;
5555
+ list.items[i].tokens = this.lexer.blockTokens(list.items[i].text, []);
5556
+ if (!list.loose) {
5557
+ // Check if list should be loose
5558
+ const spacers = list.items[i].tokens.filter(t => t.type === 'space');
5559
+ const hasMultipleLineBreaks = spacers.length > 0 && spacers.some(t => /\n.*\n/.test(t.raw));
5560
+ list.loose = hasMultipleLineBreaks;
5561
+ }
5562
+ }
5563
+ // Set all items to loose if list is loose
5564
+ if (list.loose) {
5565
+ for (let i = 0; i < list.items.length; i++) {
5566
+ list.items[i].loose = true;
5567
+ }
5568
+ }
5569
+ return list;
5570
+ }
5571
+ }
5572
+ html(src) {
5573
+ const cap = this.rules.block.html.exec(src);
5574
+ if (cap) {
5575
+ const token = {
5576
+ type: 'html',
5577
+ block: true,
5578
+ raw: cap[0],
5579
+ pre: cap[1] === 'pre' || cap[1] === 'script' || cap[1] === 'style',
5580
+ text: cap[0]
5581
+ };
5582
+ return token;
5583
+ }
5584
+ }
5585
+ def(src) {
5586
+ const cap = this.rules.block.def.exec(src);
5587
+ if (cap) {
5588
+ const tag = cap[1].toLowerCase().replace(/\s+/g, ' ');
5589
+ const href = cap[2] ? cap[2].replace(/^<(.*)>$/, '$1').replace(this.rules.inline._escapes, '$1') : '';
5590
+ const title = cap[3] ? cap[3].substring(1, cap[3].length - 1).replace(this.rules.inline._escapes, '$1') : cap[3];
5591
+ return {
5592
+ type: 'def',
5593
+ tag,
5594
+ raw: cap[0],
5595
+ href,
5596
+ title
5597
+ };
5598
+ }
5599
+ }
5600
+ table(src) {
5601
+ const cap = this.rules.block.table.exec(src);
5602
+ if (cap) {
5603
+ if (!/[:|]/.test(cap[2])) {
5604
+ // delimiter row must have a pipe (|) or colon (:) otherwise it is a setext heading
5605
+ return;
5606
+ }
5607
+ const item = {
5608
+ type: 'table',
5609
+ raw: cap[0],
5610
+ header: splitCells(cap[1]).map(c => {
5611
+ return {
5612
+ text: c,
5613
+ tokens: []
5614
+ };
5615
+ }),
5616
+ align: cap[2].replace(/^\||\| *$/g, '').split('|'),
5617
+ rows: cap[3] && cap[3].trim() ? cap[3].replace(/\n[ \t]*$/, '').split('\n') : []
5618
+ };
5619
+ if (item.header.length === item.align.length) {
5620
+ let l = item.align.length;
5621
+ let i, j, k, row;
5622
+ for (i = 0; i < l; i++) {
5623
+ const align = item.align[i];
5624
+ if (align) {
5625
+ if (/^ *-+: *$/.test(align)) {
5626
+ item.align[i] = 'right';
5627
+ } else if (/^ *:-+: *$/.test(align)) {
5628
+ item.align[i] = 'center';
5629
+ } else if (/^ *:-+ *$/.test(align)) {
5630
+ item.align[i] = 'left';
5631
+ } else {
5632
+ item.align[i] = null;
5633
+ }
5634
+ }
5635
+ }
5636
+ l = item.rows.length;
5637
+ for (i = 0; i < l; i++) {
5638
+ item.rows[i] = splitCells(item.rows[i], item.header.length).map(c => {
5639
+ return {
5640
+ text: c,
5641
+ tokens: []
5642
+ };
5643
+ });
5644
+ }
5645
+ // parse child tokens inside headers and cells
5646
+ // header child tokens
5647
+ l = item.header.length;
5648
+ for (j = 0; j < l; j++) {
5649
+ item.header[j].tokens = this.lexer.inline(item.header[j].text);
5650
+ }
5651
+ // cell child tokens
5652
+ l = item.rows.length;
5653
+ for (j = 0; j < l; j++) {
5654
+ row = item.rows[j];
5655
+ for (k = 0; k < row.length; k++) {
5656
+ row[k].tokens = this.lexer.inline(row[k].text);
5657
+ }
5658
+ }
5659
+ return item;
5660
+ }
5661
+ }
5662
+ }
5663
+ lheading(src) {
5664
+ const cap = this.rules.block.lheading.exec(src);
5665
+ if (cap) {
5666
+ return {
5667
+ type: 'heading',
5668
+ raw: cap[0],
5669
+ depth: cap[2].charAt(0) === '=' ? 1 : 2,
5670
+ text: cap[1],
5671
+ tokens: this.lexer.inline(cap[1])
5672
+ };
5673
+ }
5674
+ }
5675
+ paragraph(src) {
5676
+ const cap = this.rules.block.paragraph.exec(src);
5677
+ if (cap) {
5678
+ const text = cap[1].charAt(cap[1].length - 1) === '\n' ? cap[1].slice(0, -1) : cap[1];
5679
+ return {
5680
+ type: 'paragraph',
5681
+ raw: cap[0],
5682
+ text,
5683
+ tokens: this.lexer.inline(text)
5684
+ };
5685
+ }
5686
+ }
5687
+ text(src) {
5688
+ const cap = this.rules.block.text.exec(src);
5689
+ if (cap) {
5690
+ return {
5691
+ type: 'text',
5692
+ raw: cap[0],
5693
+ text: cap[0],
5694
+ tokens: this.lexer.inline(cap[0])
5695
+ };
5696
+ }
5697
+ }
5698
+ escape(src) {
5699
+ const cap = this.rules.inline.escape.exec(src);
5700
+ if (cap) {
5701
+ return {
5702
+ type: 'escape',
5703
+ raw: cap[0],
5704
+ text: escape(cap[1])
5705
+ };
5706
+ }
5707
+ }
5708
+ tag(src) {
5709
+ const cap = this.rules.inline.tag.exec(src);
5710
+ if (cap) {
5711
+ if (!this.lexer.state.inLink && /^<a /i.test(cap[0])) {
5712
+ this.lexer.state.inLink = true;
5713
+ } else if (this.lexer.state.inLink && /^<\/a>/i.test(cap[0])) {
5714
+ this.lexer.state.inLink = false;
5715
+ }
5716
+ if (!this.lexer.state.inRawBlock && /^<(pre|code|kbd|script)(\s|>)/i.test(cap[0])) {
5717
+ this.lexer.state.inRawBlock = true;
5718
+ } else if (this.lexer.state.inRawBlock && /^<\/(pre|code|kbd|script)(\s|>)/i.test(cap[0])) {
5719
+ this.lexer.state.inRawBlock = false;
5720
+ }
5721
+ return {
5722
+ type: 'html',
5723
+ raw: cap[0],
5724
+ inLink: this.lexer.state.inLink,
5725
+ inRawBlock: this.lexer.state.inRawBlock,
5726
+ block: false,
5727
+ text: cap[0]
5728
+ };
5729
+ }
5730
+ }
5731
+ link(src) {
5732
+ const cap = this.rules.inline.link.exec(src);
5733
+ if (cap) {
5734
+ const trimmedUrl = cap[2].trim();
5735
+ if (!this.options.pedantic && /^</.test(trimmedUrl)) {
5736
+ // commonmark requires matching angle brackets
5737
+ if (!/>$/.test(trimmedUrl)) {
5738
+ return;
5739
+ }
5740
+ // ending angle bracket cannot be escaped
5741
+ const rtrimSlash = rtrim(trimmedUrl.slice(0, -1), '\\');
5742
+ if ((trimmedUrl.length - rtrimSlash.length) % 2 === 0) {
5743
+ return;
5744
+ }
5745
+ } else {
5746
+ // find closing parenthesis
5747
+ const lastParenIndex = findClosingBracket(cap[2], '()');
5748
+ if (lastParenIndex > -1) {
5749
+ const start = cap[0].indexOf('!') === 0 ? 5 : 4;
5750
+ const linkLen = start + cap[1].length + lastParenIndex;
5751
+ cap[2] = cap[2].substring(0, lastParenIndex);
5752
+ cap[0] = cap[0].substring(0, linkLen).trim();
5753
+ cap[3] = '';
5754
+ }
5755
+ }
5756
+ let href = cap[2];
5757
+ let title = '';
5758
+ if (this.options.pedantic) {
5759
+ // split pedantic href and title
5760
+ const link = /^([^'"]*[^\s])\s+(['"])(.*)\2/.exec(href);
5761
+ if (link) {
5762
+ href = link[1];
5763
+ title = link[3];
5764
+ }
5765
+ } else {
5766
+ title = cap[3] ? cap[3].slice(1, -1) : '';
5767
+ }
5768
+ href = href.trim();
5769
+ if (/^</.test(href)) {
5770
+ if (this.options.pedantic && !/>$/.test(trimmedUrl)) {
5771
+ // pedantic allows starting angle bracket without ending angle bracket
5772
+ href = href.slice(1);
5773
+ } else {
5774
+ href = href.slice(1, -1);
5775
+ }
5776
+ }
5777
+ return outputLink(cap, {
5778
+ href: href ? href.replace(this.rules.inline._escapes, '$1') : href,
5779
+ title: title ? title.replace(this.rules.inline._escapes, '$1') : title
5780
+ }, cap[0], this.lexer);
5781
+ }
5782
+ }
5783
+ reflink(src, links) {
5784
+ let cap;
5785
+ if ((cap = this.rules.inline.reflink.exec(src)) || (cap = this.rules.inline.nolink.exec(src))) {
5786
+ let link = (cap[2] || cap[1]).replace(/\s+/g, ' ');
5787
+ link = links[link.toLowerCase()];
5788
+ if (!link) {
5789
+ const text = cap[0].charAt(0);
5790
+ return {
5791
+ type: 'text',
5792
+ raw: text,
5793
+ text
5794
+ };
5795
+ }
5796
+ return outputLink(cap, link, cap[0], this.lexer);
5797
+ }
5798
+ }
5799
+ emStrong(src, maskedSrc) {
5800
+ let prevChar = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : '';
5801
+ let match = this.rules.inline.emStrong.lDelim.exec(src);
5802
+ if (!match) return;
5803
+ // _ can't be between two alphanumerics. \p{L}\p{N} includes non-english alphabet/numbers as well
5804
+ if (match[3] && prevChar.match(/[\p{L}\p{N}]/u)) return;
5805
+ const nextChar = match[1] || match[2] || '';
5806
+ if (!nextChar || !prevChar || this.rules.inline.punctuation.exec(prevChar)) {
5807
+ // unicode Regex counts emoji as 1 char; spread into array for proper count (used multiple times below)
5808
+ const lLength = [...match[0]].length - 1;
5809
+ let rDelim,
5810
+ rLength,
5811
+ delimTotal = lLength,
5812
+ midDelimTotal = 0;
5813
+ const endReg = match[0][0] === '*' ? this.rules.inline.emStrong.rDelimAst : this.rules.inline.emStrong.rDelimUnd;
5814
+ endReg.lastIndex = 0;
5815
+ // Clip maskedSrc to same section of string as src (move to lexer?)
5816
+ maskedSrc = maskedSrc.slice(-1 * src.length + match[0].length - 1);
5817
+ while ((match = endReg.exec(maskedSrc)) != null) {
5818
+ rDelim = match[1] || match[2] || match[3] || match[4] || match[5] || match[6];
5819
+ if (!rDelim) continue; // skip single * in __abc*abc__
5820
+ rLength = [...rDelim].length;
5821
+ if (match[3] || match[4]) {
5822
+ // found another Left Delim
5823
+ delimTotal += rLength;
5824
+ continue;
5825
+ } else if (match[5] || match[6]) {
5826
+ // either Left or Right Delim
5827
+ if (lLength % 3 && !((lLength + rLength) % 3)) {
5828
+ midDelimTotal += rLength;
5829
+ continue; // CommonMark Emphasis Rules 9-10
5830
+ }
5831
+ }
5832
+
5833
+ delimTotal -= rLength;
5834
+ if (delimTotal > 0) continue; // Haven't found enough closing delimiters
5835
+ // Remove extra characters. *a*** -> *a*
5836
+ rLength = Math.min(rLength, rLength + delimTotal + midDelimTotal);
5837
+ const raw = [...src].slice(0, lLength + match.index + rLength + 1).join('');
5838
+ // Create `em` if smallest delimiter has odd char count. *a***
5839
+ if (Math.min(lLength, rLength) % 2) {
5840
+ const text = raw.slice(1, -1);
5841
+ return {
5842
+ type: 'em',
5843
+ raw,
5844
+ text,
5845
+ tokens: this.lexer.inlineTokens(text)
5846
+ };
5847
+ }
5848
+ // Create 'strong' if smallest delimiter has even char count. **a***
5849
+ const text = raw.slice(2, -2);
5850
+ return {
5851
+ type: 'strong',
5852
+ raw,
5853
+ text,
5854
+ tokens: this.lexer.inlineTokens(text)
5855
+ };
5856
+ }
5857
+ }
5858
+ }
5859
+ codespan(src) {
5860
+ const cap = this.rules.inline.code.exec(src);
5861
+ if (cap) {
5862
+ let text = cap[2].replace(/\n/g, ' ');
5863
+ const hasNonSpaceChars = /[^ ]/.test(text);
5864
+ const hasSpaceCharsOnBothEnds = /^ /.test(text) && / $/.test(text);
5865
+ if (hasNonSpaceChars && hasSpaceCharsOnBothEnds) {
5866
+ text = text.substring(1, text.length - 1);
5867
+ }
5868
+ text = escape(text, true);
5869
+ return {
5870
+ type: 'codespan',
5871
+ raw: cap[0],
5872
+ text
5873
+ };
5874
+ }
5875
+ }
5876
+ br(src) {
5877
+ const cap = this.rules.inline.br.exec(src);
5878
+ if (cap) {
5879
+ return {
5880
+ type: 'br',
5881
+ raw: cap[0]
5882
+ };
5883
+ }
5884
+ }
5885
+ del(src) {
5886
+ const cap = this.rules.inline.del.exec(src);
5887
+ if (cap) {
5888
+ return {
5889
+ type: 'del',
5890
+ raw: cap[0],
5891
+ text: cap[2],
5892
+ tokens: this.lexer.inlineTokens(cap[2])
5893
+ };
5894
+ }
5895
+ }
5896
+ autolink(src) {
5897
+ const cap = this.rules.inline.autolink.exec(src);
5898
+ if (cap) {
5899
+ let text, href;
5900
+ if (cap[2] === '@') {
5901
+ text = escape(cap[1]);
5902
+ href = 'mailto:' + text;
5903
+ } else {
5904
+ text = escape(cap[1]);
5905
+ href = text;
5906
+ }
5907
+ return {
5908
+ type: 'link',
5909
+ raw: cap[0],
5910
+ text,
5911
+ href,
5912
+ tokens: [{
5913
+ type: 'text',
5914
+ raw: text,
5915
+ text
5916
+ }]
5917
+ };
5918
+ }
5919
+ }
5920
+ url(src) {
5921
+ let cap;
5922
+ if (cap = this.rules.inline.url.exec(src)) {
5923
+ let text, href;
5924
+ if (cap[2] === '@') {
5925
+ text = escape(cap[0]);
5926
+ href = 'mailto:' + text;
5927
+ } else {
5928
+ // do extended autolink path validation
5929
+ let prevCapZero;
5930
+ do {
5931
+ prevCapZero = cap[0];
5932
+ cap[0] = this.rules.inline._backpedal.exec(cap[0])[0];
5933
+ } while (prevCapZero !== cap[0]);
5934
+ text = escape(cap[0]);
5935
+ if (cap[1] === 'www.') {
5936
+ href = 'http://' + cap[0];
5937
+ } else {
5938
+ href = cap[0];
5939
+ }
5940
+ }
5941
+ return {
5942
+ type: 'link',
5943
+ raw: cap[0],
5944
+ text,
5945
+ href,
5946
+ tokens: [{
5947
+ type: 'text',
5948
+ raw: text,
5949
+ text
5950
+ }]
5951
+ };
5952
+ }
5953
+ }
5954
+ inlineText(src) {
5955
+ const cap = this.rules.inline.text.exec(src);
5956
+ if (cap) {
5957
+ let text;
5958
+ if (this.lexer.state.inRawBlock) {
5959
+ text = cap[0];
5960
+ } else {
5961
+ text = escape(cap[0]);
5962
+ }
5963
+ return {
5964
+ type: 'text',
5965
+ raw: cap[0],
5966
+ text
5967
+ };
5968
+ }
5969
+ }
5970
+ }
5971
+
5972
+ /**
5973
+ * Block-Level Grammar
5974
+ */
5975
+ // Not all rules are defined in the object literal
5976
+ // @ts-expect-error
5977
+ const block = {
5978
+ newline: /^(?: *(?:\n|$))+/,
5979
+ code: /^( {4}[^\n]+(?:\n(?: *(?:\n|$))*)?)+/,
5980
+ fences: /^ {0,3}(`{3,}(?=[^`\n]*(?:\n|$))|~{3,})([^\n]*)(?:\n|$)(?:|([\s\S]*?)(?:\n|$))(?: {0,3}\1[~`]* *(?=\n|$)|$)/,
5981
+ hr: /^ {0,3}((?:-[\t ]*){3,}|(?:_[ \t]*){3,}|(?:\*[ \t]*){3,})(?:\n+|$)/,
5982
+ heading: /^ {0,3}(#{1,6})(?=\s|$)(.*)(?:\n+|$)/,
5983
+ blockquote: /^( {0,3}> ?(paragraph|[^\n]*)(?:\n|$))+/,
5984
+ list: /^( {0,3}bull)([ \t][^\n]+?)?(?:\n|$)/,
5985
+ html: '^ {0,3}(?:' // optional indentation
5986
+ + '<(script|pre|style|textarea)[\\s>][\\s\\S]*?(?:</\\1>[^\\n]*\\n+|$)' // (1)
5987
+ + '|comment[^\\n]*(\\n+|$)' // (2)
5988
+ + '|<\\?[\\s\\S]*?(?:\\?>\\n*|$)' // (3)
5989
+ + '|<![A-Z][\\s\\S]*?(?:>\\n*|$)' // (4)
5990
+ + '|<!\\[CDATA\\[[\\s\\S]*?(?:\\]\\]>\\n*|$)' // (5)
5991
+ + '|</?(tag)(?: +|\\n|/?>)[\\s\\S]*?(?:(?:\\n *)+\\n|$)' // (6)
5992
+ + '|<(?!script|pre|style|textarea)([a-z][\\w-]*)(?:attribute)*? */?>(?=[ \\t]*(?:\\n|$))[\\s\\S]*?(?:(?:\\n *)+\\n|$)' // (7) open tag
5993
+ + '|</(?!script|pre|style|textarea)[a-z][\\w-]*\\s*>(?=[ \\t]*(?:\\n|$))[\\s\\S]*?(?:(?:\\n *)+\\n|$)' // (7) closing tag
5994
+ + ')',
5995
+ def: /^ {0,3}\[(label)\]: *(?:\n *)?([^<\s][^\s]*|<.*?>)(?:(?: +(?:\n *)?| *\n *)(title))? *(?:\n+|$)/,
5996
+ table: noopTest,
5997
+ lheading: /^(?!bull )((?:.|\n(?!\s*?\n|bull ))+?)\n {0,3}(=+|-+) *(?:\n+|$)/,
5998
+ // regex template, placeholders will be replaced according to different paragraph
5999
+ // interruption rules of commonmark and the original markdown spec:
6000
+ _paragraph: /^([^\n]+(?:\n(?!hr|heading|lheading|blockquote|fences|list|html|table| +\n)[^\n]+)*)/,
6001
+ text: /^[^\n]+/
6002
+ };
6003
+ block._label = /(?!\s*\])(?:\\.|[^\[\]\\])+/;
6004
+ block._title = /(?:"(?:\\"?|[^"\\])*"|'[^'\n]*(?:\n[^'\n]+)*\n?'|\([^()]*\))/;
6005
+ block.def = edit(block.def).replace('label', block._label).replace('title', block._title).getRegex();
6006
+ block.bullet = /(?:[*+-]|\d{1,9}[.)])/;
6007
+ block.listItemStart = edit(/^( *)(bull) */).replace('bull', block.bullet).getRegex();
6008
+ block.list = edit(block.list).replace(/bull/g, block.bullet).replace('hr', '\\n+(?=\\1?(?:(?:- *){3,}|(?:_ *){3,}|(?:\\* *){3,})(?:\\n+|$))').replace('def', '\\n+(?=' + block.def.source + ')').getRegex();
6009
+ block._tag = '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|section|source|summary|table|tbody|td|tfoot|th|thead|title|tr' + '|track|ul';
6010
+ block._comment = /<!--(?!-?>)[\s\S]*?(?:-->|$)/;
6011
+ block.html = edit(block.html, 'i').replace('comment', block._comment).replace('tag', block._tag).replace('attribute', / +[a-zA-Z:_][\w.:-]*(?: *= *"[^"\n]*"| *= *'[^'\n]*'| *= *[^\s"'=<>`]+)?/).getRegex();
6012
+ block.lheading = edit(block.lheading).replace(/bull/g, block.bullet) // lists can interrupt
6013
+ .getRegex();
6014
+ block.paragraph = edit(block._paragraph).replace('hr', block.hr).replace('heading', ' {0,3}#{1,6} ').replace('|lheading', '') // setex headings don't interrupt commonmark paragraphs
6015
+ .replace('|table', '').replace('blockquote', ' {0,3}>').replace('fences', ' {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n').replace('list', ' {0,3}(?:[*+-]|1[.)]) ') // only lists starting from 1 can interrupt
6016
+ .replace('html', '</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|textarea|!--)').replace('tag', block._tag) // pars can be interrupted by type (6) html blocks
6017
+ .getRegex();
6018
+ block.blockquote = edit(block.blockquote).replace('paragraph', block.paragraph).getRegex();
6019
+ /**
6020
+ * Normal Block Grammar
6021
+ */
6022
+ block.normal = {
6023
+ ...block
6024
+ };
6025
+ /**
6026
+ * GFM Block Grammar
6027
+ */
6028
+ block.gfm = {
6029
+ ...block.normal,
6030
+ table: '^ *([^\\n ].*)\\n' // Header
6031
+ + ' {0,3}((?:\\| *)?:?-+:? *(?:\\| *:?-+:? *)*(?:\\| *)?)' // Align
6032
+ + '(?:\\n((?:(?! *\\n|hr|heading|blockquote|code|fences|list|html).*(?:\\n|$))*)\\n*|$)' // Cells
6033
+ };
6034
+
6035
+ block.gfm.table = edit(block.gfm.table).replace('hr', block.hr).replace('heading', ' {0,3}#{1,6} ').replace('blockquote', ' {0,3}>').replace('code', ' {4}[^\\n]').replace('fences', ' {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n').replace('list', ' {0,3}(?:[*+-]|1[.)]) ') // only lists starting from 1 can interrupt
6036
+ .replace('html', '</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|textarea|!--)').replace('tag', block._tag) // tables can be interrupted by type (6) html blocks
6037
+ .getRegex();
6038
+ block.gfm.paragraph = edit(block._paragraph).replace('hr', block.hr).replace('heading', ' {0,3}#{1,6} ').replace('|lheading', '') // setex headings don't interrupt commonmark paragraphs
6039
+ .replace('table', block.gfm.table) // interrupt paragraphs with table
6040
+ .replace('blockquote', ' {0,3}>').replace('fences', ' {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n').replace('list', ' {0,3}(?:[*+-]|1[.)]) ') // only lists starting from 1 can interrupt
6041
+ .replace('html', '</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|textarea|!--)').replace('tag', block._tag) // pars can be interrupted by type (6) html blocks
6042
+ .getRegex();
6043
+ /**
6044
+ * Pedantic grammar (original John Gruber's loose markdown specification)
6045
+ */
6046
+ block.pedantic = {
6047
+ ...block.normal,
6048
+ html: edit('^ *(?:comment *(?:\\n|\\s*$)' + '|<(tag)[\\s\\S]+?</\\1> *(?:\\n{2,}|\\s*$)' // closed tag
6049
+ + '|<tag(?:"[^"]*"|\'[^\']*\'|\\s[^\'"/>\\s]*)*?/?> *(?:\\n{2,}|\\s*$))').replace('comment', block._comment).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(),
6050
+ def: /^ *\[([^\]]+)\]: *<?([^\s>]+)>?(?: +(["(][^\n]+[")]))? *(?:\n+|$)/,
6051
+ heading: /^(#{1,6})(.*)(?:\n+|$)/,
6052
+ fences: noopTest,
6053
+ lheading: /^(.+?)\n {0,3}(=+|-+) *(?:\n+|$)/,
6054
+ paragraph: edit(block.normal._paragraph).replace('hr', block.hr).replace('heading', ' *#{1,6} *[^\n]').replace('lheading', block.lheading).replace('blockquote', ' {0,3}>').replace('|fences', '').replace('|list', '').replace('|html', '').getRegex()
6055
+ };
6056
+ /**
6057
+ * Inline-Level Grammar
6058
+ */
6059
+ // Not all rules are defined in the object literal
6060
+ // @ts-expect-error
6061
+ const inline = {
6062
+ escape: /^\\([!"#$%&'()*+,\-./:;<=>?@\[\]\\^_`{|}~])/,
6063
+ autolink: /^<(scheme:[^\s\x00-\x1f<>]*|email)>/,
6064
+ url: noopTest,
6065
+ tag: '^comment' + '|^</[a-zA-Z][\\w:-]*\\s*>' // self-closing tag
6066
+ + '|^<[a-zA-Z][\\w-]*(?:attribute)*?\\s*/?>' // open tag
6067
+ + '|^<\\?[\\s\\S]*?\\?>' // processing instruction, e.g. <?php ?>
6068
+ + '|^<![a-zA-Z]+\\s[\\s\\S]*?>' // declaration, e.g. <!DOCTYPE html>
6069
+ + '|^<!\\[CDATA\\[[\\s\\S]*?\\]\\]>',
6070
+ link: /^!?\[(label)\]\(\s*(href)(?:\s+(title))?\s*\)/,
6071
+ reflink: /^!?\[(label)\]\[(ref)\]/,
6072
+ nolink: /^!?\[(ref)\](?:\[\])?/,
6073
+ reflinkSearch: 'reflink|nolink(?!\\()',
6074
+ emStrong: {
6075
+ lDelim: /^(?:\*+(?:((?!\*)[punct])|[^\s*]))|^_+(?:((?!_)[punct])|([^\s_]))/,
6076
+ // (1) and (2) can only be a Right Delimiter. (3) and (4) can only be Left. (5) and (6) can be either Left or Right.
6077
+ // | Skip orphan inside strong | Consume to delim | (1) #*** | (2) a***#, a*** | (3) #***a, ***a | (4) ***# | (5) #***# | (6) a***a
6078
+ rDelimAst: /^[^_*]*?__[^_*]*?\*[^_*]*?(?=__)|[^*]+(?=[^*])|(?!\*)[punct](\*+)(?=[\s]|$)|[^punct\s](\*+)(?!\*)(?=[punct\s]|$)|(?!\*)[punct\s](\*+)(?=[^punct\s])|[\s](\*+)(?!\*)(?=[punct])|(?!\*)[punct](\*+)(?!\*)(?=[punct])|[^punct\s](\*+)(?=[^punct\s])/,
6079
+ rDelimUnd: /^[^_*]*?\*\*[^_*]*?_[^_*]*?(?=\*\*)|[^_]+(?=[^_])|(?!_)[punct](_+)(?=[\s]|$)|[^punct\s](_+)(?!_)(?=[punct\s]|$)|(?!_)[punct\s](_+)(?=[^punct\s])|[\s](_+)(?!_)(?=[punct])|(?!_)[punct](_+)(?!_)(?=[punct])/ // ^- Not allowed for _
6080
+ },
6081
+
6082
+ code: /^(`+)([^`]|[^`][\s\S]*?[^`])\1(?!`)/,
6083
+ br: /^( {2,}|\\)\n(?!\s*$)/,
6084
+ del: noopTest,
6085
+ text: /^(`+|[^`])(?:(?= {2,}\n)|[\s\S]*?(?:(?=[\\<!\[`*_]|\b_|$)|[^ ](?= {2,}\n)))/,
6086
+ punctuation: /^((?![*_])[\spunctuation])/
6087
+ };
6088
+ // list of unicode punctuation marks, plus any missing characters from CommonMark spec
6089
+ inline._punctuation = '\\p{P}$+<=>`^|~';
6090
+ inline.punctuation = edit(inline.punctuation, 'u').replace(/punctuation/g, inline._punctuation).getRegex();
6091
+ // sequences em should skip over [title](link), `code`, <html>
6092
+ inline.blockSkip = /\[[^[\]]*?\]\([^\(\)]*?\)|`[^`]*?`|<[^<>]*?>/g;
6093
+ inline.anyPunctuation = /\\[punct]/g;
6094
+ inline._escapes = /\\([punct])/g;
6095
+ inline._comment = edit(block._comment).replace('(?:-->|$)', '-->').getRegex();
6096
+ inline.emStrong.lDelim = edit(inline.emStrong.lDelim, 'u').replace(/punct/g, inline._punctuation).getRegex();
6097
+ inline.emStrong.rDelimAst = edit(inline.emStrong.rDelimAst, 'gu').replace(/punct/g, inline._punctuation).getRegex();
6098
+ inline.emStrong.rDelimUnd = edit(inline.emStrong.rDelimUnd, 'gu').replace(/punct/g, inline._punctuation).getRegex();
6099
+ inline.anyPunctuation = edit(inline.anyPunctuation, 'gu').replace(/punct/g, inline._punctuation).getRegex();
6100
+ inline._escapes = edit(inline._escapes, 'gu').replace(/punct/g, inline._punctuation).getRegex();
6101
+ inline._scheme = /[a-zA-Z][a-zA-Z0-9+.-]{1,31}/;
6102
+ inline._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])?)+(?![-_])/;
6103
+ inline.autolink = edit(inline.autolink).replace('scheme', inline._scheme).replace('email', inline._email).getRegex();
6104
+ inline._attribute = /\s+[a-zA-Z:_][\w.:-]*(?:\s*=\s*"[^"]*"|\s*=\s*'[^']*'|\s*=\s*[^\s"'=<>`]+)?/;
6105
+ inline.tag = edit(inline.tag).replace('comment', inline._comment).replace('attribute', inline._attribute).getRegex();
6106
+ inline._label = /(?:\[(?:\\.|[^\[\]\\])*\]|\\.|`[^`]*`|[^\[\]\\`])*?/;
6107
+ inline._href = /<(?:\\.|[^\n<>\\])+>|[^\s\x00-\x1f]*/;
6108
+ inline._title = /"(?:\\"?|[^"\\])*"|'(?:\\'?|[^'\\])*'|\((?:\\\)?|[^)\\])*\)/;
6109
+ inline.link = edit(inline.link).replace('label', inline._label).replace('href', inline._href).replace('title', inline._title).getRegex();
6110
+ inline.reflink = edit(inline.reflink).replace('label', inline._label).replace('ref', block._label).getRegex();
6111
+ inline.nolink = edit(inline.nolink).replace('ref', block._label).getRegex();
6112
+ inline.reflinkSearch = edit(inline.reflinkSearch, 'g').replace('reflink', inline.reflink).replace('nolink', inline.nolink).getRegex();
6113
+ /**
6114
+ * Normal Inline Grammar
6115
+ */
6116
+ inline.normal = {
6117
+ ...inline
6118
+ };
6119
+ /**
6120
+ * Pedantic Inline Grammar
6121
+ */
6122
+ inline.pedantic = {
6123
+ ...inline.normal,
6124
+ strong: {
6125
+ start: /^__|\*\*/,
6126
+ middle: /^__(?=\S)([\s\S]*?\S)__(?!_)|^\*\*(?=\S)([\s\S]*?\S)\*\*(?!\*)/,
6127
+ endAst: /\*\*(?!\*)/g,
6128
+ endUnd: /__(?!_)/g
6129
+ },
6130
+ em: {
6131
+ start: /^_|\*/,
6132
+ middle: /^()\*(?=\S)([\s\S]*?\S)\*(?!\*)|^_(?=\S)([\s\S]*?\S)_(?!_)/,
6133
+ endAst: /\*(?!\*)/g,
6134
+ endUnd: /_(?!_)/g
6135
+ },
6136
+ link: edit(/^!?\[(label)\]\((.*?)\)/).replace('label', inline._label).getRegex(),
6137
+ reflink: edit(/^!?\[(label)\]\s*\[([^\]]*)\]/).replace('label', inline._label).getRegex()
6138
+ };
6139
+ /**
6140
+ * GFM Inline Grammar
6141
+ */
6142
+ inline.gfm = {
6143
+ ...inline.normal,
6144
+ escape: edit(inline.escape).replace('])', '~|])').getRegex(),
6145
+ _extended_email: /[A-Za-z0-9._+-]+(@)[a-zA-Z0-9-_]+(?:\.[a-zA-Z0-9-_]*[a-zA-Z0-9])+(?![-_])/,
6146
+ url: /^((?:ftp|https?):\/\/|www\.)(?:[a-zA-Z0-9\-]+\.?)+[^\s<]*|^email/,
6147
+ _backpedal: /(?:[^?!.,:;*_'"~()&]+|\([^)]*\)|&(?![a-zA-Z0-9]+;$)|[?!.,:;*_'"~)]+(?!$))+/,
6148
+ del: /^(~~?)(?=[^\s~])([\s\S]*?[^\s~])\1(?=[^~]|$)/,
6149
+ text: /^([`~]+|[^`~])(?:(?= {2,}\n)|(?=[a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-]+@)|[\s\S]*?(?:(?=[\\<!\[`*~_]|\b_|https?:\/\/|ftp:\/\/|www\.|$)|[^ ](?= {2,}\n)|[^a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-](?=[a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-]+@)))/
6150
+ };
6151
+ inline.gfm.url = edit(inline.gfm.url, 'i').replace('email', inline.gfm._extended_email).getRegex();
6152
+ /**
6153
+ * GFM + Line Breaks Inline Grammar
6154
+ */
6155
+ inline.breaks = {
6156
+ ...inline.gfm,
6157
+ br: edit(inline.br).replace('{2,}', '*').getRegex(),
6158
+ text: edit(inline.gfm.text).replace('\\b_', '\\b_| {2,}\\n').replace(/\{2,\}/g, '*').getRegex()
6159
+ };
6160
+
6161
+ /**
6162
+ * Block Lexer
6163
+ */
6164
+ class _Lexer {
6165
+ tokens;
6166
+ options;
6167
+ state;
6168
+ tokenizer;
6169
+ inlineQueue;
6170
+ constructor(options) {
6171
+ // TokenList cannot be created in one go
6172
+ // @ts-expect-error
6173
+ this.tokens = [];
6174
+ this.tokens.links = Object.create(null);
6175
+ this.options = options || _defaults;
6176
+ this.options.tokenizer = this.options.tokenizer || new _Tokenizer();
6177
+ this.tokenizer = this.options.tokenizer;
6178
+ this.tokenizer.options = this.options;
6179
+ this.tokenizer.lexer = this;
6180
+ this.inlineQueue = [];
6181
+ this.state = {
6182
+ inLink: false,
6183
+ inRawBlock: false,
6184
+ top: true
6185
+ };
6186
+ const rules = {
6187
+ block: block.normal,
6188
+ inline: inline.normal
6189
+ };
6190
+ if (this.options.pedantic) {
6191
+ rules.block = block.pedantic;
6192
+ rules.inline = inline.pedantic;
6193
+ } else if (this.options.gfm) {
6194
+ rules.block = block.gfm;
6195
+ if (this.options.breaks) {
6196
+ rules.inline = inline.breaks;
6197
+ } else {
6198
+ rules.inline = inline.gfm;
6199
+ }
6200
+ }
6201
+ this.tokenizer.rules = rules;
6202
+ }
6203
+ /**
6204
+ * Expose Rules
6205
+ */
6206
+ static get rules() {
6207
+ return {
6208
+ block,
6209
+ inline
6210
+ };
6211
+ }
6212
+ /**
6213
+ * Static Lex Method
6214
+ */
6215
+ static lex(src, options) {
6216
+ const lexer = new _Lexer(options);
6217
+ return lexer.lex(src);
6218
+ }
6219
+ /**
6220
+ * Static Lex Inline Method
6221
+ */
6222
+ static lexInline(src, options) {
6223
+ const lexer = new _Lexer(options);
6224
+ return lexer.inlineTokens(src);
6225
+ }
6226
+ /**
6227
+ * Preprocessing
6228
+ */
6229
+ lex(src) {
6230
+ src = src.replace(/\r\n|\r/g, '\n');
6231
+ this.blockTokens(src, this.tokens);
6232
+ let next;
6233
+ while (next = this.inlineQueue.shift()) {
6234
+ this.inlineTokens(next.src, next.tokens);
6235
+ }
6236
+ return this.tokens;
6237
+ }
6238
+ blockTokens(src) {
6239
+ let tokens = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : [];
6240
+ if (this.options.pedantic) {
6241
+ src = src.replace(/\t/g, ' ').replace(/^ +$/gm, '');
6242
+ } else {
6243
+ src = src.replace(/^( *)(\t+)/gm, (_, leading, tabs) => {
6244
+ return leading + ' '.repeat(tabs.length);
6245
+ });
6246
+ }
6247
+ let token;
6248
+ let lastToken;
6249
+ let cutSrc;
6250
+ let lastParagraphClipped;
6251
+ while (src) {
6252
+ if (this.options.extensions && this.options.extensions.block && this.options.extensions.block.some(extTokenizer => {
6253
+ if (token = extTokenizer.call({
6254
+ lexer: this
6255
+ }, src, tokens)) {
6256
+ src = src.substring(token.raw.length);
6257
+ tokens.push(token);
6258
+ return true;
6259
+ }
6260
+ return false;
6261
+ })) {
6262
+ continue;
6263
+ }
6264
+ // newline
6265
+ if (token = this.tokenizer.space(src)) {
6266
+ src = src.substring(token.raw.length);
6267
+ if (token.raw.length === 1 && tokens.length > 0) {
6268
+ // if there's a single \n as a spacer, it's terminating the last line,
6269
+ // so move it there so that we don't get unecessary paragraph tags
6270
+ tokens[tokens.length - 1].raw += '\n';
6271
+ } else {
6272
+ tokens.push(token);
6273
+ }
6274
+ continue;
6275
+ }
6276
+ // code
6277
+ if (token = this.tokenizer.code(src)) {
6278
+ src = src.substring(token.raw.length);
6279
+ lastToken = tokens[tokens.length - 1];
6280
+ // An indented code block cannot interrupt a paragraph.
6281
+ if (lastToken && (lastToken.type === 'paragraph' || lastToken.type === 'text')) {
6282
+ lastToken.raw += '\n' + token.raw;
6283
+ lastToken.text += '\n' + token.text;
6284
+ this.inlineQueue[this.inlineQueue.length - 1].src = lastToken.text;
6285
+ } else {
6286
+ tokens.push(token);
6287
+ }
6288
+ continue;
6289
+ }
6290
+ // fences
6291
+ if (token = this.tokenizer.fences(src)) {
6292
+ src = src.substring(token.raw.length);
6293
+ tokens.push(token);
6294
+ continue;
6295
+ }
6296
+ // heading
6297
+ if (token = this.tokenizer.heading(src)) {
6298
+ src = src.substring(token.raw.length);
6299
+ tokens.push(token);
6300
+ continue;
6301
+ }
6302
+ // hr
6303
+ if (token = this.tokenizer.hr(src)) {
6304
+ src = src.substring(token.raw.length);
6305
+ tokens.push(token);
6306
+ continue;
6307
+ }
6308
+ // blockquote
6309
+ if (token = this.tokenizer.blockquote(src)) {
6310
+ src = src.substring(token.raw.length);
6311
+ tokens.push(token);
6312
+ continue;
6313
+ }
6314
+ // list
6315
+ if (token = this.tokenizer.list(src)) {
6316
+ src = src.substring(token.raw.length);
6317
+ tokens.push(token);
6318
+ continue;
6319
+ }
6320
+ // html
6321
+ if (token = this.tokenizer.html(src)) {
6322
+ src = src.substring(token.raw.length);
6323
+ tokens.push(token);
6324
+ continue;
6325
+ }
6326
+ // def
6327
+ if (token = this.tokenizer.def(src)) {
6328
+ src = src.substring(token.raw.length);
6329
+ lastToken = tokens[tokens.length - 1];
6330
+ if (lastToken && (lastToken.type === 'paragraph' || lastToken.type === 'text')) {
6331
+ lastToken.raw += '\n' + token.raw;
6332
+ lastToken.text += '\n' + token.raw;
6333
+ this.inlineQueue[this.inlineQueue.length - 1].src = lastToken.text;
6334
+ } else if (!this.tokens.links[token.tag]) {
6335
+ this.tokens.links[token.tag] = {
6336
+ href: token.href,
6337
+ title: token.title
6338
+ };
6339
+ }
6340
+ continue;
6341
+ }
6342
+ // table (gfm)
6343
+ if (token = this.tokenizer.table(src)) {
6344
+ src = src.substring(token.raw.length);
6345
+ tokens.push(token);
6346
+ continue;
6347
+ }
6348
+ // lheading
6349
+ if (token = this.tokenizer.lheading(src)) {
6350
+ src = src.substring(token.raw.length);
6351
+ tokens.push(token);
6352
+ continue;
6353
+ }
6354
+ // top-level paragraph
6355
+ // prevent paragraph consuming extensions by clipping 'src' to extension start
6356
+ cutSrc = src;
6357
+ if (this.options.extensions && this.options.extensions.startBlock) {
6358
+ let startIndex = Infinity;
6359
+ const tempSrc = src.slice(1);
6360
+ let tempStart;
6361
+ this.options.extensions.startBlock.forEach(getStartIndex => {
6362
+ tempStart = getStartIndex.call({
6363
+ lexer: this
6364
+ }, tempSrc);
6365
+ if (typeof tempStart === 'number' && tempStart >= 0) {
6366
+ startIndex = Math.min(startIndex, tempStart);
6367
+ }
6368
+ });
6369
+ if (startIndex < Infinity && startIndex >= 0) {
6370
+ cutSrc = src.substring(0, startIndex + 1);
6371
+ }
6372
+ }
6373
+ if (this.state.top && (token = this.tokenizer.paragraph(cutSrc))) {
6374
+ lastToken = tokens[tokens.length - 1];
6375
+ if (lastParagraphClipped && lastToken.type === 'paragraph') {
6376
+ lastToken.raw += '\n' + token.raw;
6377
+ lastToken.text += '\n' + token.text;
6378
+ this.inlineQueue.pop();
6379
+ this.inlineQueue[this.inlineQueue.length - 1].src = lastToken.text;
6380
+ } else {
6381
+ tokens.push(token);
6382
+ }
6383
+ lastParagraphClipped = cutSrc.length !== src.length;
6384
+ src = src.substring(token.raw.length);
6385
+ continue;
6386
+ }
6387
+ // text
6388
+ if (token = this.tokenizer.text(src)) {
6389
+ src = src.substring(token.raw.length);
6390
+ lastToken = tokens[tokens.length - 1];
6391
+ if (lastToken && lastToken.type === 'text') {
6392
+ lastToken.raw += '\n' + token.raw;
6393
+ lastToken.text += '\n' + token.text;
6394
+ this.inlineQueue.pop();
6395
+ this.inlineQueue[this.inlineQueue.length - 1].src = lastToken.text;
6396
+ } else {
6397
+ tokens.push(token);
6398
+ }
6399
+ continue;
6400
+ }
6401
+ if (src) {
6402
+ const errMsg = 'Infinite loop on byte: ' + src.charCodeAt(0);
6403
+ if (this.options.silent) {
6404
+ console.error(errMsg);
6405
+ break;
6406
+ } else {
6407
+ throw new Error(errMsg);
6408
+ }
6409
+ }
6410
+ }
6411
+ this.state.top = true;
6412
+ return tokens;
6413
+ }
6414
+ inline(src) {
6415
+ let tokens = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : [];
6416
+ this.inlineQueue.push({
6417
+ src,
6418
+ tokens
6419
+ });
6420
+ return tokens;
6421
+ }
6422
+ /**
6423
+ * Lexing/Compiling
6424
+ */
6425
+ inlineTokens(src) {
6426
+ let tokens = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : [];
6427
+ let token, lastToken, cutSrc;
6428
+ // String with links masked to avoid interference with em and strong
6429
+ let maskedSrc = src;
6430
+ let match;
6431
+ let keepPrevChar, prevChar;
6432
+ // Mask out reflinks
6433
+ if (this.tokens.links) {
6434
+ const links = Object.keys(this.tokens.links);
6435
+ if (links.length > 0) {
6436
+ while ((match = this.tokenizer.rules.inline.reflinkSearch.exec(maskedSrc)) != null) {
6437
+ if (links.includes(match[0].slice(match[0].lastIndexOf('[') + 1, -1))) {
6438
+ maskedSrc = maskedSrc.slice(0, match.index) + '[' + 'a'.repeat(match[0].length - 2) + ']' + maskedSrc.slice(this.tokenizer.rules.inline.reflinkSearch.lastIndex);
6439
+ }
6440
+ }
6441
+ }
6442
+ }
6443
+ // Mask out other blocks
6444
+ while ((match = this.tokenizer.rules.inline.blockSkip.exec(maskedSrc)) != null) {
6445
+ maskedSrc = maskedSrc.slice(0, match.index) + '[' + 'a'.repeat(match[0].length - 2) + ']' + maskedSrc.slice(this.tokenizer.rules.inline.blockSkip.lastIndex);
6446
+ }
6447
+ // Mask out escaped characters
6448
+ while ((match = this.tokenizer.rules.inline.anyPunctuation.exec(maskedSrc)) != null) {
6449
+ maskedSrc = maskedSrc.slice(0, match.index) + '++' + maskedSrc.slice(this.tokenizer.rules.inline.anyPunctuation.lastIndex);
6450
+ }
6451
+ while (src) {
6452
+ if (!keepPrevChar) {
6453
+ prevChar = '';
6454
+ }
6455
+ keepPrevChar = false;
6456
+ // extensions
6457
+ if (this.options.extensions && this.options.extensions.inline && this.options.extensions.inline.some(extTokenizer => {
6458
+ if (token = extTokenizer.call({
6459
+ lexer: this
6460
+ }, src, tokens)) {
6461
+ src = src.substring(token.raw.length);
6462
+ tokens.push(token);
6463
+ return true;
6464
+ }
6465
+ return false;
6466
+ })) {
6467
+ continue;
6468
+ }
6469
+ // escape
6470
+ if (token = this.tokenizer.escape(src)) {
6471
+ src = src.substring(token.raw.length);
6472
+ tokens.push(token);
6473
+ continue;
6474
+ }
6475
+ // tag
6476
+ if (token = this.tokenizer.tag(src)) {
6477
+ src = src.substring(token.raw.length);
6478
+ lastToken = tokens[tokens.length - 1];
6479
+ if (lastToken && token.type === 'text' && lastToken.type === 'text') {
6480
+ lastToken.raw += token.raw;
6481
+ lastToken.text += token.text;
6482
+ } else {
6483
+ tokens.push(token);
6484
+ }
6485
+ continue;
6486
+ }
6487
+ // link
6488
+ if (token = this.tokenizer.link(src)) {
6489
+ src = src.substring(token.raw.length);
6490
+ tokens.push(token);
6491
+ continue;
6492
+ }
6493
+ // reflink, nolink
6494
+ if (token = this.tokenizer.reflink(src, this.tokens.links)) {
6495
+ src = src.substring(token.raw.length);
6496
+ lastToken = tokens[tokens.length - 1];
6497
+ if (lastToken && token.type === 'text' && lastToken.type === 'text') {
6498
+ lastToken.raw += token.raw;
6499
+ lastToken.text += token.text;
6500
+ } else {
6501
+ tokens.push(token);
6502
+ }
6503
+ continue;
6504
+ }
6505
+ // em & strong
6506
+ if (token = this.tokenizer.emStrong(src, maskedSrc, prevChar)) {
6507
+ src = src.substring(token.raw.length);
6508
+ tokens.push(token);
6509
+ continue;
6510
+ }
6511
+ // code
6512
+ if (token = this.tokenizer.codespan(src)) {
6513
+ src = src.substring(token.raw.length);
6514
+ tokens.push(token);
6515
+ continue;
6516
+ }
6517
+ // br
6518
+ if (token = this.tokenizer.br(src)) {
6519
+ src = src.substring(token.raw.length);
6520
+ tokens.push(token);
6521
+ continue;
6522
+ }
6523
+ // del (gfm)
6524
+ if (token = this.tokenizer.del(src)) {
6525
+ src = src.substring(token.raw.length);
6526
+ tokens.push(token);
6527
+ continue;
6528
+ }
6529
+ // autolink
6530
+ if (token = this.tokenizer.autolink(src)) {
6531
+ src = src.substring(token.raw.length);
6532
+ tokens.push(token);
6533
+ continue;
6534
+ }
6535
+ // url (gfm)
6536
+ if (!this.state.inLink && (token = this.tokenizer.url(src))) {
6537
+ src = src.substring(token.raw.length);
6538
+ tokens.push(token);
6539
+ continue;
6540
+ }
6541
+ // text
6542
+ // prevent inlineText consuming extensions by clipping 'src' to extension start
6543
+ cutSrc = src;
6544
+ if (this.options.extensions && this.options.extensions.startInline) {
6545
+ let startIndex = Infinity;
6546
+ const tempSrc = src.slice(1);
6547
+ let tempStart;
6548
+ this.options.extensions.startInline.forEach(getStartIndex => {
6549
+ tempStart = getStartIndex.call({
6550
+ lexer: this
6551
+ }, tempSrc);
6552
+ if (typeof tempStart === 'number' && tempStart >= 0) {
6553
+ startIndex = Math.min(startIndex, tempStart);
6554
+ }
6555
+ });
6556
+ if (startIndex < Infinity && startIndex >= 0) {
6557
+ cutSrc = src.substring(0, startIndex + 1);
6558
+ }
6559
+ }
6560
+ if (token = this.tokenizer.inlineText(cutSrc)) {
6561
+ src = src.substring(token.raw.length);
6562
+ if (token.raw.slice(-1) !== '_') {
6563
+ // Track prevChar before string of ____ started
6564
+ prevChar = token.raw.slice(-1);
6565
+ }
6566
+ keepPrevChar = true;
6567
+ lastToken = tokens[tokens.length - 1];
6568
+ if (lastToken && lastToken.type === 'text') {
6569
+ lastToken.raw += token.raw;
6570
+ lastToken.text += token.text;
6571
+ } else {
6572
+ tokens.push(token);
6573
+ }
6574
+ continue;
6575
+ }
6576
+ if (src) {
6577
+ const errMsg = 'Infinite loop on byte: ' + src.charCodeAt(0);
6578
+ if (this.options.silent) {
6579
+ console.error(errMsg);
6580
+ break;
6581
+ } else {
6582
+ throw new Error(errMsg);
6583
+ }
6584
+ }
6585
+ }
6586
+ return tokens;
6587
+ }
6588
+ }
6589
+
6590
+ /**
6591
+ * Renderer
6592
+ */
6593
+ class _Renderer {
6594
+ options;
6595
+ constructor(options) {
6596
+ this.options = options || _defaults;
6597
+ }
6598
+ code(code, infostring, escaped) {
6599
+ const lang = (infostring || '').match(/^\S*/)?.[0];
6600
+ code = code.replace(/\n$/, '') + '\n';
6601
+ if (!lang) {
6602
+ return '<pre><code>' + (escaped ? code : escape(code, true)) + '</code></pre>\n';
6603
+ }
6604
+ return '<pre><code class="language-' + escape(lang) + '">' + (escaped ? code : escape(code, true)) + '</code></pre>\n';
6605
+ }
6606
+ blockquote(quote) {
6607
+ return `<blockquote>\n${quote}</blockquote>\n`;
6608
+ }
6609
+ html(html, block) {
6610
+ return html;
6611
+ }
6612
+ heading(text, level, raw) {
6613
+ // ignore IDs
6614
+ return `<h${level}>${text}</h${level}>\n`;
6615
+ }
6616
+ hr() {
6617
+ return '<hr>\n';
6618
+ }
6619
+ list(body, ordered, start) {
6620
+ const type = ordered ? 'ol' : 'ul';
6621
+ const startatt = ordered && start !== 1 ? ' start="' + start + '"' : '';
6622
+ return '<' + type + startatt + '>\n' + body + '</' + type + '>\n';
6623
+ }
6624
+ listitem(text, task, checked) {
6625
+ return `<li>${text}</li>\n`;
6626
+ }
6627
+ checkbox(checked) {
6628
+ return '<input ' + (checked ? 'checked="" ' : '') + 'disabled="" type="checkbox">';
6629
+ }
6630
+ paragraph(text) {
6631
+ return `<p>${text}</p>\n`;
6632
+ }
6633
+ table(header, body) {
6634
+ if (body) body = `<tbody>${body}</tbody>`;
6635
+ return '<table>\n' + '<thead>\n' + header + '</thead>\n' + body + '</table>\n';
6636
+ }
6637
+ tablerow(content) {
6638
+ return `<tr>\n${content}</tr>\n`;
6639
+ }
6640
+ tablecell(content, flags) {
6641
+ const type = flags.header ? 'th' : 'td';
6642
+ const tag = flags.align ? `<${type} align="${flags.align}">` : `<${type}>`;
6643
+ return tag + content + `</${type}>\n`;
6644
+ }
6645
+ /**
6646
+ * span level renderer
6647
+ */
6648
+ strong(text) {
6649
+ return `<strong>${text}</strong>`;
6650
+ }
6651
+ em(text) {
6652
+ return `<em>${text}</em>`;
6653
+ }
6654
+ codespan(text) {
6655
+ return `<code>${text}</code>`;
6656
+ }
6657
+ br() {
6658
+ return '<br>';
6659
+ }
6660
+ del(text) {
6661
+ return `<del>${text}</del>`;
6662
+ }
6663
+ link(href, title, text) {
6664
+ const cleanHref = cleanUrl(href);
6665
+ if (cleanHref === null) {
6666
+ return text;
6667
+ }
6668
+ href = cleanHref;
6669
+ let out = '<a href="' + href + '"';
6670
+ if (title) {
6671
+ out += ' title="' + title + '"';
6672
+ }
6673
+ out += '>' + text + '</a>';
6674
+ return out;
6675
+ }
6676
+ image(href, title, text) {
6677
+ const cleanHref = cleanUrl(href);
6678
+ if (cleanHref === null) {
6679
+ return text;
6680
+ }
6681
+ href = cleanHref;
6682
+ let out = `<img src="${href}" alt="${text}"`;
6683
+ if (title) {
6684
+ out += ` title="${title}"`;
6685
+ }
6686
+ out += '>';
6687
+ return out;
6688
+ }
6689
+ text(text) {
6690
+ return text;
6691
+ }
6692
+ }
6693
+
6694
+ /**
6695
+ * TextRenderer
6696
+ * returns only the textual part of the token
6697
+ */
6698
+ class _TextRenderer {
6699
+ // no need for block level renderers
6700
+ strong(text) {
6701
+ return text;
6702
+ }
6703
+ em(text) {
6704
+ return text;
6705
+ }
6706
+ codespan(text) {
6707
+ return text;
6708
+ }
6709
+ del(text) {
6710
+ return text;
6711
+ }
6712
+ html(text) {
6713
+ return text;
6714
+ }
6715
+ text(text) {
6716
+ return text;
6717
+ }
6718
+ link(href, title, text) {
6719
+ return '' + text;
6720
+ }
6721
+ image(href, title, text) {
6722
+ return '' + text;
6723
+ }
6724
+ br() {
6725
+ return '';
6726
+ }
6727
+ }
6728
+
6729
+ /**
6730
+ * Parsing & Compiling
6731
+ */
6732
+ class _Parser {
6733
+ options;
6734
+ renderer;
6735
+ textRenderer;
6736
+ constructor(options) {
6737
+ this.options = options || _defaults;
6738
+ this.options.renderer = this.options.renderer || new _Renderer();
6739
+ this.renderer = this.options.renderer;
6740
+ this.renderer.options = this.options;
6741
+ this.textRenderer = new _TextRenderer();
6742
+ }
6743
+ /**
6744
+ * Static Parse Method
6745
+ */
6746
+ static parse(tokens, options) {
6747
+ const parser = new _Parser(options);
6748
+ return parser.parse(tokens);
6749
+ }
6750
+ /**
6751
+ * Static Parse Inline Method
6752
+ */
6753
+ static parseInline(tokens, options) {
6754
+ const parser = new _Parser(options);
6755
+ return parser.parseInline(tokens);
6756
+ }
6757
+ /**
6758
+ * Parse Loop
6759
+ */
6760
+ parse(tokens) {
6761
+ let top = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : true;
6762
+ let out = '';
6763
+ for (let i = 0; i < tokens.length; i++) {
6764
+ const token = tokens[i];
6765
+ // Run any renderer extensions
6766
+ if (this.options.extensions && this.options.extensions.renderers && this.options.extensions.renderers[token.type]) {
6767
+ const genericToken = token;
6768
+ const ret = this.options.extensions.renderers[genericToken.type].call({
6769
+ parser: this
6770
+ }, genericToken);
6771
+ if (ret !== false || !['space', 'hr', 'heading', 'code', 'table', 'blockquote', 'list', 'html', 'paragraph', 'text'].includes(genericToken.type)) {
6772
+ out += ret || '';
6773
+ continue;
6774
+ }
6775
+ }
6776
+ switch (token.type) {
6777
+ case 'space':
6778
+ {
6779
+ continue;
6780
+ }
6781
+ case 'hr':
6782
+ {
6783
+ out += this.renderer.hr();
6784
+ continue;
6785
+ }
6786
+ case 'heading':
6787
+ {
6788
+ const headingToken = token;
6789
+ out += this.renderer.heading(this.parseInline(headingToken.tokens), headingToken.depth, unescape(this.parseInline(headingToken.tokens, this.textRenderer)));
6790
+ continue;
6791
+ }
6792
+ case 'code':
6793
+ {
6794
+ const codeToken = token;
6795
+ out += this.renderer.code(codeToken.text, codeToken.lang, !!codeToken.escaped);
6796
+ continue;
6797
+ }
6798
+ case 'table':
6799
+ {
6800
+ const tableToken = token;
6801
+ let header = '';
6802
+ // header
6803
+ let cell = '';
6804
+ for (let j = 0; j < tableToken.header.length; j++) {
6805
+ cell += this.renderer.tablecell(this.parseInline(tableToken.header[j].tokens), {
6806
+ header: true,
6807
+ align: tableToken.align[j]
6808
+ });
6809
+ }
6810
+ header += this.renderer.tablerow(cell);
6811
+ let body = '';
6812
+ for (let j = 0; j < tableToken.rows.length; j++) {
6813
+ const row = tableToken.rows[j];
6814
+ cell = '';
6815
+ for (let k = 0; k < row.length; k++) {
6816
+ cell += this.renderer.tablecell(this.parseInline(row[k].tokens), {
6817
+ header: false,
6818
+ align: tableToken.align[k]
6819
+ });
6820
+ }
6821
+ body += this.renderer.tablerow(cell);
6822
+ }
6823
+ out += this.renderer.table(header, body);
6824
+ continue;
6825
+ }
6826
+ case 'blockquote':
6827
+ {
6828
+ const blockquoteToken = token;
6829
+ const body = this.parse(blockquoteToken.tokens);
6830
+ out += this.renderer.blockquote(body);
6831
+ continue;
6832
+ }
6833
+ case 'list':
6834
+ {
6835
+ const listToken = token;
6836
+ const ordered = listToken.ordered;
6837
+ const start = listToken.start;
6838
+ const loose = listToken.loose;
6839
+ let body = '';
6840
+ for (let j = 0; j < listToken.items.length; j++) {
6841
+ const item = listToken.items[j];
6842
+ const checked = item.checked;
6843
+ const task = item.task;
6844
+ let itemBody = '';
6845
+ if (item.task) {
6846
+ const checkbox = this.renderer.checkbox(!!checked);
6847
+ if (loose) {
6848
+ if (item.tokens.length > 0 && item.tokens[0].type === 'paragraph') {
6849
+ item.tokens[0].text = checkbox + ' ' + item.tokens[0].text;
6850
+ if (item.tokens[0].tokens && item.tokens[0].tokens.length > 0 && item.tokens[0].tokens[0].type === 'text') {
6851
+ item.tokens[0].tokens[0].text = checkbox + ' ' + item.tokens[0].tokens[0].text;
6852
+ }
6853
+ } else {
6854
+ item.tokens.unshift({
6855
+ type: 'text',
6856
+ text: checkbox + ' '
6857
+ });
6858
+ }
6859
+ } else {
6860
+ itemBody += checkbox + ' ';
6861
+ }
6862
+ }
6863
+ itemBody += this.parse(item.tokens, loose);
6864
+ body += this.renderer.listitem(itemBody, task, !!checked);
6865
+ }
6866
+ out += this.renderer.list(body, ordered, start);
6867
+ continue;
6868
+ }
6869
+ case 'html':
6870
+ {
6871
+ const htmlToken = token;
6872
+ out += this.renderer.html(htmlToken.text, htmlToken.block);
6873
+ continue;
6874
+ }
6875
+ case 'paragraph':
6876
+ {
6877
+ const paragraphToken = token;
6878
+ out += this.renderer.paragraph(this.parseInline(paragraphToken.tokens));
6879
+ continue;
6880
+ }
6881
+ case 'text':
6882
+ {
6883
+ let textToken = token;
6884
+ let body = textToken.tokens ? this.parseInline(textToken.tokens) : textToken.text;
6885
+ while (i + 1 < tokens.length && tokens[i + 1].type === 'text') {
6886
+ textToken = tokens[++i];
6887
+ body += '\n' + (textToken.tokens ? this.parseInline(textToken.tokens) : textToken.text);
6888
+ }
6889
+ out += top ? this.renderer.paragraph(body) : body;
6890
+ continue;
6891
+ }
6892
+ default:
6893
+ {
6894
+ const errMsg = 'Token with "' + token.type + '" type was not found.';
6895
+ if (this.options.silent) {
6896
+ console.error(errMsg);
6897
+ return '';
6898
+ } else {
6899
+ throw new Error(errMsg);
6900
+ }
6901
+ }
6902
+ }
6903
+ }
6904
+ return out;
6905
+ }
6906
+ /**
6907
+ * Parse Inline Tokens
6908
+ */
6909
+ parseInline(tokens, renderer) {
6910
+ renderer = renderer || this.renderer;
6911
+ let out = '';
6912
+ for (let i = 0; i < tokens.length; i++) {
6913
+ const token = tokens[i];
6914
+ // Run any renderer extensions
6915
+ if (this.options.extensions && this.options.extensions.renderers && this.options.extensions.renderers[token.type]) {
6916
+ const ret = this.options.extensions.renderers[token.type].call({
6917
+ parser: this
6918
+ }, token);
6919
+ if (ret !== false || !['escape', 'html', 'link', 'image', 'strong', 'em', 'codespan', 'br', 'del', 'text'].includes(token.type)) {
6920
+ out += ret || '';
6921
+ continue;
6922
+ }
6923
+ }
6924
+ switch (token.type) {
6925
+ case 'escape':
6926
+ {
6927
+ const escapeToken = token;
6928
+ out += renderer.text(escapeToken.text);
6929
+ break;
6930
+ }
6931
+ case 'html':
6932
+ {
6933
+ const tagToken = token;
6934
+ out += renderer.html(tagToken.text);
6935
+ break;
6936
+ }
6937
+ case 'link':
6938
+ {
6939
+ const linkToken = token;
6940
+ out += renderer.link(linkToken.href, linkToken.title, this.parseInline(linkToken.tokens, renderer));
6941
+ break;
6942
+ }
6943
+ case 'image':
6944
+ {
6945
+ const imageToken = token;
6946
+ out += renderer.image(imageToken.href, imageToken.title, imageToken.text);
6947
+ break;
6948
+ }
6949
+ case 'strong':
6950
+ {
6951
+ const strongToken = token;
6952
+ out += renderer.strong(this.parseInline(strongToken.tokens, renderer));
6953
+ break;
6954
+ }
6955
+ case 'em':
6956
+ {
6957
+ const emToken = token;
6958
+ out += renderer.em(this.parseInline(emToken.tokens, renderer));
6959
+ break;
6960
+ }
6961
+ case 'codespan':
6962
+ {
6963
+ const codespanToken = token;
6964
+ out += renderer.codespan(codespanToken.text);
6965
+ break;
6966
+ }
6967
+ case 'br':
6968
+ {
6969
+ out += renderer.br();
6970
+ break;
6971
+ }
6972
+ case 'del':
6973
+ {
6974
+ const delToken = token;
6975
+ out += renderer.del(this.parseInline(delToken.tokens, renderer));
6976
+ break;
6977
+ }
6978
+ case 'text':
6979
+ {
6980
+ const textToken = token;
6981
+ out += renderer.text(textToken.text);
6982
+ break;
6983
+ }
6984
+ default:
6985
+ {
6986
+ const errMsg = 'Token with "' + token.type + '" type was not found.';
6987
+ if (this.options.silent) {
6988
+ console.error(errMsg);
6989
+ return '';
6990
+ } else {
6991
+ throw new Error(errMsg);
6992
+ }
6993
+ }
6994
+ }
6995
+ }
6996
+ return out;
6997
+ }
6998
+ }
6999
+ class _Hooks {
7000
+ options;
7001
+ constructor(options) {
7002
+ this.options = options || _defaults;
4885
7003
  }
7004
+ static passThroughHooks = new Set(['preprocess', 'postprocess']);
4886
7005
  /**
4887
- Close the block for the given node.
4888
- */
4889
- closeBlock(node) {
4890
- this.closed = node;
7006
+ * Process markdown before marked
7007
+ */
7008
+ preprocess(markdown) {
7009
+ return markdown;
4891
7010
  }
4892
7011
  /**
4893
- Add the given text to the document. When escape is not `false`,
4894
- it will be escaped.
4895
- */
4896
- text(text) {
4897
- let escape = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : true;
4898
- let lines = text.split("\n");
4899
- for (let i = 0; i < lines.length; i++) {
4900
- this.write();
4901
- // Escape exclamation marks in front of links
4902
- if (!escape && lines[i][0] == "[" && /(^|[^\\])\!$/.test(this.out)) this.out = this.out.slice(0, this.out.length - 1) + "\\!";
4903
- this.out += escape ? this.esc(lines[i], this.atBlockStart) : lines[i];
4904
- if (i != lines.length - 1) this.out += "\n";
4905
- }
7012
+ * Process HTML after marked is finished
7013
+ */
7014
+ postprocess(html) {
7015
+ return html;
4906
7016
  }
4907
- /**
4908
- Render the given node as a block.
4909
- */
4910
- render(node, parent, index) {
4911
- if (typeof parent == "number") throw new Error("!");
4912
- if (!this.nodes[node.type.name]) throw new Error("Token type `" + node.type.name + "` not supported by Markdown renderer");
4913
- this.nodes[node.type.name](this, node, parent, index);
7017
+ }
7018
+ class Marked {
7019
+ defaults = _getDefaults();
7020
+ options = this.setOptions;
7021
+ parse = this.#parseMarkdown(_Lexer.lex, _Parser.parse);
7022
+ parseInline = this.#parseMarkdown(_Lexer.lexInline, _Parser.parseInline);
7023
+ Parser = _Parser;
7024
+ parser = _Parser.parse;
7025
+ Renderer = _Renderer;
7026
+ TextRenderer = _TextRenderer;
7027
+ Lexer = _Lexer;
7028
+ lexer = _Lexer.lex;
7029
+ Tokenizer = _Tokenizer;
7030
+ Hooks = _Hooks;
7031
+ constructor() {
7032
+ this.use(...arguments);
4914
7033
  }
4915
7034
  /**
4916
- Render the contents of `parent` as block nodes.
4917
- */
4918
- renderContent(parent) {
4919
- parent.forEach((node, _, i) => this.render(node, parent, i));
7035
+ * Run callback for every token
7036
+ */
7037
+ walkTokens(tokens, callback) {
7038
+ let values = [];
7039
+ for (const token of tokens) {
7040
+ values = values.concat(callback.call(this, token));
7041
+ switch (token.type) {
7042
+ case 'table':
7043
+ {
7044
+ const tableToken = token;
7045
+ for (const cell of tableToken.header) {
7046
+ values = values.concat(this.walkTokens(cell.tokens, callback));
7047
+ }
7048
+ for (const row of tableToken.rows) {
7049
+ for (const cell of row) {
7050
+ values = values.concat(this.walkTokens(cell.tokens, callback));
7051
+ }
7052
+ }
7053
+ break;
7054
+ }
7055
+ case 'list':
7056
+ {
7057
+ const listToken = token;
7058
+ values = values.concat(this.walkTokens(listToken.items, callback));
7059
+ break;
7060
+ }
7061
+ default:
7062
+ {
7063
+ const genericToken = token;
7064
+ if (this.defaults.extensions?.childTokens?.[genericToken.type]) {
7065
+ this.defaults.extensions.childTokens[genericToken.type].forEach(childTokens => {
7066
+ values = values.concat(this.walkTokens(genericToken[childTokens], callback));
7067
+ });
7068
+ } else if (genericToken.tokens) {
7069
+ values = values.concat(this.walkTokens(genericToken.tokens, callback));
7070
+ }
7071
+ }
7072
+ }
7073
+ }
7074
+ return values;
4920
7075
  }
4921
- /**
4922
- Render the contents of `parent` as inline content.
4923
- */
4924
- renderInline(parent) {
4925
- this.atBlockStart = true;
4926
- let active = [],
4927
- trailing = "";
4928
- let progress = (node, offset, index) => {
4929
- let marks = node ? node.marks : [];
4930
- // Remove marks from `hard_break` that are the last node inside
4931
- // that mark to prevent parser edge cases with new lines just
4932
- // before closing marks.
4933
- // (FIXME it'd be nice if we had a schema-agnostic way to
4934
- // identify nodes that serialize as hard breaks)
4935
- if (node && node.type.name === "hard_break") marks = marks.filter(m => {
4936
- if (index + 1 == parent.childCount) return false;
4937
- let next = parent.child(index + 1);
4938
- return m.isInSet(next.marks) && (!next.isText || /\S/.test(next.text));
4939
- });
4940
- let leading = trailing;
4941
- trailing = "";
4942
- // If whitespace has to be expelled from the node, adjust
4943
- // leading and trailing accordingly.
4944
- if (node && node.isText && marks.some(mark => {
4945
- let info = this.marks[mark.type.name];
4946
- return info && info.expelEnclosingWhitespace && !(mark.isInSet(active) || index < parent.childCount - 1 && mark.isInSet(parent.child(index + 1).marks));
4947
- })) {
4948
- let [_, lead, inner, trail] = /^(\s*)(.*?)(\s*)$/m.exec(node.text);
4949
- leading += lead;
4950
- trailing = trail;
4951
- if (lead || trail) {
4952
- node = inner ? node.withText(inner) : null;
4953
- if (!node) marks = active;
7076
+ use() {
7077
+ const extensions = this.defaults.extensions || {
7078
+ renderers: {},
7079
+ childTokens: {}
7080
+ };
7081
+ for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
7082
+ args[_key] = arguments[_key];
7083
+ }
7084
+ args.forEach(pack => {
7085
+ // copy options to new object
7086
+ const opts = {
7087
+ ...pack
7088
+ };
7089
+ // set async to true if it was set to true before
7090
+ opts.async = this.defaults.async || opts.async || false;
7091
+ // ==-- Parse "addon" extensions --== //
7092
+ if (pack.extensions) {
7093
+ pack.extensions.forEach(ext => {
7094
+ if (!ext.name) {
7095
+ throw new Error('extension name required');
7096
+ }
7097
+ if ('renderer' in ext) {
7098
+ // Renderer extensions
7099
+ const prevRenderer = extensions.renderers[ext.name];
7100
+ if (prevRenderer) {
7101
+ // Replace extension with func to run new extension but fall back if false
7102
+ extensions.renderers[ext.name] = function () {
7103
+ for (var _len2 = arguments.length, args = new Array(_len2), _key2 = 0; _key2 < _len2; _key2++) {
7104
+ args[_key2] = arguments[_key2];
7105
+ }
7106
+ let ret = ext.renderer.apply(this, args);
7107
+ if (ret === false) {
7108
+ ret = prevRenderer.apply(this, args);
7109
+ }
7110
+ return ret;
7111
+ };
7112
+ } else {
7113
+ extensions.renderers[ext.name] = ext.renderer;
7114
+ }
7115
+ }
7116
+ if ('tokenizer' in ext) {
7117
+ // Tokenizer Extensions
7118
+ if (!ext.level || ext.level !== 'block' && ext.level !== 'inline') {
7119
+ throw new Error("extension level must be 'block' or 'inline'");
7120
+ }
7121
+ const extLevel = extensions[ext.level];
7122
+ if (extLevel) {
7123
+ extLevel.unshift(ext.tokenizer);
7124
+ } else {
7125
+ extensions[ext.level] = [ext.tokenizer];
7126
+ }
7127
+ if (ext.start) {
7128
+ // Function to check for start of token
7129
+ if (ext.level === 'block') {
7130
+ if (extensions.startBlock) {
7131
+ extensions.startBlock.push(ext.start);
7132
+ } else {
7133
+ extensions.startBlock = [ext.start];
7134
+ }
7135
+ } else if (ext.level === 'inline') {
7136
+ if (extensions.startInline) {
7137
+ extensions.startInline.push(ext.start);
7138
+ } else {
7139
+ extensions.startInline = [ext.start];
7140
+ }
7141
+ }
7142
+ }
7143
+ }
7144
+ if ('childTokens' in ext && ext.childTokens) {
7145
+ // Child tokens to be visited by walkTokens
7146
+ extensions.childTokens[ext.name] = ext.childTokens;
7147
+ }
7148
+ });
7149
+ opts.extensions = extensions;
7150
+ }
7151
+ // ==-- Parse "overwrite" extensions --== //
7152
+ if (pack.renderer) {
7153
+ const renderer = this.defaults.renderer || new _Renderer(this.defaults);
7154
+ for (const prop in pack.renderer) {
7155
+ const rendererFunc = pack.renderer[prop];
7156
+ const rendererKey = prop;
7157
+ const prevRenderer = renderer[rendererKey];
7158
+ // Replace renderer with func to run extension, but fall back if false
7159
+ renderer[rendererKey] = function () {
7160
+ for (var _len3 = arguments.length, args = new Array(_len3), _key3 = 0; _key3 < _len3; _key3++) {
7161
+ args[_key3] = arguments[_key3];
7162
+ }
7163
+ let ret = rendererFunc.apply(renderer, args);
7164
+ if (ret === false) {
7165
+ ret = prevRenderer.apply(renderer, args);
7166
+ }
7167
+ return ret || '';
7168
+ };
4954
7169
  }
7170
+ opts.renderer = renderer;
4955
7171
  }
4956
- let inner = marks.length ? marks[marks.length - 1] : null;
4957
- let noEsc = inner && this.marks[inner.type.name].escape === false;
4958
- let len = marks.length - (noEsc ? 1 : 0);
4959
- // Try to reorder 'mixable' marks, such as em and strong, which
4960
- // in Markdown may be opened and closed in different order, so
4961
- // that order of the marks for the token matches the order in
4962
- // active.
4963
- outer: for (let i = 0; i < len; i++) {
4964
- let mark = marks[i];
4965
- if (!this.marks[mark.type.name].mixable) break;
4966
- for (let j = 0; j < active.length; j++) {
4967
- let other = active[j];
4968
- if (!this.marks[other.type.name].mixable) break;
4969
- if (mark.eq(other)) {
4970
- if (i > j) marks = marks.slice(0, j).concat(mark).concat(marks.slice(j, i)).concat(marks.slice(i + 1, len));else if (j > i) marks = marks.slice(0, i).concat(marks.slice(i + 1, j)).concat(mark).concat(marks.slice(j, len));
4971
- continue outer;
4972
- }
7172
+ if (pack.tokenizer) {
7173
+ const tokenizer = this.defaults.tokenizer || new _Tokenizer(this.defaults);
7174
+ for (const prop in pack.tokenizer) {
7175
+ const tokenizerFunc = pack.tokenizer[prop];
7176
+ const tokenizerKey = prop;
7177
+ const prevTokenizer = tokenizer[tokenizerKey];
7178
+ // Replace tokenizer with func to run extension, but fall back if false
7179
+ tokenizer[tokenizerKey] = function () {
7180
+ for (var _len4 = arguments.length, args = new Array(_len4), _key4 = 0; _key4 < _len4; _key4++) {
7181
+ args[_key4] = arguments[_key4];
7182
+ }
7183
+ let ret = tokenizerFunc.apply(tokenizer, args);
7184
+ if (ret === false) {
7185
+ ret = prevTokenizer.apply(tokenizer, args);
7186
+ }
7187
+ return ret;
7188
+ };
4973
7189
  }
7190
+ opts.tokenizer = tokenizer;
4974
7191
  }
4975
- // Find the prefix of the mark set that didn't change
4976
- let keep = 0;
4977
- while (keep < Math.min(active.length, len) && marks[keep].eq(active[keep])) ++keep;
4978
- // Close the marks that need to be closed
4979
- while (keep < active.length) this.text(this.markString(active.pop(), false, parent, index), false);
4980
- // Output any previously expelled trailing whitespace outside the marks
4981
- if (leading) this.text(leading);
4982
- // Open the marks that need to be opened
4983
- if (node) {
4984
- while (active.length < len) {
4985
- let add = marks[active.length];
4986
- active.push(add);
4987
- this.text(this.markString(add, true, parent, index), false);
7192
+ // ==-- Parse Hooks extensions --== //
7193
+ if (pack.hooks) {
7194
+ const hooks = this.defaults.hooks || new _Hooks();
7195
+ for (const prop in pack.hooks) {
7196
+ const hooksFunc = pack.hooks[prop];
7197
+ const hooksKey = prop;
7198
+ const prevHook = hooks[hooksKey];
7199
+ if (_Hooks.passThroughHooks.has(prop)) {
7200
+ hooks[hooksKey] = arg => {
7201
+ if (this.defaults.async) {
7202
+ return Promise.resolve(hooksFunc.call(hooks, arg)).then(ret => {
7203
+ return prevHook.call(hooks, ret);
7204
+ });
7205
+ }
7206
+ const ret = hooksFunc.call(hooks, arg);
7207
+ return prevHook.call(hooks, ret);
7208
+ };
7209
+ } else {
7210
+ hooks[hooksKey] = function () {
7211
+ for (var _len5 = arguments.length, args = new Array(_len5), _key5 = 0; _key5 < _len5; _key5++) {
7212
+ args[_key5] = arguments[_key5];
7213
+ }
7214
+ let ret = hooksFunc.apply(hooks, args);
7215
+ if (ret === false) {
7216
+ ret = prevHook.apply(hooks, args);
7217
+ }
7218
+ return ret;
7219
+ };
7220
+ }
4988
7221
  }
4989
- // Render the node. Special case code marks, since their content
4990
- // may not be escaped.
4991
- if (noEsc && node.isText) this.text(this.markString(inner, true, parent, index) + node.text + this.markString(inner, false, parent, index + 1), false);else this.render(node, parent, index);
7222
+ opts.hooks = hooks;
4992
7223
  }
4993
- };
4994
- parent.forEach(progress);
4995
- progress(null, 0, parent.childCount);
4996
- this.atBlockStart = false;
4997
- }
4998
- /**
4999
- Render a node's content as a list. `delim` should be the extra
5000
- indentation added to all lines except the first in an item,
5001
- `firstDelim` is a function going from an item index to a
5002
- delimiter for the first line of the item.
5003
- */
5004
- renderList(node, delim, firstDelim) {
5005
- if (this.closed && this.closed.type == node.type) this.flushClose(3);else if (this.inTightList) this.flushClose(1);
5006
- let isTight = typeof node.attrs.tight != "undefined" ? node.attrs.tight : this.options.tightLists;
5007
- let prevTight = this.inTightList;
5008
- this.inTightList = isTight;
5009
- node.forEach((child, _, i) => {
5010
- if (i && isTight) this.flushClose(1);
5011
- this.wrapBlock(delim, firstDelim(i), node, () => this.render(child, node, i));
7224
+ // ==-- Parse WalkTokens extensions --== //
7225
+ if (pack.walkTokens) {
7226
+ const walkTokens = this.defaults.walkTokens;
7227
+ const packWalktokens = pack.walkTokens;
7228
+ opts.walkTokens = function (token) {
7229
+ let values = [];
7230
+ values.push(packWalktokens.call(this, token));
7231
+ if (walkTokens) {
7232
+ values = values.concat(walkTokens.call(this, token));
7233
+ }
7234
+ return values;
7235
+ };
7236
+ }
7237
+ this.defaults = {
7238
+ ...this.defaults,
7239
+ ...opts
7240
+ };
5012
7241
  });
5013
- this.inTightList = prevTight;
5014
- }
5015
- /**
5016
- Escape the given string so that it can safely appear in Markdown
5017
- content. If `startOfLine` is true, also escape characters that
5018
- have special meaning only at the start of the line.
5019
- */
5020
- esc(str) {
5021
- let startOfLine = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
5022
- str = str.replace(/[`*\\~\[\]_]/g, (m, i) => m == "_" && i > 0 && i + 1 < str.length && str[i - 1].match(/\w/) && str[i + 1].match(/\w/) ? m : "\\" + m);
5023
- if (startOfLine) str = str.replace(/^[#\-*+>]/, "\\$&").replace(/^(\s*\d+)\./, "$1\\.");
5024
- if (this.options.escapeExtraCharacters) str = str.replace(this.options.escapeExtraCharacters, "\\$&");
5025
- return str;
5026
- }
5027
- /**
5028
- @internal
5029
- */
5030
- quote(str) {
5031
- let wrap = str.indexOf('"') == -1 ? '""' : str.indexOf("'") == -1 ? "''" : "()";
5032
- return wrap[0] + str + wrap[1];
7242
+ return this;
5033
7243
  }
5034
- /**
5035
- Repeat the given string `n` times.
5036
- */
5037
- repeat(str, n) {
5038
- let out = "";
5039
- for (let i = 0; i < n; i++) out += str;
5040
- return out;
7244
+ setOptions(opt) {
7245
+ this.defaults = {
7246
+ ...this.defaults,
7247
+ ...opt
7248
+ };
7249
+ return this;
5041
7250
  }
5042
- /**
5043
- Get the markdown string for a given opening or closing mark.
5044
- */
5045
- markString(mark, open, parent, index) {
5046
- let info = this.marks[mark.type.name];
5047
- let value = open ? info.open : info.close;
5048
- return typeof value == "string" ? value : value(this, mark, parent, index);
7251
+ #parseMarkdown(lexer, parser) {
7252
+ return (src, options) => {
7253
+ const origOpt = {
7254
+ ...options
7255
+ };
7256
+ const opt = {
7257
+ ...this.defaults,
7258
+ ...origOpt
7259
+ };
7260
+ // Show warning if an extension set async to true but the parse was called with async: false
7261
+ if (this.defaults.async === true && origOpt.async === false) {
7262
+ if (!opt.silent) {
7263
+ console.warn('marked(): The async option was set to true by an extension. The async: false option sent to parse will be ignored.');
7264
+ }
7265
+ opt.async = true;
7266
+ }
7267
+ const throwError = this.#onError(!!opt.silent, !!opt.async);
7268
+ // throw error in case of non string input
7269
+ if (typeof src === 'undefined' || src === null) {
7270
+ return throwError(new Error('marked(): input parameter is undefined or null'));
7271
+ }
7272
+ if (typeof src !== 'string') {
7273
+ return throwError(new Error('marked(): input parameter is of type ' + Object.prototype.toString.call(src) + ', string expected'));
7274
+ }
7275
+ if (opt.hooks) {
7276
+ opt.hooks.options = opt;
7277
+ }
7278
+ if (opt.async) {
7279
+ return Promise.resolve(opt.hooks ? opt.hooks.preprocess(src) : src).then(src => lexer(src, opt)).then(tokens => opt.walkTokens ? Promise.all(this.walkTokens(tokens, opt.walkTokens)).then(() => tokens) : tokens).then(tokens => parser(tokens, opt)).then(html => opt.hooks ? opt.hooks.postprocess(html) : html).catch(throwError);
7280
+ }
7281
+ try {
7282
+ if (opt.hooks) {
7283
+ src = opt.hooks.preprocess(src);
7284
+ }
7285
+ const tokens = lexer(src, opt);
7286
+ if (opt.walkTokens) {
7287
+ this.walkTokens(tokens, opt.walkTokens);
7288
+ }
7289
+ let html = parser(tokens, opt);
7290
+ if (opt.hooks) {
7291
+ html = opt.hooks.postprocess(html);
7292
+ }
7293
+ return html;
7294
+ } catch (e) {
7295
+ return throwError(e);
7296
+ }
7297
+ };
5049
7298
  }
5050
- /**
5051
- Get leading and trailing whitespace from a string. Values of
5052
- leading or trailing property of the return object will be undefined
5053
- if there is no match.
5054
- */
5055
- getEnclosingWhitespace(text) {
5056
- return {
5057
- leading: (text.match(/^(\s+)/) || [undefined])[0],
5058
- trailing: (text.match(/(\s+)$/) || [undefined])[0]
7299
+ #onError(silent, async) {
7300
+ return e => {
7301
+ e.message += '\nPlease report this to https://github.com/markedjs/marked.';
7302
+ if (silent) {
7303
+ const msg = '<p>An error occurred:</p><pre>' + escape(e.message + '', true) + '</pre>';
7304
+ if (async) {
7305
+ return Promise.resolve(msg);
7306
+ }
7307
+ return msg;
7308
+ }
7309
+ if (async) {
7310
+ return Promise.reject(e);
7311
+ }
7312
+ throw e;
5059
7313
  };
5060
7314
  }
5061
7315
  }
7316
+ const markedInstance = new Marked();
7317
+ function marked(src, opt) {
7318
+ return markedInstance.parse(src, opt);
7319
+ }
7320
+ /**
7321
+ * Sets the default options.
7322
+ *
7323
+ * @param options Hash of options
7324
+ */
7325
+ marked.options = marked.setOptions = function (options) {
7326
+ markedInstance.setOptions(options);
7327
+ marked.defaults = markedInstance.defaults;
7328
+ changeDefaults(marked.defaults);
7329
+ return marked;
7330
+ };
7331
+ /**
7332
+ * Gets the original marked default options.
7333
+ */
7334
+ marked.getDefaults = _getDefaults;
7335
+ marked.defaults = _defaults;
7336
+ /**
7337
+ * Use Extension
7338
+ */
7339
+ marked.use = function () {
7340
+ markedInstance.use(...arguments);
7341
+ marked.defaults = markedInstance.defaults;
7342
+ changeDefaults(marked.defaults);
7343
+ return marked;
7344
+ };
7345
+ /**
7346
+ * Run callback for every token
7347
+ */
7348
+ marked.walkTokens = function (tokens, callback) {
7349
+ return markedInstance.walkTokens(tokens, callback);
7350
+ };
7351
+ /**
7352
+ * Compiles markdown to HTML without enclosing `p` tag.
7353
+ *
7354
+ * @param src String of markdown source to be compiled
7355
+ * @param options Hash of options
7356
+ * @return String of compiled HTML
7357
+ */
7358
+ marked.parseInline = markedInstance.parseInline;
7359
+ /**
7360
+ * Expose
7361
+ */
7362
+ marked.Parser = _Parser;
7363
+ marked.parser = _Parser.parse;
7364
+ marked.Renderer = _Renderer;
7365
+ marked.TextRenderer = _TextRenderer;
7366
+ marked.Lexer = _Lexer;
7367
+ marked.lexer = _Lexer.lex;
7368
+ marked.Tokenizer = _Tokenizer;
7369
+ marked.Hooks = _Hooks;
7370
+ marked.parse = marked;
7371
+ marked.options;
7372
+ marked.setOptions;
7373
+ marked.use;
7374
+ marked.walkTokens;
7375
+ marked.parseInline;
7376
+ _Parser.parse;
7377
+ _Lexer.lex;
5062
7378
 
5063
7379
  const Paragraph = Node.create({
5064
7380
  name: 'paragraph',
@@ -8165,7 +10481,7 @@ const Underline = Mark$1.create({
8165
10481
  }
8166
10482
  });
8167
10483
 
8168
- const serializerNodes = {
10484
+ const mdSerializerNodes = {
8169
10485
  ...defaultMarkdownSerializer.nodes,
8170
10486
  [Paragraph.name]: defaultMarkdownSerializer.nodes.paragraph,
8171
10487
  [BulletList.name]: defaultMarkdownSerializer.nodes.bullet_list,
@@ -8175,7 +10491,7 @@ const serializerNodes = {
8175
10491
  [CodeBlock.name]: defaultMarkdownSerializer.nodes.code_block,
8176
10492
  [Blockquote.name]: defaultMarkdownSerializer.nodes.blockquote
8177
10493
  };
8178
- const serializerMarks = {
10494
+ const mdSerializerMarks = {
8179
10495
  ...defaultMarkdownSerializer.marks,
8180
10496
  [Bold.name]: defaultMarkdownSerializer.marks.strong,
8181
10497
  [Strike.name]: {
@@ -8212,67 +10528,24 @@ const serializerMarks = {
8212
10528
  }
8213
10529
  }
8214
10530
  };
8215
- const isPlainURL = (link, parent, index, side) => {
10531
+ function isPlainURL(link, parent, index, side) {
8216
10532
  if (link.attrs.title || !/^\w+:/.test(link.attrs.href)) return false;
8217
10533
  const content = parent.child(index + (side < 0 ? -1 : 0));
8218
10534
  if (!content.isText || content.text !== link.attrs.href || content.marks[content.marks.length - 1] !== link) return false;
8219
10535
  if (index === (side < 0 ? 1 : parent.childCount - 1)) return true;
8220
10536
  const next = parent.child(index + (side < 0 ? -2 : 1));
8221
10537
  return !link.isInSet(next.marks);
8222
- };
8223
- const parseMd = md => {
8224
- //ul
8225
- md = md.replace(/^\s*\n\*/gm, '<ul>\n*');
8226
- md = md.replace(/^(\*.+)\s*\n([^*])/gm, '$1\n</ul>\n\n$2');
8227
- md = md.replace(/^\*(.+)/gm, '<li>$1</li>');
8228
- //ol
8229
- md = md.replace(/^\s*\n\d\./gm, '<ol>\n1.');
8230
- md = md.replace(/^(\d\..+)\s*\n([^\d.])/gm, '$1\n</ol>\n\n$2');
8231
- md = md.replace(/^\d\.(.+)/gm, '<li>$1</li>');
8232
- //blockquote
8233
- md = md.replace(/^>(.+)/gm, '<blockquote>$1</blockquote>');
8234
- //h
8235
- md = md.replace(/[#]{6}(.+)/g, '<h6>$1</h6>');
8236
- md = md.replace(/[#]{5}(.+)/g, '<h5>$1</h5>');
8237
- md = md.replace(/[#]{4}(.+)/g, '<h4>$1</h4>');
8238
- md = md.replace(/[#]{3}(.+)/g, '<h3>$1</h3>');
8239
- md = md.replace(/[#]{2}(.+)/g, '<h2>$1</h2>');
8240
- md = md.replace(/[#]{1}(.+)/g, '<h1>$1</h1>');
8241
- //alt h
8242
- md = md.replace(/^(.+)\n=+/gm, '<h1>$1</h1>');
8243
- md = md.replace(/^(.+)\n-+/gm, '<h2>$1</h2>');
8244
- //images
8245
- md = md.replace(/!\[([^\]]+)\]\(([^)]+)\)/g, '<img src="$2" alt="$1" />');
8246
- //links
8247
- md = md.replace(/[[]{1}([^\]]+)[\]]{1}[(]{1}([^)"]+)("(.+)")?[)]{1}/g, '<a href="$2" title="$4">$1</a>');
8248
- //font styles
8249
- md = md.replace(/[*_]{2}([^*_]+)[*_]{2}/g, '<b>$1</b>');
8250
- md = md.replace(/[*_]{1}([^*_]+)[*_]{1}/g, '<i>$1</i>');
8251
- md = md.replace(/[=]{2}([^=]+)[=]{2}/g, '<mark>$1</mark>');
8252
- md = md.replace(/[~]{2}([^~]+)[~]{2}/g, '<del>$1</del>');
8253
- //pre
8254
- md = md.replace(/^\s*\n```(([^\s]+))?/gm, '<pre class="$2">');
8255
- md = md.replace(/^```\s*\n/gm, '</pre>\n\n');
8256
- //code
8257
- md = md.replace(/[`]{1}([^`]+)[`]{1}/g, '<code>$1</code>');
8258
- //p
8259
- md = md.replace(/^\s*(\n)?(.+)/gm, function (m) {
8260
- return /<(\/)?(h\d|ul|ol|li|blockquote|pre|img)/.test(m) ? m : '<p>' + m + '</p>';
8261
- });
8262
- //strip p from pre
8263
- md = md.replace(/(<pre.+>)\s*\n<p>(.+)<\/p>/gm, '$1$2');
8264
- return md;
8265
- };
8266
- const serialize = (schema, content) => {
10538
+ }
10539
+ function serialize(schema, content) {
10540
+ const mdSerializer = new MarkdownSerializer(mdSerializerNodes, mdSerializerMarks);
8267
10541
  const proseMirrorDocument = schema.nodeFromJSON(content);
8268
- const serializer = new MarkdownSerializer(serializerNodes, serializerMarks);
8269
- return serializer.serialize(proseMirrorDocument, {
10542
+ return mdSerializer.serialize(proseMirrorDocument, {
8270
10543
  tightLists: true
8271
10544
  });
8272
- };
8273
- const deserialize = (schema, content) => {
10545
+ }
10546
+ function deserialize(schema, content) {
8274
10547
  if (!content) return null;
8275
- const html = parseMd(content);
10548
+ const html = marked.parse(content);
8276
10549
  if (!html) return null;
8277
10550
  const parser = new DOMParser();
8278
10551
  const {
@@ -8282,6 +10555,6 @@ const deserialize = (schema, content) => {
8282
10555
  body.append(document.createComment(content));
8283
10556
  const state = DOMParser$1.fromSchema(schema).parse(body);
8284
10557
  return state.toJSON();
8285
- };
10558
+ }
8286
10559
 
8287
10560
  export { Blockquote as B, CodeBlock as C, HardBreak as H, Italic as I, ListItem$1 as L, OrderedList as O, Paragraph as P, Strike as S, Underline as U, Bold as a, BulletList as b, Link as c, deserialize as d, Highlight as e, serialize as s };