@digipair/skill-marked 0.118.1

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.
@@ -0,0 +1,2271 @@
1
+ /**
2
+ * marked v6.0.0 - a markdown parser
3
+ * Copyright (c) 2011-2023, Christopher Jeffrey. (MIT Licensed)
4
+ * https://github.com/markedjs/marked
5
+ */ /**
6
+ * DO NOT EDIT THIS FILE
7
+ * The code in this file is generated from files in ./src/
8
+ */ var __accessCheck = (obj, member, msg)=>{
9
+ if (!member.has(obj)) throw TypeError("Cannot " + msg);
10
+ };
11
+ var __privateAdd = (obj, member, value)=>{
12
+ if (member.has(obj)) throw TypeError("Cannot add the same private member more than once");
13
+ member instanceof WeakSet ? member.add(obj) : member.set(obj, value);
14
+ };
15
+ var __privateMethod = (obj, member, method)=>{
16
+ __accessCheck(obj, member, "access private method");
17
+ return method;
18
+ };
19
+ // src/defaults.ts
20
+ function _getDefaults() {
21
+ return {
22
+ async: false,
23
+ baseUrl: null,
24
+ breaks: false,
25
+ extensions: null,
26
+ gfm: true,
27
+ headerIds: true,
28
+ headerPrefix: "",
29
+ highlight: null,
30
+ hooks: null,
31
+ langPrefix: "language-",
32
+ mangle: true,
33
+ pedantic: false,
34
+ renderer: null,
35
+ sanitize: false,
36
+ sanitizer: null,
37
+ silent: false,
38
+ smartypants: false,
39
+ tokenizer: null,
40
+ walkTokens: null,
41
+ xhtml: false
42
+ };
43
+ }
44
+ var _defaults = _getDefaults();
45
+ function changeDefaults(newDefaults) {
46
+ _defaults = newDefaults;
47
+ }
48
+ // src/helpers.ts
49
+ var escapeTest = /[&<>"']/;
50
+ var escapeReplace = new RegExp(escapeTest.source, "g");
51
+ var escapeTestNoEncode = /[<>"']|&(?!(#\d{1,7}|#[Xx][a-fA-F0-9]{1,6}|\w+);)/;
52
+ var escapeReplaceNoEncode = new RegExp(escapeTestNoEncode.source, "g");
53
+ var escapeReplacements = {
54
+ "&": "&amp;",
55
+ "<": "&lt;",
56
+ ">": "&gt;",
57
+ '"': "&quot;",
58
+ "'": "&#39;"
59
+ };
60
+ var getEscapeReplacement = (ch)=>escapeReplacements[ch];
61
+ function escape(html, encode) {
62
+ if (encode) {
63
+ if (escapeTest.test(html)) {
64
+ return html.replace(escapeReplace, getEscapeReplacement);
65
+ }
66
+ } else {
67
+ if (escapeTestNoEncode.test(html)) {
68
+ return html.replace(escapeReplaceNoEncode, getEscapeReplacement);
69
+ }
70
+ }
71
+ return html;
72
+ }
73
+ var unescapeTest = /&(#(?:\d+)|(?:#x[0-9A-Fa-f]+)|(?:\w+));?/ig;
74
+ function unescape(html) {
75
+ return html.replace(unescapeTest, (_, n)=>{
76
+ n = n.toLowerCase();
77
+ if (n === "colon") return ":";
78
+ if (n.charAt(0) === "#") {
79
+ return n.charAt(1) === "x" ? String.fromCharCode(parseInt(n.substring(2), 16)) : String.fromCharCode(+n.substring(1));
80
+ }
81
+ return "";
82
+ });
83
+ }
84
+ var caret = /(^|[^\[])\^/g;
85
+ function edit(regex, opt) {
86
+ regex = typeof regex === "string" ? regex : regex.source;
87
+ opt = opt || "";
88
+ const obj = {
89
+ replace: (name, val)=>{
90
+ val = typeof val === "object" && "source" in val ? val.source : val;
91
+ val = val.replace(caret, "$1");
92
+ regex = regex.replace(name, val);
93
+ return obj;
94
+ },
95
+ getRegex: ()=>{
96
+ return new RegExp(regex, opt);
97
+ }
98
+ };
99
+ return obj;
100
+ }
101
+ var nonWordAndColonTest = /[^\w:]/g;
102
+ var originIndependentUrl = /^$|^[a-z][a-z0-9+.-]*:|^[?#]/i;
103
+ function cleanUrl(sanitize, base, href) {
104
+ if (sanitize) {
105
+ let prot;
106
+ try {
107
+ prot = decodeURIComponent(unescape(href)).replace(nonWordAndColonTest, "").toLowerCase();
108
+ } catch (e) {
109
+ return null;
110
+ }
111
+ if (prot.indexOf("javascript:") === 0 || prot.indexOf("vbscript:") === 0 || prot.indexOf("data:") === 0) {
112
+ return null;
113
+ }
114
+ }
115
+ if (base && !originIndependentUrl.test(href)) {
116
+ href = resolveUrl(base, href);
117
+ }
118
+ try {
119
+ href = encodeURI(href).replace(/%25/g, "%");
120
+ } catch (e) {
121
+ return null;
122
+ }
123
+ return href;
124
+ }
125
+ var baseUrls = {};
126
+ var justDomain = /^[^:]+:\/*[^/]*$/;
127
+ var protocol = /^([^:]+:)[\s\S]*$/;
128
+ var domain = /^([^:]+:\/*[^/]*)[\s\S]*$/;
129
+ function resolveUrl(base, href) {
130
+ if (!baseUrls[" " + base]) {
131
+ if (justDomain.test(base)) {
132
+ baseUrls[" " + base] = base + "/";
133
+ } else {
134
+ baseUrls[" " + base] = rtrim(base, "/", true);
135
+ }
136
+ }
137
+ base = baseUrls[" " + base];
138
+ const relativeBase = base.indexOf(":") === -1;
139
+ if (href.substring(0, 2) === "//") {
140
+ if (relativeBase) {
141
+ return href;
142
+ }
143
+ return base.replace(protocol, "$1") + href;
144
+ } else if (href.charAt(0) === "/") {
145
+ if (relativeBase) {
146
+ return href;
147
+ }
148
+ return base.replace(domain, "$1") + href;
149
+ } else {
150
+ return base + href;
151
+ }
152
+ }
153
+ var noopTest = {
154
+ exec: ()=>null
155
+ };
156
+ function splitCells(tableRow, count) {
157
+ const row = tableRow.replace(/\|/g, (match, offset, str)=>{
158
+ let escaped = false, curr = offset;
159
+ while(--curr >= 0 && str[curr] === "\\")escaped = !escaped;
160
+ if (escaped) {
161
+ return "|";
162
+ } else {
163
+ return " |";
164
+ }
165
+ }), cells = row.split(/ \|/);
166
+ let i = 0;
167
+ if (!cells[0].trim()) {
168
+ cells.shift();
169
+ }
170
+ if (cells.length > 0 && !cells[cells.length - 1].trim()) {
171
+ cells.pop();
172
+ }
173
+ if (cells.length > count) {
174
+ cells.splice(count);
175
+ } else {
176
+ while(cells.length < count)cells.push("");
177
+ }
178
+ for(; i < cells.length; i++){
179
+ cells[i] = cells[i].trim().replace(/\\\|/g, "|");
180
+ }
181
+ return cells;
182
+ }
183
+ function rtrim(str, c, invert) {
184
+ const l = str.length;
185
+ if (l === 0) {
186
+ return "";
187
+ }
188
+ let suffLen = 0;
189
+ while(suffLen < l){
190
+ const currChar = str.charAt(l - suffLen - 1);
191
+ if (currChar === c && !invert) {
192
+ suffLen++;
193
+ } else if (currChar !== c && invert) {
194
+ suffLen++;
195
+ } else {
196
+ break;
197
+ }
198
+ }
199
+ return str.slice(0, l - suffLen);
200
+ }
201
+ function findClosingBracket(str, b) {
202
+ if (str.indexOf(b[1]) === -1) {
203
+ return -1;
204
+ }
205
+ const l = str.length;
206
+ let level = 0, i = 0;
207
+ for(; i < l; i++){
208
+ if (str[i] === "\\") {
209
+ i++;
210
+ } else if (str[i] === b[0]) {
211
+ level++;
212
+ } else if (str[i] === b[1]) {
213
+ level--;
214
+ if (level < 0) {
215
+ return i;
216
+ }
217
+ }
218
+ }
219
+ return -1;
220
+ }
221
+ function checkDeprecations(opt, callback) {
222
+ if (!opt || opt.silent) {
223
+ return;
224
+ }
225
+ if (callback) {
226
+ console.warn("marked(): callback is deprecated since version 5.0.0, should not be used and will be removed in the future. Read more here: https://marked.js.org/using_pro#async");
227
+ }
228
+ if (opt.sanitize || opt.sanitizer) {
229
+ console.warn("marked(): sanitize and sanitizer parameters are deprecated since version 0.7.0, should not be used and will be removed in the future. Read more here: https://marked.js.org/#/USING_ADVANCED.md#options");
230
+ }
231
+ if (opt.highlight || opt.langPrefix !== "language-") {
232
+ console.warn("marked(): highlight and langPrefix parameters are deprecated since version 5.0.0, should not be used and will be removed in the future. Instead use https://www.npmjs.com/package/marked-highlight.");
233
+ }
234
+ if (opt.mangle) {
235
+ console.warn("marked(): mangle parameter is enabled by default, but is deprecated since version 5.0.0, and will be removed in the future. To clear this warning, install https://www.npmjs.com/package/marked-mangle, or disable by setting `{mangle: false}`.");
236
+ }
237
+ if (opt.baseUrl) {
238
+ console.warn("marked(): baseUrl parameter is deprecated since version 5.0.0, should not be used and will be removed in the future. Instead use https://www.npmjs.com/package/marked-base-url.");
239
+ }
240
+ if (opt.smartypants) {
241
+ console.warn("marked(): smartypants parameter is deprecated since version 5.0.0, should not be used and will be removed in the future. Instead use https://www.npmjs.com/package/marked-smartypants.");
242
+ }
243
+ if (opt.xhtml) {
244
+ console.warn("marked(): xhtml parameter is deprecated since version 5.0.0, should not be used and will be removed in the future. Instead use https://www.npmjs.com/package/marked-xhtml.");
245
+ }
246
+ if (opt.headerIds || opt.headerPrefix) {
247
+ console.warn("marked(): headerIds and headerPrefix parameters enabled by default, but are deprecated since version 5.0.0, and will be removed in the future. To clear this warning, install https://www.npmjs.com/package/marked-gfm-heading-id, or disable by setting `{headerIds: false}`.");
248
+ }
249
+ }
250
+ // src/Tokenizer.ts
251
+ function outputLink(cap, link, raw, lexer2) {
252
+ const href = link.href;
253
+ const title = link.title ? escape(link.title) : null;
254
+ const text = cap[1].replace(/\\([\[\]])/g, "$1");
255
+ if (cap[0].charAt(0) !== "!") {
256
+ lexer2.state.inLink = true;
257
+ const token = {
258
+ type: "link",
259
+ raw,
260
+ href,
261
+ title,
262
+ text,
263
+ tokens: lexer2.inlineTokens(text)
264
+ };
265
+ lexer2.state.inLink = false;
266
+ return token;
267
+ }
268
+ return {
269
+ type: "image",
270
+ raw,
271
+ href,
272
+ title,
273
+ text: escape(text)
274
+ };
275
+ }
276
+ function indentCodeCompensation(raw, text) {
277
+ const matchIndentToCode = raw.match(/^(\s+)(?:```)/);
278
+ if (matchIndentToCode === null) {
279
+ return text;
280
+ }
281
+ const indentToCode = matchIndentToCode[1];
282
+ return text.split("\n").map((node)=>{
283
+ const matchIndentInNode = node.match(/^\s+/);
284
+ if (matchIndentInNode === null) {
285
+ return node;
286
+ }
287
+ const [indentInNode] = matchIndentInNode;
288
+ if (indentInNode.length >= indentToCode.length) {
289
+ return node.slice(indentToCode.length);
290
+ }
291
+ return node;
292
+ }).join("\n");
293
+ }
294
+ var _Tokenizer = class {
295
+ constructor(options2){
296
+ this.options = options2 || _defaults;
297
+ }
298
+ space(src) {
299
+ const cap = this.rules.block.newline.exec(src);
300
+ if (cap && cap[0].length > 0) {
301
+ return {
302
+ type: "space",
303
+ raw: cap[0]
304
+ };
305
+ }
306
+ }
307
+ code(src) {
308
+ const cap = this.rules.block.code.exec(src);
309
+ if (cap) {
310
+ const text = cap[0].replace(/^ {1,4}/gm, "");
311
+ return {
312
+ type: "code",
313
+ raw: cap[0],
314
+ codeBlockStyle: "indented",
315
+ text: !this.options.pedantic ? rtrim(text, "\n") : text
316
+ };
317
+ }
318
+ }
319
+ fences(src) {
320
+ const cap = this.rules.block.fences.exec(src);
321
+ if (cap) {
322
+ const raw = cap[0];
323
+ const text = indentCodeCompensation(raw, cap[3] || "");
324
+ return {
325
+ type: "code",
326
+ raw,
327
+ lang: cap[2] ? cap[2].trim().replace(this.rules.inline._escapes, "$1") : cap[2],
328
+ text
329
+ };
330
+ }
331
+ }
332
+ heading(src) {
333
+ const cap = this.rules.block.heading.exec(src);
334
+ if (cap) {
335
+ let text = cap[2].trim();
336
+ if (/#$/.test(text)) {
337
+ const trimmed = rtrim(text, "#");
338
+ if (this.options.pedantic) {
339
+ text = trimmed.trim();
340
+ } else if (!trimmed || / $/.test(trimmed)) {
341
+ text = trimmed.trim();
342
+ }
343
+ }
344
+ return {
345
+ type: "heading",
346
+ raw: cap[0],
347
+ depth: cap[1].length,
348
+ text,
349
+ tokens: this.lexer.inline(text)
350
+ };
351
+ }
352
+ }
353
+ hr(src) {
354
+ const cap = this.rules.block.hr.exec(src);
355
+ if (cap) {
356
+ return {
357
+ type: "hr",
358
+ raw: cap[0]
359
+ };
360
+ }
361
+ }
362
+ blockquote(src) {
363
+ const cap = this.rules.block.blockquote.exec(src);
364
+ if (cap) {
365
+ const text = cap[0].replace(/^ *>[ \t]?/gm, "");
366
+ const top = this.lexer.state.top;
367
+ this.lexer.state.top = true;
368
+ const tokens = this.lexer.blockTokens(text);
369
+ this.lexer.state.top = top;
370
+ return {
371
+ type: "blockquote",
372
+ raw: cap[0],
373
+ tokens,
374
+ text
375
+ };
376
+ }
377
+ }
378
+ list(src) {
379
+ let cap = this.rules.block.list.exec(src);
380
+ if (cap) {
381
+ let raw, istask, ischecked, indent, i, blankLine, endsWithBlankLine, line, nextLine, rawLine, itemContents, endEarly;
382
+ let bull = cap[1].trim();
383
+ const isordered = bull.length > 1;
384
+ const list = {
385
+ type: "list",
386
+ raw: "",
387
+ ordered: isordered,
388
+ start: isordered ? +bull.slice(0, -1) : "",
389
+ loose: false,
390
+ items: []
391
+ };
392
+ bull = isordered ? `\\d{1,9}\\${bull.slice(-1)}` : `\\${bull}`;
393
+ if (this.options.pedantic) {
394
+ bull = isordered ? bull : "[*+-]";
395
+ }
396
+ const itemRegex = new RegExp(`^( {0,3}${bull})((?:[ ][^\\n]*)?(?:\\n|$))`);
397
+ while(src){
398
+ endEarly = false;
399
+ if (!(cap = itemRegex.exec(src))) {
400
+ break;
401
+ }
402
+ if (this.rules.block.hr.test(src)) {
403
+ break;
404
+ }
405
+ raw = cap[0];
406
+ src = src.substring(raw.length);
407
+ line = cap[2].split("\n", 1)[0].replace(/^\t+/, (t)=>" ".repeat(3 * t.length));
408
+ nextLine = src.split("\n", 1)[0];
409
+ if (this.options.pedantic) {
410
+ indent = 2;
411
+ itemContents = line.trimLeft();
412
+ } else {
413
+ indent = cap[2].search(/[^ ]/);
414
+ indent = indent > 4 ? 1 : indent;
415
+ itemContents = line.slice(indent);
416
+ indent += cap[1].length;
417
+ }
418
+ blankLine = false;
419
+ if (!line && /^ *$/.test(nextLine)) {
420
+ raw += nextLine + "\n";
421
+ src = src.substring(nextLine.length + 1);
422
+ endEarly = true;
423
+ }
424
+ if (!endEarly) {
425
+ const nextBulletRegex = new RegExp(`^ {0,${Math.min(3, indent - 1)}}(?:[*+-]|\\d{1,9}[.)])((?:[ ][^\\n]*)?(?:\\n|$))`);
426
+ const hrRegex = new RegExp(`^ {0,${Math.min(3, indent - 1)}}((?:- *){3,}|(?:_ *){3,}|(?:\\* *){3,})(?:\\n+|$)`);
427
+ const fencesBeginRegex = new RegExp(`^ {0,${Math.min(3, indent - 1)}}(?:\`\`\`|~~~)`);
428
+ const headingBeginRegex = new RegExp(`^ {0,${Math.min(3, indent - 1)}}#`);
429
+ while(src){
430
+ rawLine = src.split("\n", 1)[0];
431
+ nextLine = rawLine;
432
+ if (this.options.pedantic) {
433
+ nextLine = nextLine.replace(/^ {1,4}(?=( {4})*[^ ])/g, " ");
434
+ }
435
+ if (fencesBeginRegex.test(nextLine)) {
436
+ break;
437
+ }
438
+ if (headingBeginRegex.test(nextLine)) {
439
+ break;
440
+ }
441
+ if (nextBulletRegex.test(nextLine)) {
442
+ break;
443
+ }
444
+ if (hrRegex.test(src)) {
445
+ break;
446
+ }
447
+ if (nextLine.search(/[^ ]/) >= indent || !nextLine.trim()) {
448
+ itemContents += "\n" + nextLine.slice(indent);
449
+ } else {
450
+ if (blankLine) {
451
+ break;
452
+ }
453
+ if (line.search(/[^ ]/) >= 4) {
454
+ break;
455
+ }
456
+ if (fencesBeginRegex.test(line)) {
457
+ break;
458
+ }
459
+ if (headingBeginRegex.test(line)) {
460
+ break;
461
+ }
462
+ if (hrRegex.test(line)) {
463
+ break;
464
+ }
465
+ itemContents += "\n" + nextLine;
466
+ }
467
+ if (!blankLine && !nextLine.trim()) {
468
+ blankLine = true;
469
+ }
470
+ raw += rawLine + "\n";
471
+ src = src.substring(rawLine.length + 1);
472
+ line = nextLine.slice(indent);
473
+ }
474
+ }
475
+ if (!list.loose) {
476
+ if (endsWithBlankLine) {
477
+ list.loose = true;
478
+ } else if (/\n *\n *$/.test(raw)) {
479
+ endsWithBlankLine = true;
480
+ }
481
+ }
482
+ if (this.options.gfm) {
483
+ istask = /^\[[ xX]\] /.exec(itemContents);
484
+ if (istask) {
485
+ ischecked = istask[0] !== "[ ] ";
486
+ itemContents = itemContents.replace(/^\[[ xX]\] +/, "");
487
+ }
488
+ }
489
+ list.items.push({
490
+ type: "list_item",
491
+ raw,
492
+ task: !!istask,
493
+ checked: ischecked,
494
+ loose: false,
495
+ text: itemContents
496
+ });
497
+ list.raw += raw;
498
+ }
499
+ list.items[list.items.length - 1].raw = raw.trimRight();
500
+ list.items[list.items.length - 1].text = itemContents.trimRight();
501
+ list.raw = list.raw.trimRight();
502
+ const l = list.items.length;
503
+ for(i = 0; i < l; i++){
504
+ this.lexer.state.top = false;
505
+ list.items[i].tokens = this.lexer.blockTokens(list.items[i].text, []);
506
+ if (!list.loose) {
507
+ const spacers = list.items[i].tokens.filter((t)=>t.type === "space");
508
+ const hasMultipleLineBreaks = spacers.length > 0 && spacers.some((t)=>/\n.*\n/.test(t.raw));
509
+ list.loose = hasMultipleLineBreaks;
510
+ }
511
+ }
512
+ if (list.loose) {
513
+ for(i = 0; i < l; i++){
514
+ list.items[i].loose = true;
515
+ }
516
+ }
517
+ return list;
518
+ }
519
+ }
520
+ html(src) {
521
+ const cap = this.rules.block.html.exec(src);
522
+ if (cap) {
523
+ const token = {
524
+ type: "html",
525
+ block: true,
526
+ raw: cap[0],
527
+ pre: !this.options.sanitizer && (cap[1] === "pre" || cap[1] === "script" || cap[1] === "style"),
528
+ text: cap[0]
529
+ };
530
+ if (this.options.sanitize) {
531
+ const text = this.options.sanitizer ? this.options.sanitizer(cap[0]) : escape(cap[0]);
532
+ const paragraph = token;
533
+ paragraph.type = "paragraph";
534
+ paragraph.text = text;
535
+ paragraph.tokens = this.lexer.inline(text);
536
+ }
537
+ return token;
538
+ }
539
+ }
540
+ def(src) {
541
+ const cap = this.rules.block.def.exec(src);
542
+ if (cap) {
543
+ const tag = cap[1].toLowerCase().replace(/\s+/g, " ");
544
+ const href = cap[2] ? cap[2].replace(/^<(.*)>$/, "$1").replace(this.rules.inline._escapes, "$1") : "";
545
+ const title = cap[3] ? cap[3].substring(1, cap[3].length - 1).replace(this.rules.inline._escapes, "$1") : cap[3];
546
+ return {
547
+ type: "def",
548
+ tag,
549
+ raw: cap[0],
550
+ href,
551
+ title
552
+ };
553
+ }
554
+ }
555
+ table(src) {
556
+ const cap = this.rules.block.table.exec(src);
557
+ if (cap) {
558
+ const item = {
559
+ type: "table",
560
+ // splitCells expects a number as second argument
561
+ // @ts-expect-error
562
+ header: splitCells(cap[1]).map((c)=>{
563
+ return {
564
+ text: c
565
+ };
566
+ }),
567
+ align: cap[2].replace(/^ *|\| *$/g, "").split(/ *\| */),
568
+ rows: cap[3] && cap[3].trim() ? cap[3].replace(/\n[ \t]*$/, "").split("\n") : []
569
+ };
570
+ if (item.header.length === item.align.length) {
571
+ item.raw = cap[0];
572
+ let l = item.align.length;
573
+ let i, j, k, row;
574
+ for(i = 0; i < l; i++){
575
+ if (/^ *-+: *$/.test(item.align[i])) {
576
+ item.align[i] = "right";
577
+ } else if (/^ *:-+: *$/.test(item.align[i])) {
578
+ item.align[i] = "center";
579
+ } else if (/^ *:-+ *$/.test(item.align[i])) {
580
+ item.align[i] = "left";
581
+ } else {
582
+ item.align[i] = null;
583
+ }
584
+ }
585
+ l = item.rows.length;
586
+ for(i = 0; i < l; i++){
587
+ item.rows[i] = splitCells(item.rows[i], item.header.length).map((c)=>{
588
+ return {
589
+ text: c
590
+ };
591
+ });
592
+ }
593
+ l = item.header.length;
594
+ for(j = 0; j < l; j++){
595
+ item.header[j].tokens = this.lexer.inline(item.header[j].text);
596
+ }
597
+ l = item.rows.length;
598
+ for(j = 0; j < l; j++){
599
+ row = item.rows[j];
600
+ for(k = 0; k < row.length; k++){
601
+ row[k].tokens = this.lexer.inline(row[k].text);
602
+ }
603
+ }
604
+ return item;
605
+ }
606
+ }
607
+ }
608
+ lheading(src) {
609
+ const cap = this.rules.block.lheading.exec(src);
610
+ if (cap) {
611
+ return {
612
+ type: "heading",
613
+ raw: cap[0],
614
+ depth: cap[2].charAt(0) === "=" ? 1 : 2,
615
+ text: cap[1],
616
+ tokens: this.lexer.inline(cap[1])
617
+ };
618
+ }
619
+ }
620
+ paragraph(src) {
621
+ const cap = this.rules.block.paragraph.exec(src);
622
+ if (cap) {
623
+ const text = cap[1].charAt(cap[1].length - 1) === "\n" ? cap[1].slice(0, -1) : cap[1];
624
+ return {
625
+ type: "paragraph",
626
+ raw: cap[0],
627
+ text,
628
+ tokens: this.lexer.inline(text)
629
+ };
630
+ }
631
+ }
632
+ text(src) {
633
+ const cap = this.rules.block.text.exec(src);
634
+ if (cap) {
635
+ return {
636
+ type: "text",
637
+ raw: cap[0],
638
+ text: cap[0],
639
+ tokens: this.lexer.inline(cap[0])
640
+ };
641
+ }
642
+ }
643
+ escape(src) {
644
+ const cap = this.rules.inline.escape.exec(src);
645
+ if (cap) {
646
+ return {
647
+ type: "escape",
648
+ raw: cap[0],
649
+ text: escape(cap[1])
650
+ };
651
+ }
652
+ }
653
+ tag(src) {
654
+ const cap = this.rules.inline.tag.exec(src);
655
+ if (cap) {
656
+ if (!this.lexer.state.inLink && /^<a /i.test(cap[0])) {
657
+ this.lexer.state.inLink = true;
658
+ } else if (this.lexer.state.inLink && /^<\/a>/i.test(cap[0])) {
659
+ this.lexer.state.inLink = false;
660
+ }
661
+ if (!this.lexer.state.inRawBlock && /^<(pre|code|kbd|script)(\s|>)/i.test(cap[0])) {
662
+ this.lexer.state.inRawBlock = true;
663
+ } else if (this.lexer.state.inRawBlock && /^<\/(pre|code|kbd|script)(\s|>)/i.test(cap[0])) {
664
+ this.lexer.state.inRawBlock = false;
665
+ }
666
+ return {
667
+ type: this.options.sanitize ? "text" : "html",
668
+ raw: cap[0],
669
+ inLink: this.lexer.state.inLink,
670
+ inRawBlock: this.lexer.state.inRawBlock,
671
+ block: false,
672
+ text: this.options.sanitize ? this.options.sanitizer ? this.options.sanitizer(cap[0]) : escape(cap[0]) : cap[0]
673
+ };
674
+ }
675
+ }
676
+ link(src) {
677
+ const cap = this.rules.inline.link.exec(src);
678
+ if (cap) {
679
+ const trimmedUrl = cap[2].trim();
680
+ if (!this.options.pedantic && /^</.test(trimmedUrl)) {
681
+ if (!/>$/.test(trimmedUrl)) {
682
+ return;
683
+ }
684
+ const rtrimSlash = rtrim(trimmedUrl.slice(0, -1), "\\");
685
+ if ((trimmedUrl.length - rtrimSlash.length) % 2 === 0) {
686
+ return;
687
+ }
688
+ } else {
689
+ const lastParenIndex = findClosingBracket(cap[2], "()");
690
+ if (lastParenIndex > -1) {
691
+ const start = cap[0].indexOf("!") === 0 ? 5 : 4;
692
+ const linkLen = start + cap[1].length + lastParenIndex;
693
+ cap[2] = cap[2].substring(0, lastParenIndex);
694
+ cap[0] = cap[0].substring(0, linkLen).trim();
695
+ cap[3] = "";
696
+ }
697
+ }
698
+ let href = cap[2];
699
+ let title = "";
700
+ if (this.options.pedantic) {
701
+ const link = /^([^'"]*[^\s])\s+(['"])(.*)\2/.exec(href);
702
+ if (link) {
703
+ href = link[1];
704
+ title = link[3];
705
+ }
706
+ } else {
707
+ title = cap[3] ? cap[3].slice(1, -1) : "";
708
+ }
709
+ href = href.trim();
710
+ if (/^</.test(href)) {
711
+ if (this.options.pedantic && !/>$/.test(trimmedUrl)) {
712
+ href = href.slice(1);
713
+ } else {
714
+ href = href.slice(1, -1);
715
+ }
716
+ }
717
+ return outputLink(cap, {
718
+ href: href ? href.replace(this.rules.inline._escapes, "$1") : href,
719
+ title: title ? title.replace(this.rules.inline._escapes, "$1") : title
720
+ }, cap[0], this.lexer);
721
+ }
722
+ }
723
+ reflink(src, links) {
724
+ let cap;
725
+ if ((cap = this.rules.inline.reflink.exec(src)) || (cap = this.rules.inline.nolink.exec(src))) {
726
+ let link = (cap[2] || cap[1]).replace(/\s+/g, " ");
727
+ link = links[link.toLowerCase()];
728
+ if (!link) {
729
+ const text = cap[0].charAt(0);
730
+ return {
731
+ type: "text",
732
+ raw: text,
733
+ text
734
+ };
735
+ }
736
+ return outputLink(cap, link, cap[0], this.lexer);
737
+ }
738
+ }
739
+ emStrong(src, maskedSrc, prevChar = "") {
740
+ let match = this.rules.inline.emStrong.lDelim.exec(src);
741
+ if (!match) return;
742
+ if (match[3] && prevChar.match(/[\p{L}\p{N}]/u)) return;
743
+ const nextChar = match[1] || match[2] || "";
744
+ if (!nextChar || !prevChar || this.rules.inline.punctuation.exec(prevChar)) {
745
+ const lLength = match[0].length - 1;
746
+ let rDelim, rLength, delimTotal = lLength, midDelimTotal = 0;
747
+ const endReg = match[0][0] === "*" ? this.rules.inline.emStrong.rDelimAst : this.rules.inline.emStrong.rDelimUnd;
748
+ endReg.lastIndex = 0;
749
+ maskedSrc = maskedSrc.slice(-1 * src.length + lLength);
750
+ while((match = endReg.exec(maskedSrc)) != null){
751
+ rDelim = match[1] || match[2] || match[3] || match[4] || match[5] || match[6];
752
+ if (!rDelim) continue;
753
+ rLength = rDelim.length;
754
+ if (match[3] || match[4]) {
755
+ delimTotal += rLength;
756
+ continue;
757
+ } else if (match[5] || match[6]) {
758
+ if (lLength % 3 && !((lLength + rLength) % 3)) {
759
+ midDelimTotal += rLength;
760
+ continue;
761
+ }
762
+ }
763
+ delimTotal -= rLength;
764
+ if (delimTotal > 0) continue;
765
+ rLength = Math.min(rLength, rLength + delimTotal + midDelimTotal);
766
+ const raw = src.slice(0, lLength + match.index + rLength + 1);
767
+ if (Math.min(lLength, rLength) % 2) {
768
+ const text2 = raw.slice(1, -1);
769
+ return {
770
+ type: "em",
771
+ raw,
772
+ text: text2,
773
+ tokens: this.lexer.inlineTokens(text2)
774
+ };
775
+ }
776
+ const text = raw.slice(2, -2);
777
+ return {
778
+ type: "strong",
779
+ raw,
780
+ text,
781
+ tokens: this.lexer.inlineTokens(text)
782
+ };
783
+ }
784
+ }
785
+ }
786
+ codespan(src) {
787
+ const cap = this.rules.inline.code.exec(src);
788
+ if (cap) {
789
+ let text = cap[2].replace(/\n/g, " ");
790
+ const hasNonSpaceChars = /[^ ]/.test(text);
791
+ const hasSpaceCharsOnBothEnds = /^ /.test(text) && / $/.test(text);
792
+ if (hasNonSpaceChars && hasSpaceCharsOnBothEnds) {
793
+ text = text.substring(1, text.length - 1);
794
+ }
795
+ text = escape(text, true);
796
+ return {
797
+ type: "codespan",
798
+ raw: cap[0],
799
+ text
800
+ };
801
+ }
802
+ }
803
+ br(src) {
804
+ const cap = this.rules.inline.br.exec(src);
805
+ if (cap) {
806
+ return {
807
+ type: "br",
808
+ raw: cap[0]
809
+ };
810
+ }
811
+ }
812
+ del(src) {
813
+ const cap = this.rules.inline.del.exec(src);
814
+ if (cap) {
815
+ return {
816
+ type: "del",
817
+ raw: cap[0],
818
+ text: cap[2],
819
+ tokens: this.lexer.inlineTokens(cap[2])
820
+ };
821
+ }
822
+ }
823
+ autolink(src, mangle2) {
824
+ const cap = this.rules.inline.autolink.exec(src);
825
+ if (cap) {
826
+ let text, href;
827
+ if (cap[2] === "@") {
828
+ text = escape(this.options.mangle ? mangle2(cap[1]) : cap[1]);
829
+ href = "mailto:" + text;
830
+ } else {
831
+ text = escape(cap[1]);
832
+ href = text;
833
+ }
834
+ return {
835
+ type: "link",
836
+ raw: cap[0],
837
+ text,
838
+ href,
839
+ tokens: [
840
+ {
841
+ type: "text",
842
+ raw: text,
843
+ text
844
+ }
845
+ ]
846
+ };
847
+ }
848
+ }
849
+ url(src, mangle2) {
850
+ let cap;
851
+ if (cap = this.rules.inline.url.exec(src)) {
852
+ let text, href;
853
+ if (cap[2] === "@") {
854
+ text = escape(this.options.mangle ? mangle2(cap[0]) : cap[0]);
855
+ href = "mailto:" + text;
856
+ } else {
857
+ let prevCapZero;
858
+ do {
859
+ prevCapZero = cap[0];
860
+ cap[0] = this.rules.inline._backpedal.exec(cap[0])[0];
861
+ }while (prevCapZero !== cap[0])
862
+ text = escape(cap[0]);
863
+ if (cap[1] === "www.") {
864
+ href = "http://" + cap[0];
865
+ } else {
866
+ href = cap[0];
867
+ }
868
+ }
869
+ return {
870
+ type: "link",
871
+ raw: cap[0],
872
+ text,
873
+ href,
874
+ tokens: [
875
+ {
876
+ type: "text",
877
+ raw: text,
878
+ text
879
+ }
880
+ ]
881
+ };
882
+ }
883
+ }
884
+ inlineText(src, smartypants2) {
885
+ const cap = this.rules.inline.text.exec(src);
886
+ if (cap) {
887
+ let text;
888
+ if (this.lexer.state.inRawBlock) {
889
+ text = this.options.sanitize ? this.options.sanitizer ? this.options.sanitizer(cap[0]) : escape(cap[0]) : cap[0];
890
+ } else {
891
+ text = escape(this.options.smartypants ? smartypants2(cap[0]) : cap[0]);
892
+ }
893
+ return {
894
+ type: "text",
895
+ raw: cap[0],
896
+ text
897
+ };
898
+ }
899
+ }
900
+ };
901
+ // src/rules.ts
902
+ var block = {
903
+ newline: /^(?: *(?:\n|$))+/,
904
+ code: /^( {4}[^\n]+(?:\n(?: *(?:\n|$))*)?)+/,
905
+ fences: /^ {0,3}(`{3,}(?=[^`\n]*(?:\n|$))|~{3,})([^\n]*)(?:\n|$)(?:|([\s\S]*?)(?:\n|$))(?: {0,3}\1[~`]* *(?=\n|$)|$)/,
906
+ hr: /^ {0,3}((?:-[\t ]*){3,}|(?:_[ \t]*){3,}|(?:\*[ \t]*){3,})(?:\n+|$)/,
907
+ heading: /^ {0,3}(#{1,6})(?=\s|$)(.*)(?:\n+|$)/,
908
+ blockquote: /^( {0,3}> ?(paragraph|[^\n]*)(?:\n|$))+/,
909
+ list: /^( {0,3}bull)([ \t][^\n]+?)?(?:\n|$)/,
910
+ html: "^ {0,3}(?:<(script|pre|style|textarea)[\\s>][\\s\\S]*?(?:</\\1>[^\\n]*\\n+|$)|comment[^\\n]*(\\n+|$)|<\\?[\\s\\S]*?(?:\\?>\\n*|$)|<![A-Z][\\s\\S]*?(?:>\\n*|$)|<!\\[CDATA\\[[\\s\\S]*?(?:\\]\\]>\\n*|$)|</?(tag)(?: +|\\n|/?>)[\\s\\S]*?(?:(?:\\n *)+\\n|$)|<(?!script|pre|style|textarea)([a-z][\\w-]*)(?:attribute)*? */?>(?=[ \\t]*(?:\\n|$))[\\s\\S]*?(?:(?:\\n *)+\\n|$)|</(?!script|pre|style|textarea)[a-z][\\w-]*\\s*>(?=[ \\t]*(?:\\n|$))[\\s\\S]*?(?:(?:\\n *)+\\n|$))",
911
+ def: /^ {0,3}\[(label)\]: *(?:\n *)?([^<\s][^\s]*|<.*?>)(?:(?: +(?:\n *)?| *\n *)(title))? *(?:\n+|$)/,
912
+ table: noopTest,
913
+ lheading: /^((?:(?!^bull ).|\n(?!\n|bull ))+?)\n {0,3}(=+|-+) *(?:\n+|$)/,
914
+ // regex template, placeholders will be replaced according to different paragraph
915
+ // interruption rules of commonmark and the original markdown spec:
916
+ _paragraph: /^([^\n]+(?:\n(?!hr|heading|lheading|blockquote|fences|list|html|table| +\n)[^\n]+)*)/,
917
+ text: /^[^\n]+/
918
+ };
919
+ block._label = /(?!\s*\])(?:\\.|[^\[\]\\])+/;
920
+ block._title = /(?:"(?:\\"?|[^"\\])*"|'[^'\n]*(?:\n[^'\n]+)*\n?'|\([^()]*\))/;
921
+ block.def = edit(block.def).replace("label", block._label).replace("title", block._title).getRegex();
922
+ block.bullet = /(?:[*+-]|\d{1,9}[.)])/;
923
+ block.listItemStart = edit(/^( *)(bull) */).replace("bull", block.bullet).getRegex();
924
+ 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();
925
+ 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";
926
+ block._comment = /<!--(?!-?>)[\s\S]*?(?:-->|$)/;
927
+ block.html = edit(block.html, "i").replace("comment", block._comment).replace("tag", block._tag).replace("attribute", / +[a-zA-Z:_][\w.:-]*(?: *= *"[^"\n]*"| *= *'[^'\n]*'| *= *[^\s"'=<>`]+)?/).getRegex();
928
+ block.lheading = edit(block.lheading).replace(/bull/g, block.bullet).getRegex();
929
+ block.paragraph = edit(block._paragraph).replace("hr", block.hr).replace("heading", " {0,3}#{1,6} ").replace("|lheading", "").replace("|table", "").replace("blockquote", " {0,3}>").replace("fences", " {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n").replace("list", " {0,3}(?:[*+-]|1[.)]) ").replace("html", "</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|textarea|!--)").replace("tag", block._tag).getRegex();
930
+ block.blockquote = edit(block.blockquote).replace("paragraph", block.paragraph).getRegex();
931
+ block.normal = {
932
+ ...block
933
+ };
934
+ block.gfm = {
935
+ ...block.normal,
936
+ table: "^ *([^\\n ].*\\|.*)\\n {0,3}(?:\\| *)?(:?-+:? *(?:\\| *:?-+:? *)*)(?:\\| *)?(?:\\n((?:(?! *\\n|hr|heading|blockquote|code|fences|list|html).*(?:\\n|$))*)\\n*|$)"
937
+ };
938
+ 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[.)]) ").replace("html", "</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|textarea|!--)").replace("tag", block._tag).getRegex();
939
+ block.gfm.paragraph = edit(block._paragraph).replace("hr", block.hr).replace("heading", " {0,3}#{1,6} ").replace("|lheading", "").replace("table", block.gfm.table).replace("blockquote", " {0,3}>").replace("fences", " {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n").replace("list", " {0,3}(?:[*+-]|1[.)]) ").replace("html", "</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|textarea|!--)").replace("tag", block._tag).getRegex();
940
+ block.pedantic = {
941
+ ...block.normal,
942
+ html: edit(`^ *(?:comment *(?:\\n|\\s*$)|<(tag)[\\s\\S]+?</\\1> *(?:\\n{2,}|\\s*$)|<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(),
943
+ def: /^ *\[([^\]]+)\]: *<?([^\s>]+)>?(?: +(["(][^\n]+[")]))? *(?:\n+|$)/,
944
+ heading: /^(#{1,6})(.*)(?:\n+|$)/,
945
+ fences: noopTest,
946
+ // fences not supported
947
+ lheading: /^(.+?)\n {0,3}(=+|-+) *(?:\n+|$)/,
948
+ 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()
949
+ };
950
+ var inline = {
951
+ escape: /^\\([!"#$%&'()*+,\-./:;<=>?@\[\]\\^_`{|}~])/,
952
+ autolink: /^<(scheme:[^\s\x00-\x1f<>]*|email)>/,
953
+ url: noopTest,
954
+ tag: "^comment|^</[a-zA-Z][\\w:-]*\\s*>|^<[a-zA-Z][\\w-]*(?:attribute)*?\\s*/?>|^<\\?[\\s\\S]*?\\?>|^<![a-zA-Z]+\\s[\\s\\S]*?>|^<!\\[CDATA\\[[\\s\\S]*?\\]\\]>",
955
+ // CDATA section
956
+ link: /^!?\[(label)\]\(\s*(href)(?:\s+(title))?\s*\)/,
957
+ reflink: /^!?\[(label)\]\[(ref)\]/,
958
+ nolink: /^!?\[(ref)\](?:\[\])?/,
959
+ reflinkSearch: "reflink|nolink(?!\\()",
960
+ emStrong: {
961
+ lDelim: /^(?:\*+(?:((?!\*)[punct])|[^\s*]))|^_+(?:((?!_)[punct])|([^\s_]))/,
962
+ // (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.
963
+ // | Skip orphan inside strong | Consume to delim | (1) #*** | (2) a***#, a*** | (3) #***a, ***a | (4) ***# | (5) #***# | (6) a***a
964
+ rDelimAst: /^[^_*]*?__[^_*]*?\*[^_*]*?(?=__)|[^*]+(?=[^*])|(?!\*)[punct](\*+)(?=[\s]|$)|[^punct\s](\*+)(?!\*)(?=[punct\s]|$)|(?!\*)[punct\s](\*+)(?=[^punct\s])|[\s](\*+)(?!\*)(?=[punct])|(?!\*)[punct](\*+)(?!\*)(?=[punct])|[^punct\s](\*+)(?=[^punct\s])/,
965
+ rDelimUnd: /^[^_*]*?\*\*[^_*]*?_[^_*]*?(?=\*\*)|[^_]+(?=[^_])|(?!_)[punct](_+)(?=[\s]|$)|[^punct\s](_+)(?!_)(?=[punct\s]|$)|(?!_)[punct\s](_+)(?=[^punct\s])|[\s](_+)(?!_)(?=[punct])|(?!_)[punct](_+)(?!_)(?=[punct])/
966
+ },
967
+ code: /^(`+)([^`]|[^`][\s\S]*?[^`])\1(?!`)/,
968
+ br: /^( {2,}|\\)\n(?!\s*$)/,
969
+ del: noopTest,
970
+ text: /^(`+|[^`])(?:(?= {2,}\n)|[\s\S]*?(?:(?=[\\<!\[`*_]|\b_|$)|[^ ](?= {2,}\n)))/,
971
+ punctuation: /^((?![*_])[\spunctuation])/
972
+ };
973
+ inline._punctuation = "\\p{P}$+<=>`^|~";
974
+ inline.punctuation = edit(inline.punctuation, "u").replace(/punctuation/g, inline._punctuation).getRegex();
975
+ inline.blockSkip = /\[[^[\]]*?\]\([^\(\)]*?\)|`[^`]*?`|<[^<>]*?>/g;
976
+ inline.anyPunctuation = /\\[punct]/g;
977
+ inline._escapes = /\\([punct])/g;
978
+ inline._comment = edit(block._comment).replace("(?:-->|$)", "-->").getRegex();
979
+ inline.emStrong.lDelim = edit(inline.emStrong.lDelim, "u").replace(/punct/g, inline._punctuation).getRegex();
980
+ inline.emStrong.rDelimAst = edit(inline.emStrong.rDelimAst, "gu").replace(/punct/g, inline._punctuation).getRegex();
981
+ inline.emStrong.rDelimUnd = edit(inline.emStrong.rDelimUnd, "gu").replace(/punct/g, inline._punctuation).getRegex();
982
+ inline.anyPunctuation = edit(inline.anyPunctuation, "gu").replace(/punct/g, inline._punctuation).getRegex();
983
+ inline._escapes = edit(inline._escapes, "gu").replace(/punct/g, inline._punctuation).getRegex();
984
+ inline._scheme = /[a-zA-Z][a-zA-Z0-9+.-]{1,31}/;
985
+ 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])?)+(?![-_])/;
986
+ inline.autolink = edit(inline.autolink).replace("scheme", inline._scheme).replace("email", inline._email).getRegex();
987
+ inline._attribute = /\s+[a-zA-Z:_][\w.:-]*(?:\s*=\s*"[^"]*"|\s*=\s*'[^']*'|\s*=\s*[^\s"'=<>`]+)?/;
988
+ inline.tag = edit(inline.tag).replace("comment", inline._comment).replace("attribute", inline._attribute).getRegex();
989
+ inline._label = /(?:\[(?:\\.|[^\[\]\\])*\]|\\.|`[^`]*`|[^\[\]\\`])*?/;
990
+ inline._href = /<(?:\\.|[^\n<>\\])+>|[^\s\x00-\x1f]*/;
991
+ inline._title = /"(?:\\"?|[^"\\])*"|'(?:\\'?|[^'\\])*'|\((?:\\\)?|[^)\\])*\)/;
992
+ inline.link = edit(inline.link).replace("label", inline._label).replace("href", inline._href).replace("title", inline._title).getRegex();
993
+ inline.reflink = edit(inline.reflink).replace("label", inline._label).replace("ref", block._label).getRegex();
994
+ inline.nolink = edit(inline.nolink).replace("ref", block._label).getRegex();
995
+ inline.reflinkSearch = edit(inline.reflinkSearch, "g").replace("reflink", inline.reflink).replace("nolink", inline.nolink).getRegex();
996
+ inline.normal = {
997
+ ...inline
998
+ };
999
+ inline.pedantic = {
1000
+ ...inline.normal,
1001
+ strong: {
1002
+ start: /^__|\*\*/,
1003
+ middle: /^__(?=\S)([\s\S]*?\S)__(?!_)|^\*\*(?=\S)([\s\S]*?\S)\*\*(?!\*)/,
1004
+ endAst: /\*\*(?!\*)/g,
1005
+ endUnd: /__(?!_)/g
1006
+ },
1007
+ em: {
1008
+ start: /^_|\*/,
1009
+ middle: /^()\*(?=\S)([\s\S]*?\S)\*(?!\*)|^_(?=\S)([\s\S]*?\S)_(?!_)/,
1010
+ endAst: /\*(?!\*)/g,
1011
+ endUnd: /_(?!_)/g
1012
+ },
1013
+ link: edit(/^!?\[(label)\]\((.*?)\)/).replace("label", inline._label).getRegex(),
1014
+ reflink: edit(/^!?\[(label)\]\s*\[([^\]]*)\]/).replace("label", inline._label).getRegex()
1015
+ };
1016
+ inline.gfm = {
1017
+ ...inline.normal,
1018
+ escape: edit(inline.escape).replace("])", "~|])").getRegex(),
1019
+ _extended_email: /[A-Za-z0-9._+-]+(@)[a-zA-Z0-9-_]+(?:\.[a-zA-Z0-9-_]*[a-zA-Z0-9])+(?![-_])/,
1020
+ url: /^((?:ftp|https?):\/\/|www\.)(?:[a-zA-Z0-9\-]+\.?)+[^\s<]*|^email/,
1021
+ _backpedal: /(?:[^?!.,:;*_'"~()&]+|\([^)]*\)|&(?![a-zA-Z0-9]+;$)|[?!.,:;*_'"~)]+(?!$))+/,
1022
+ del: /^(~~?)(?=[^\s~])([\s\S]*?[^\s~])\1(?=[^~]|$)/,
1023
+ text: /^([`~]+|[^`~])(?:(?= {2,}\n)|(?=[a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-]+@)|[\s\S]*?(?:(?=[\\<!\[`*~_]|\b_|https?:\/\/|ftp:\/\/|www\.|$)|[^ ](?= {2,}\n)|[^a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-](?=[a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-]+@)))/
1024
+ };
1025
+ inline.gfm.url = edit(inline.gfm.url, "i").replace("email", inline.gfm._extended_email).getRegex();
1026
+ inline.breaks = {
1027
+ ...inline.gfm,
1028
+ br: edit(inline.br).replace("{2,}", "*").getRegex(),
1029
+ text: edit(inline.gfm.text).replace("\\b_", "\\b_| {2,}\\n").replace(/\{2,\}/g, "*").getRegex()
1030
+ };
1031
+ // src/Lexer.ts
1032
+ function smartypants(text) {
1033
+ return text.replace(/---/g, "\u2014").replace(/--/g, "\u2013").replace(/(^|[-\u2014/(\[{"\s])'/g, "$1\u2018").replace(/'/g, "\u2019").replace(/(^|[-\u2014/(\[{\u2018\s])"/g, "$1\u201C").replace(/"/g, "\u201D").replace(/\.{3}/g, "\u2026");
1034
+ }
1035
+ function mangle(text) {
1036
+ let out = "", i, ch;
1037
+ const l = text.length;
1038
+ for(i = 0; i < l; i++){
1039
+ ch = text.charCodeAt(i);
1040
+ if (Math.random() > 0.5) {
1041
+ ch = "x" + ch.toString(16);
1042
+ }
1043
+ out += "&#" + ch + ";";
1044
+ }
1045
+ return out;
1046
+ }
1047
+ var _Lexer = class {
1048
+ constructor(options2){
1049
+ this.tokens = [];
1050
+ this.tokens.links = /* @__PURE__ */ Object.create(null);
1051
+ this.options = options2 || _defaults;
1052
+ this.options.tokenizer = this.options.tokenizer || new _Tokenizer();
1053
+ this.tokenizer = this.options.tokenizer;
1054
+ this.tokenizer.options = this.options;
1055
+ this.tokenizer.lexer = this;
1056
+ this.inlineQueue = [];
1057
+ this.state = {
1058
+ inLink: false,
1059
+ inRawBlock: false,
1060
+ top: true
1061
+ };
1062
+ const rules = {
1063
+ block: block.normal,
1064
+ inline: inline.normal
1065
+ };
1066
+ if (this.options.pedantic) {
1067
+ rules.block = block.pedantic;
1068
+ rules.inline = inline.pedantic;
1069
+ } else if (this.options.gfm) {
1070
+ rules.block = block.gfm;
1071
+ if (this.options.breaks) {
1072
+ rules.inline = inline.breaks;
1073
+ } else {
1074
+ rules.inline = inline.gfm;
1075
+ }
1076
+ }
1077
+ this.tokenizer.rules = rules;
1078
+ }
1079
+ /**
1080
+ * Expose Rules
1081
+ */ static get rules() {
1082
+ return {
1083
+ block,
1084
+ inline
1085
+ };
1086
+ }
1087
+ /**
1088
+ * Static Lex Method
1089
+ */ static lex(src, options2) {
1090
+ const lexer2 = new _Lexer(options2);
1091
+ return lexer2.lex(src);
1092
+ }
1093
+ /**
1094
+ * Static Lex Inline Method
1095
+ */ static lexInline(src, options2) {
1096
+ const lexer2 = new _Lexer(options2);
1097
+ return lexer2.inlineTokens(src);
1098
+ }
1099
+ /**
1100
+ * Preprocessing
1101
+ */ lex(src) {
1102
+ src = src.replace(/\r\n|\r/g, "\n");
1103
+ this.blockTokens(src, this.tokens);
1104
+ let next;
1105
+ while(next = this.inlineQueue.shift()){
1106
+ this.inlineTokens(next.src, next.tokens);
1107
+ }
1108
+ return this.tokens;
1109
+ }
1110
+ blockTokens(src, tokens = []) {
1111
+ if (this.options.pedantic) {
1112
+ src = src.replace(/\t/g, " ").replace(/^ +$/gm, "");
1113
+ } else {
1114
+ src = src.replace(/^( *)(\t+)/gm, (_, leading, tabs)=>{
1115
+ return leading + " ".repeat(tabs.length);
1116
+ });
1117
+ }
1118
+ let token, lastToken, cutSrc, lastParagraphClipped;
1119
+ while(src){
1120
+ if (this.options.extensions && this.options.extensions.block && this.options.extensions.block.some((extTokenizer)=>{
1121
+ if (token = extTokenizer.call({
1122
+ lexer: this
1123
+ }, src, tokens)) {
1124
+ src = src.substring(token.raw.length);
1125
+ tokens.push(token);
1126
+ return true;
1127
+ }
1128
+ return false;
1129
+ })) {
1130
+ continue;
1131
+ }
1132
+ if (token = this.tokenizer.space(src)) {
1133
+ src = src.substring(token.raw.length);
1134
+ if (token.raw.length === 1 && tokens.length > 0) {
1135
+ tokens[tokens.length - 1].raw += "\n";
1136
+ } else {
1137
+ tokens.push(token);
1138
+ }
1139
+ continue;
1140
+ }
1141
+ if (token = this.tokenizer.code(src)) {
1142
+ src = src.substring(token.raw.length);
1143
+ lastToken = tokens[tokens.length - 1];
1144
+ if (lastToken && (lastToken.type === "paragraph" || lastToken.type === "text")) {
1145
+ lastToken.raw += "\n" + token.raw;
1146
+ lastToken.text += "\n" + token.text;
1147
+ this.inlineQueue[this.inlineQueue.length - 1].src = lastToken.text;
1148
+ } else {
1149
+ tokens.push(token);
1150
+ }
1151
+ continue;
1152
+ }
1153
+ if (token = this.tokenizer.fences(src)) {
1154
+ src = src.substring(token.raw.length);
1155
+ tokens.push(token);
1156
+ continue;
1157
+ }
1158
+ if (token = this.tokenizer.heading(src)) {
1159
+ src = src.substring(token.raw.length);
1160
+ tokens.push(token);
1161
+ continue;
1162
+ }
1163
+ if (token = this.tokenizer.hr(src)) {
1164
+ src = src.substring(token.raw.length);
1165
+ tokens.push(token);
1166
+ continue;
1167
+ }
1168
+ if (token = this.tokenizer.blockquote(src)) {
1169
+ src = src.substring(token.raw.length);
1170
+ tokens.push(token);
1171
+ continue;
1172
+ }
1173
+ if (token = this.tokenizer.list(src)) {
1174
+ src = src.substring(token.raw.length);
1175
+ tokens.push(token);
1176
+ continue;
1177
+ }
1178
+ if (token = this.tokenizer.html(src)) {
1179
+ src = src.substring(token.raw.length);
1180
+ tokens.push(token);
1181
+ continue;
1182
+ }
1183
+ if (token = this.tokenizer.def(src)) {
1184
+ src = src.substring(token.raw.length);
1185
+ lastToken = tokens[tokens.length - 1];
1186
+ if (lastToken && (lastToken.type === "paragraph" || lastToken.type === "text")) {
1187
+ lastToken.raw += "\n" + token.raw;
1188
+ lastToken.text += "\n" + token.raw;
1189
+ this.inlineQueue[this.inlineQueue.length - 1].src = lastToken.text;
1190
+ } else if (!this.tokens.links[token.tag]) {
1191
+ this.tokens.links[token.tag] = {
1192
+ href: token.href,
1193
+ title: token.title
1194
+ };
1195
+ }
1196
+ continue;
1197
+ }
1198
+ if (token = this.tokenizer.table(src)) {
1199
+ src = src.substring(token.raw.length);
1200
+ tokens.push(token);
1201
+ continue;
1202
+ }
1203
+ if (token = this.tokenizer.lheading(src)) {
1204
+ src = src.substring(token.raw.length);
1205
+ tokens.push(token);
1206
+ continue;
1207
+ }
1208
+ cutSrc = src;
1209
+ if (this.options.extensions && this.options.extensions.startBlock) {
1210
+ let startIndex = Infinity;
1211
+ const tempSrc = src.slice(1);
1212
+ let tempStart;
1213
+ this.options.extensions.startBlock.forEach((getStartIndex)=>{
1214
+ tempStart = getStartIndex.call({
1215
+ lexer: this
1216
+ }, tempSrc);
1217
+ if (typeof tempStart === "number" && tempStart >= 0) {
1218
+ startIndex = Math.min(startIndex, tempStart);
1219
+ }
1220
+ });
1221
+ if (startIndex < Infinity && startIndex >= 0) {
1222
+ cutSrc = src.substring(0, startIndex + 1);
1223
+ }
1224
+ }
1225
+ if (this.state.top && (token = this.tokenizer.paragraph(cutSrc))) {
1226
+ lastToken = tokens[tokens.length - 1];
1227
+ if (lastParagraphClipped && lastToken.type === "paragraph") {
1228
+ lastToken.raw += "\n" + token.raw;
1229
+ lastToken.text += "\n" + token.text;
1230
+ this.inlineQueue.pop();
1231
+ this.inlineQueue[this.inlineQueue.length - 1].src = lastToken.text;
1232
+ } else {
1233
+ tokens.push(token);
1234
+ }
1235
+ lastParagraphClipped = cutSrc.length !== src.length;
1236
+ src = src.substring(token.raw.length);
1237
+ continue;
1238
+ }
1239
+ if (token = this.tokenizer.text(src)) {
1240
+ src = src.substring(token.raw.length);
1241
+ lastToken = tokens[tokens.length - 1];
1242
+ if (lastToken && lastToken.type === "text") {
1243
+ lastToken.raw += "\n" + token.raw;
1244
+ lastToken.text += "\n" + token.text;
1245
+ this.inlineQueue.pop();
1246
+ this.inlineQueue[this.inlineQueue.length - 1].src = lastToken.text;
1247
+ } else {
1248
+ tokens.push(token);
1249
+ }
1250
+ continue;
1251
+ }
1252
+ if (src) {
1253
+ const errMsg = "Infinite loop on byte: " + src.charCodeAt(0);
1254
+ if (this.options.silent) {
1255
+ console.error(errMsg);
1256
+ break;
1257
+ } else {
1258
+ throw new Error(errMsg);
1259
+ }
1260
+ }
1261
+ }
1262
+ this.state.top = true;
1263
+ return tokens;
1264
+ }
1265
+ inline(src, tokens = []) {
1266
+ this.inlineQueue.push({
1267
+ src,
1268
+ tokens
1269
+ });
1270
+ return tokens;
1271
+ }
1272
+ /**
1273
+ * Lexing/Compiling
1274
+ */ inlineTokens(src, tokens = []) {
1275
+ let token, lastToken, cutSrc;
1276
+ let maskedSrc = src;
1277
+ let match;
1278
+ let keepPrevChar, prevChar;
1279
+ if (this.tokens.links) {
1280
+ const links = Object.keys(this.tokens.links);
1281
+ if (links.length > 0) {
1282
+ while((match = this.tokenizer.rules.inline.reflinkSearch.exec(maskedSrc)) != null){
1283
+ if (links.includes(match[0].slice(match[0].lastIndexOf("[") + 1, -1))) {
1284
+ maskedSrc = maskedSrc.slice(0, match.index) + "[" + "a".repeat(match[0].length - 2) + "]" + maskedSrc.slice(this.tokenizer.rules.inline.reflinkSearch.lastIndex);
1285
+ }
1286
+ }
1287
+ }
1288
+ }
1289
+ while((match = this.tokenizer.rules.inline.blockSkip.exec(maskedSrc)) != null){
1290
+ maskedSrc = maskedSrc.slice(0, match.index) + "[" + "a".repeat(match[0].length - 2) + "]" + maskedSrc.slice(this.tokenizer.rules.inline.blockSkip.lastIndex);
1291
+ }
1292
+ while((match = this.tokenizer.rules.inline.anyPunctuation.exec(maskedSrc)) != null){
1293
+ maskedSrc = maskedSrc.slice(0, match.index) + "++" + maskedSrc.slice(this.tokenizer.rules.inline.anyPunctuation.lastIndex);
1294
+ }
1295
+ while(src){
1296
+ if (!keepPrevChar) {
1297
+ prevChar = "";
1298
+ }
1299
+ keepPrevChar = false;
1300
+ if (this.options.extensions && this.options.extensions.inline && this.options.extensions.inline.some((extTokenizer)=>{
1301
+ if (token = extTokenizer.call({
1302
+ lexer: this
1303
+ }, src, tokens)) {
1304
+ src = src.substring(token.raw.length);
1305
+ tokens.push(token);
1306
+ return true;
1307
+ }
1308
+ return false;
1309
+ })) {
1310
+ continue;
1311
+ }
1312
+ if (token = this.tokenizer.escape(src)) {
1313
+ src = src.substring(token.raw.length);
1314
+ tokens.push(token);
1315
+ continue;
1316
+ }
1317
+ if (token = this.tokenizer.tag(src)) {
1318
+ src = src.substring(token.raw.length);
1319
+ lastToken = tokens[tokens.length - 1];
1320
+ if (lastToken && token.type === "text" && lastToken.type === "text") {
1321
+ lastToken.raw += token.raw;
1322
+ lastToken.text += token.text;
1323
+ } else {
1324
+ tokens.push(token);
1325
+ }
1326
+ continue;
1327
+ }
1328
+ if (token = this.tokenizer.link(src)) {
1329
+ src = src.substring(token.raw.length);
1330
+ tokens.push(token);
1331
+ continue;
1332
+ }
1333
+ if (token = this.tokenizer.reflink(src, this.tokens.links)) {
1334
+ src = src.substring(token.raw.length);
1335
+ lastToken = tokens[tokens.length - 1];
1336
+ if (lastToken && token.type === "text" && lastToken.type === "text") {
1337
+ lastToken.raw += token.raw;
1338
+ lastToken.text += token.text;
1339
+ } else {
1340
+ tokens.push(token);
1341
+ }
1342
+ continue;
1343
+ }
1344
+ if (token = this.tokenizer.emStrong(src, maskedSrc, prevChar)) {
1345
+ src = src.substring(token.raw.length);
1346
+ tokens.push(token);
1347
+ continue;
1348
+ }
1349
+ if (token = this.tokenizer.codespan(src)) {
1350
+ src = src.substring(token.raw.length);
1351
+ tokens.push(token);
1352
+ continue;
1353
+ }
1354
+ if (token = this.tokenizer.br(src)) {
1355
+ src = src.substring(token.raw.length);
1356
+ tokens.push(token);
1357
+ continue;
1358
+ }
1359
+ if (token = this.tokenizer.del(src)) {
1360
+ src = src.substring(token.raw.length);
1361
+ tokens.push(token);
1362
+ continue;
1363
+ }
1364
+ if (token = this.tokenizer.autolink(src, mangle)) {
1365
+ src = src.substring(token.raw.length);
1366
+ tokens.push(token);
1367
+ continue;
1368
+ }
1369
+ if (!this.state.inLink && (token = this.tokenizer.url(src, mangle))) {
1370
+ src = src.substring(token.raw.length);
1371
+ tokens.push(token);
1372
+ continue;
1373
+ }
1374
+ cutSrc = src;
1375
+ if (this.options.extensions && this.options.extensions.startInline) {
1376
+ let startIndex = Infinity;
1377
+ const tempSrc = src.slice(1);
1378
+ let tempStart;
1379
+ this.options.extensions.startInline.forEach((getStartIndex)=>{
1380
+ tempStart = getStartIndex.call({
1381
+ lexer: this
1382
+ }, tempSrc);
1383
+ if (typeof tempStart === "number" && tempStart >= 0) {
1384
+ startIndex = Math.min(startIndex, tempStart);
1385
+ }
1386
+ });
1387
+ if (startIndex < Infinity && startIndex >= 0) {
1388
+ cutSrc = src.substring(0, startIndex + 1);
1389
+ }
1390
+ }
1391
+ if (token = this.tokenizer.inlineText(cutSrc, smartypants)) {
1392
+ src = src.substring(token.raw.length);
1393
+ if (token.raw.slice(-1) !== "_") {
1394
+ prevChar = token.raw.slice(-1);
1395
+ }
1396
+ keepPrevChar = true;
1397
+ lastToken = tokens[tokens.length - 1];
1398
+ if (lastToken && lastToken.type === "text") {
1399
+ lastToken.raw += token.raw;
1400
+ lastToken.text += token.text;
1401
+ } else {
1402
+ tokens.push(token);
1403
+ }
1404
+ continue;
1405
+ }
1406
+ if (src) {
1407
+ const errMsg = "Infinite loop on byte: " + src.charCodeAt(0);
1408
+ if (this.options.silent) {
1409
+ console.error(errMsg);
1410
+ break;
1411
+ } else {
1412
+ throw new Error(errMsg);
1413
+ }
1414
+ }
1415
+ }
1416
+ return tokens;
1417
+ }
1418
+ };
1419
+ // src/Renderer.ts
1420
+ var _Renderer = class {
1421
+ constructor(options2){
1422
+ this.options = options2 || _defaults;
1423
+ }
1424
+ code(code, infostring, escaped) {
1425
+ const lang = (infostring || "").match(/\S*/)[0];
1426
+ if (this.options.highlight) {
1427
+ const out = this.options.highlight(code, lang);
1428
+ if (out != null && out !== code) {
1429
+ escaped = true;
1430
+ code = out;
1431
+ }
1432
+ }
1433
+ code = code.replace(/\n$/, "") + "\n";
1434
+ if (!lang) {
1435
+ return "<pre><code>" + (escaped ? code : escape(code, true)) + "</code></pre>\n";
1436
+ }
1437
+ return '<pre><code class="' + this.options.langPrefix + escape(lang) + '">' + (escaped ? code : escape(code, true)) + "</code></pre>\n";
1438
+ }
1439
+ blockquote(quote) {
1440
+ return `<blockquote>
1441
+ ${quote}</blockquote>
1442
+ `;
1443
+ }
1444
+ html(html, block2) {
1445
+ return html;
1446
+ }
1447
+ heading(text, level, raw, slugger) {
1448
+ if (this.options.headerIds) {
1449
+ const id = this.options.headerPrefix + slugger.slug(raw);
1450
+ return `<h${level} id="${id}">${text}</h${level}>
1451
+ `;
1452
+ }
1453
+ return `<h${level}>${text}</h${level}>
1454
+ `;
1455
+ }
1456
+ hr() {
1457
+ return this.options.xhtml ? "<hr/>\n" : "<hr>\n";
1458
+ }
1459
+ list(body, ordered, start) {
1460
+ const type = ordered ? "ol" : "ul", startatt = ordered && start !== 1 ? ' start="' + start + '"' : "";
1461
+ return "<" + type + startatt + ">\n" + body + "</" + type + ">\n";
1462
+ }
1463
+ listitem(text, task, checked) {
1464
+ return `<li>${text}</li>
1465
+ `;
1466
+ }
1467
+ checkbox(checked) {
1468
+ return "<input " + (checked ? 'checked="" ' : "") + 'disabled="" type="checkbox"' + (this.options.xhtml ? " /" : "") + "> ";
1469
+ }
1470
+ paragraph(text) {
1471
+ return `<p>${text}</p>
1472
+ `;
1473
+ }
1474
+ table(header, body) {
1475
+ if (body) body = `<tbody>${body}</tbody>`;
1476
+ return "<table>\n<thead>\n" + header + "</thead>\n" + body + "</table>\n";
1477
+ }
1478
+ tablerow(content) {
1479
+ return `<tr>
1480
+ ${content}</tr>
1481
+ `;
1482
+ }
1483
+ tablecell(content, flags) {
1484
+ const type = flags.header ? "th" : "td";
1485
+ const tag = flags.align ? `<${type} align="${flags.align}">` : `<${type}>`;
1486
+ return tag + content + `</${type}>
1487
+ `;
1488
+ }
1489
+ /**
1490
+ * span level renderer
1491
+ */ strong(text) {
1492
+ return `<strong>${text}</strong>`;
1493
+ }
1494
+ em(text) {
1495
+ return `<em>${text}</em>`;
1496
+ }
1497
+ codespan(text) {
1498
+ return `<code>${text}</code>`;
1499
+ }
1500
+ br() {
1501
+ return this.options.xhtml ? "<br/>" : "<br>";
1502
+ }
1503
+ del(text) {
1504
+ return `<del>${text}</del>`;
1505
+ }
1506
+ link(href, title, text) {
1507
+ href = cleanUrl(this.options.sanitize, this.options.baseUrl, href);
1508
+ if (href === null) {
1509
+ return text;
1510
+ }
1511
+ let out = '<a href="' + href + '"';
1512
+ if (title) {
1513
+ out += ' title="' + title + '"';
1514
+ }
1515
+ out += ">" + text + "</a>";
1516
+ return out;
1517
+ }
1518
+ image(href, title, text) {
1519
+ href = cleanUrl(this.options.sanitize, this.options.baseUrl, href);
1520
+ if (href === null) {
1521
+ return text;
1522
+ }
1523
+ let out = `<img src="${href}" alt="${text}"`;
1524
+ if (title) {
1525
+ out += ` title="${title}"`;
1526
+ }
1527
+ out += this.options.xhtml ? "/>" : ">";
1528
+ return out;
1529
+ }
1530
+ text(text) {
1531
+ return text;
1532
+ }
1533
+ };
1534
+ // src/TextRenderer.ts
1535
+ var _TextRenderer = class {
1536
+ // no need for block level renderers
1537
+ strong(text) {
1538
+ return text;
1539
+ }
1540
+ em(text) {
1541
+ return text;
1542
+ }
1543
+ codespan(text) {
1544
+ return text;
1545
+ }
1546
+ del(text) {
1547
+ return text;
1548
+ }
1549
+ html(text) {
1550
+ return text;
1551
+ }
1552
+ text(text) {
1553
+ return text;
1554
+ }
1555
+ link(href, title, text) {
1556
+ return "" + text;
1557
+ }
1558
+ image(href, title, text) {
1559
+ return "" + text;
1560
+ }
1561
+ br() {
1562
+ return "";
1563
+ }
1564
+ };
1565
+ // src/Slugger.ts
1566
+ var _Slugger = class {
1567
+ constructor(){
1568
+ this.seen = {};
1569
+ }
1570
+ serialize(value) {
1571
+ return value.toLowerCase().trim().replace(/<[!\/a-z].*?>/ig, "").replace(/[\u2000-\u206F\u2E00-\u2E7F\\'!"#$%&()*+,./:;<=>?@[\]^`{|}~]/g, "").replace(/\s/g, "-");
1572
+ }
1573
+ /**
1574
+ * Finds the next safe (unique) slug to use
1575
+ */ getNextSafeSlug(originalSlug, isDryRun) {
1576
+ let slug = originalSlug;
1577
+ let occurenceAccumulator = 0;
1578
+ if (this.seen.hasOwnProperty(slug)) {
1579
+ occurenceAccumulator = this.seen[originalSlug];
1580
+ do {
1581
+ occurenceAccumulator++;
1582
+ slug = originalSlug + "-" + occurenceAccumulator;
1583
+ }while (this.seen.hasOwnProperty(slug))
1584
+ }
1585
+ if (!isDryRun) {
1586
+ this.seen[originalSlug] = occurenceAccumulator;
1587
+ this.seen[slug] = 0;
1588
+ }
1589
+ return slug;
1590
+ }
1591
+ /**
1592
+ * Convert string to unique id
1593
+ */ slug(value, options2 = {}) {
1594
+ const slug = this.serialize(value);
1595
+ return this.getNextSafeSlug(slug, options2.dryrun);
1596
+ }
1597
+ };
1598
+ // src/Parser.ts
1599
+ var _Parser = class {
1600
+ constructor(options2){
1601
+ this.options = options2 || _defaults;
1602
+ this.options.renderer = this.options.renderer || new _Renderer();
1603
+ this.renderer = this.options.renderer;
1604
+ this.renderer.options = this.options;
1605
+ this.textRenderer = new _TextRenderer();
1606
+ this.slugger = new _Slugger();
1607
+ }
1608
+ /**
1609
+ * Static Parse Method
1610
+ */ static parse(tokens, options2) {
1611
+ const parser2 = new _Parser(options2);
1612
+ return parser2.parse(tokens);
1613
+ }
1614
+ /**
1615
+ * Static Parse Inline Method
1616
+ */ static parseInline(tokens, options2) {
1617
+ const parser2 = new _Parser(options2);
1618
+ return parser2.parseInline(tokens);
1619
+ }
1620
+ /**
1621
+ * Parse Loop
1622
+ */ parse(tokens, top = true) {
1623
+ let out = "", i, j, k, l2, l3, row, cell, header, body, token, ordered, start, loose, itemBody, item, checked, task, checkbox, ret;
1624
+ const l = tokens.length;
1625
+ for(i = 0; i < l; i++){
1626
+ token = tokens[i];
1627
+ if (this.options.extensions && this.options.extensions.renderers && this.options.extensions.renderers[token.type]) {
1628
+ ret = this.options.extensions.renderers[token.type].call({
1629
+ parser: this
1630
+ }, token);
1631
+ if (ret !== false || ![
1632
+ "space",
1633
+ "hr",
1634
+ "heading",
1635
+ "code",
1636
+ "table",
1637
+ "blockquote",
1638
+ "list",
1639
+ "html",
1640
+ "paragraph",
1641
+ "text"
1642
+ ].includes(token.type)) {
1643
+ out += ret || "";
1644
+ continue;
1645
+ }
1646
+ }
1647
+ switch(token.type){
1648
+ case "space":
1649
+ {
1650
+ continue;
1651
+ }
1652
+ case "hr":
1653
+ {
1654
+ out += this.renderer.hr();
1655
+ continue;
1656
+ }
1657
+ case "heading":
1658
+ {
1659
+ out += this.renderer.heading(this.parseInline(token.tokens), token.depth, unescape(this.parseInline(token.tokens, this.textRenderer)), this.slugger);
1660
+ continue;
1661
+ }
1662
+ case "code":
1663
+ {
1664
+ out += this.renderer.code(token.text, token.lang, !!token.escaped);
1665
+ continue;
1666
+ }
1667
+ case "table":
1668
+ {
1669
+ header = "";
1670
+ cell = "";
1671
+ l2 = token.header.length;
1672
+ for(j = 0; j < l2; j++){
1673
+ cell += this.renderer.tablecell(this.parseInline(token.header[j].tokens), {
1674
+ header: true,
1675
+ align: token.align[j]
1676
+ });
1677
+ }
1678
+ header += this.renderer.tablerow(cell);
1679
+ body = "";
1680
+ l2 = token.rows.length;
1681
+ for(j = 0; j < l2; j++){
1682
+ row = token.rows[j];
1683
+ cell = "";
1684
+ l3 = row.length;
1685
+ for(k = 0; k < l3; k++){
1686
+ cell += this.renderer.tablecell(this.parseInline(row[k].tokens), {
1687
+ header: false,
1688
+ align: token.align[k]
1689
+ });
1690
+ }
1691
+ body += this.renderer.tablerow(cell);
1692
+ }
1693
+ out += this.renderer.table(header, body);
1694
+ continue;
1695
+ }
1696
+ case "blockquote":
1697
+ {
1698
+ body = this.parse(token.tokens);
1699
+ out += this.renderer.blockquote(body);
1700
+ continue;
1701
+ }
1702
+ case "list":
1703
+ {
1704
+ ordered = token.ordered;
1705
+ start = token.start;
1706
+ loose = token.loose;
1707
+ l2 = token.items.length;
1708
+ body = "";
1709
+ for(j = 0; j < l2; j++){
1710
+ item = token.items[j];
1711
+ checked = item.checked;
1712
+ task = item.task;
1713
+ itemBody = "";
1714
+ if (item.task) {
1715
+ checkbox = this.renderer.checkbox(!!checked);
1716
+ if (loose) {
1717
+ if (item.tokens.length > 0 && item.tokens[0].type === "paragraph") {
1718
+ item.tokens[0].text = checkbox + " " + item.tokens[0].text;
1719
+ if (item.tokens[0].tokens && item.tokens[0].tokens.length > 0 && item.tokens[0].tokens[0].type === "text") {
1720
+ item.tokens[0].tokens[0].text = checkbox + " " + item.tokens[0].tokens[0].text;
1721
+ }
1722
+ } else {
1723
+ item.tokens.unshift({
1724
+ type: "text",
1725
+ text: checkbox
1726
+ });
1727
+ }
1728
+ } else {
1729
+ itemBody += checkbox;
1730
+ }
1731
+ }
1732
+ itemBody += this.parse(item.tokens, loose);
1733
+ body += this.renderer.listitem(itemBody, task, !!checked);
1734
+ }
1735
+ out += this.renderer.list(body, ordered, start);
1736
+ continue;
1737
+ }
1738
+ case "html":
1739
+ {
1740
+ out += this.renderer.html(token.text, token.block);
1741
+ continue;
1742
+ }
1743
+ case "paragraph":
1744
+ {
1745
+ out += this.renderer.paragraph(this.parseInline(token.tokens));
1746
+ continue;
1747
+ }
1748
+ case "text":
1749
+ {
1750
+ body = token.tokens ? this.parseInline(token.tokens) : token.text;
1751
+ while(i + 1 < l && tokens[i + 1].type === "text"){
1752
+ token = tokens[++i];
1753
+ body += "\n" + (token.tokens ? this.parseInline(token.tokens) : token.text);
1754
+ }
1755
+ out += top ? this.renderer.paragraph(body) : body;
1756
+ continue;
1757
+ }
1758
+ default:
1759
+ {
1760
+ const errMsg = 'Token with "' + token.type + '" type was not found.';
1761
+ if (this.options.silent) {
1762
+ console.error(errMsg);
1763
+ return "";
1764
+ } else {
1765
+ throw new Error(errMsg);
1766
+ }
1767
+ }
1768
+ }
1769
+ }
1770
+ return out;
1771
+ }
1772
+ /**
1773
+ * Parse Inline Tokens
1774
+ */ parseInline(tokens, renderer) {
1775
+ renderer = renderer || this.renderer;
1776
+ let out = "", i, token, ret;
1777
+ const l = tokens.length;
1778
+ for(i = 0; i < l; i++){
1779
+ token = tokens[i];
1780
+ if (this.options.extensions && this.options.extensions.renderers && this.options.extensions.renderers[token.type]) {
1781
+ ret = this.options.extensions.renderers[token.type].call({
1782
+ parser: this
1783
+ }, token);
1784
+ if (ret !== false || ![
1785
+ "escape",
1786
+ "html",
1787
+ "link",
1788
+ "image",
1789
+ "strong",
1790
+ "em",
1791
+ "codespan",
1792
+ "br",
1793
+ "del",
1794
+ "text"
1795
+ ].includes(token.type)) {
1796
+ out += ret || "";
1797
+ continue;
1798
+ }
1799
+ }
1800
+ switch(token.type){
1801
+ case "escape":
1802
+ {
1803
+ out += renderer.text(token.text);
1804
+ break;
1805
+ }
1806
+ case "html":
1807
+ {
1808
+ out += renderer.html(token.text);
1809
+ break;
1810
+ }
1811
+ case "link":
1812
+ {
1813
+ out += renderer.link(token.href, token.title, this.parseInline(token.tokens, renderer));
1814
+ break;
1815
+ }
1816
+ case "image":
1817
+ {
1818
+ out += renderer.image(token.href, token.title, token.text);
1819
+ break;
1820
+ }
1821
+ case "strong":
1822
+ {
1823
+ out += renderer.strong(this.parseInline(token.tokens, renderer));
1824
+ break;
1825
+ }
1826
+ case "em":
1827
+ {
1828
+ out += renderer.em(this.parseInline(token.tokens, renderer));
1829
+ break;
1830
+ }
1831
+ case "codespan":
1832
+ {
1833
+ out += renderer.codespan(token.text);
1834
+ break;
1835
+ }
1836
+ case "br":
1837
+ {
1838
+ out += renderer.br();
1839
+ break;
1840
+ }
1841
+ case "del":
1842
+ {
1843
+ out += renderer.del(this.parseInline(token.tokens, renderer));
1844
+ break;
1845
+ }
1846
+ case "text":
1847
+ {
1848
+ out += renderer.text(token.text);
1849
+ break;
1850
+ }
1851
+ default:
1852
+ {
1853
+ const errMsg = 'Token with "' + token.type + '" type was not found.';
1854
+ if (this.options.silent) {
1855
+ console.error(errMsg);
1856
+ return "";
1857
+ } else {
1858
+ throw new Error(errMsg);
1859
+ }
1860
+ }
1861
+ }
1862
+ }
1863
+ return out;
1864
+ }
1865
+ };
1866
+ // src/Hooks.ts
1867
+ var _Hooks = class {
1868
+ constructor(options2){
1869
+ this.options = options2 || _defaults;
1870
+ }
1871
+ /**
1872
+ * Process markdown before marked
1873
+ */ preprocess(markdown) {
1874
+ return markdown;
1875
+ }
1876
+ /**
1877
+ * Process HTML after marked is finished
1878
+ */ postprocess(html) {
1879
+ return html;
1880
+ }
1881
+ };
1882
+ _Hooks.passThroughHooks = /* @__PURE__ */ new Set([
1883
+ "preprocess",
1884
+ "postprocess"
1885
+ ]);
1886
+ // src/Instance.ts
1887
+ var _parseMarkdown, parseMarkdown_fn, _onError, onError_fn;
1888
+ var Marked = class {
1889
+ constructor(...args){
1890
+ __privateAdd(this, _parseMarkdown);
1891
+ __privateAdd(this, _onError);
1892
+ this.defaults = _getDefaults();
1893
+ this.options = this.setOptions;
1894
+ this.parse = __privateMethod(this, _parseMarkdown, parseMarkdown_fn).call(this, _Lexer.lex, _Parser.parse);
1895
+ this.parseInline = __privateMethod(this, _parseMarkdown, parseMarkdown_fn).call(this, _Lexer.lexInline, _Parser.parseInline);
1896
+ this.Parser = _Parser;
1897
+ this.parser = _Parser.parse;
1898
+ this.Renderer = _Renderer;
1899
+ this.TextRenderer = _TextRenderer;
1900
+ this.Lexer = _Lexer;
1901
+ this.lexer = _Lexer.lex;
1902
+ this.Tokenizer = _Tokenizer;
1903
+ this.Slugger = _Slugger;
1904
+ this.Hooks = _Hooks;
1905
+ this.use(...args);
1906
+ }
1907
+ /**
1908
+ * Run callback for every token
1909
+ */ walkTokens(tokens, callback) {
1910
+ let values = [];
1911
+ for (const token of tokens){
1912
+ values = values.concat(callback.call(this, token));
1913
+ switch(token.type){
1914
+ case "table":
1915
+ {
1916
+ for (const cell of token.header){
1917
+ values = values.concat(this.walkTokens(cell.tokens, callback));
1918
+ }
1919
+ for (const row of token.rows){
1920
+ for (const cell of row){
1921
+ values = values.concat(this.walkTokens(cell.tokens, callback));
1922
+ }
1923
+ }
1924
+ break;
1925
+ }
1926
+ case "list":
1927
+ {
1928
+ values = values.concat(this.walkTokens(token.items, callback));
1929
+ break;
1930
+ }
1931
+ default:
1932
+ {
1933
+ if (this.defaults.extensions && this.defaults.extensions.childTokens && this.defaults.extensions.childTokens[token.type]) {
1934
+ this.defaults.extensions.childTokens[token.type].forEach((childTokens)=>{
1935
+ values = values.concat(this.walkTokens(token[childTokens], callback));
1936
+ });
1937
+ } else if (token.tokens) {
1938
+ values = values.concat(this.walkTokens(token.tokens, callback));
1939
+ }
1940
+ }
1941
+ }
1942
+ }
1943
+ return values;
1944
+ }
1945
+ use(...args) {
1946
+ const extensions = this.defaults.extensions || {
1947
+ renderers: {},
1948
+ childTokens: {}
1949
+ };
1950
+ args.forEach((pack)=>{
1951
+ const opts = {
1952
+ ...pack
1953
+ };
1954
+ opts.async = this.defaults.async || opts.async || false;
1955
+ if (pack.extensions) {
1956
+ pack.extensions.forEach((ext)=>{
1957
+ if (!ext.name) {
1958
+ throw new Error("extension name required");
1959
+ }
1960
+ if ("renderer" in ext) {
1961
+ const prevRenderer = extensions.renderers[ext.name];
1962
+ if (prevRenderer) {
1963
+ extensions.renderers[ext.name] = function(...args2) {
1964
+ let ret = ext.renderer.apply(this, args2);
1965
+ if (ret === false) {
1966
+ ret = prevRenderer.apply(this, args2);
1967
+ }
1968
+ return ret;
1969
+ };
1970
+ } else {
1971
+ extensions.renderers[ext.name] = ext.renderer;
1972
+ }
1973
+ }
1974
+ if ("tokenizer" in ext) {
1975
+ if (!ext.level || ext.level !== "block" && ext.level !== "inline") {
1976
+ throw new Error("extension level must be 'block' or 'inline'");
1977
+ }
1978
+ if (extensions[ext.level]) {
1979
+ extensions[ext.level].unshift(ext.tokenizer);
1980
+ } else {
1981
+ extensions[ext.level] = [
1982
+ ext.tokenizer
1983
+ ];
1984
+ }
1985
+ if (ext.start) {
1986
+ if (ext.level === "block") {
1987
+ if (extensions.startBlock) {
1988
+ extensions.startBlock.push(ext.start);
1989
+ } else {
1990
+ extensions.startBlock = [
1991
+ ext.start
1992
+ ];
1993
+ }
1994
+ } else if (ext.level === "inline") {
1995
+ if (extensions.startInline) {
1996
+ extensions.startInline.push(ext.start);
1997
+ } else {
1998
+ extensions.startInline = [
1999
+ ext.start
2000
+ ];
2001
+ }
2002
+ }
2003
+ }
2004
+ }
2005
+ if ("childTokens" in ext && ext.childTokens) {
2006
+ extensions.childTokens[ext.name] = ext.childTokens;
2007
+ }
2008
+ });
2009
+ opts.extensions = extensions;
2010
+ }
2011
+ if (pack.renderer) {
2012
+ const renderer = this.defaults.renderer || new _Renderer(this.defaults);
2013
+ for(const prop in pack.renderer){
2014
+ const prevRenderer = renderer[prop];
2015
+ renderer[prop] = (...args2)=>{
2016
+ let ret = pack.renderer[prop].apply(renderer, args2);
2017
+ if (ret === false) {
2018
+ ret = prevRenderer.apply(renderer, args2);
2019
+ }
2020
+ return ret;
2021
+ };
2022
+ }
2023
+ opts.renderer = renderer;
2024
+ }
2025
+ if (pack.tokenizer) {
2026
+ const tokenizer = this.defaults.tokenizer || new _Tokenizer(this.defaults);
2027
+ for(const prop in pack.tokenizer){
2028
+ const prevTokenizer = tokenizer[prop];
2029
+ tokenizer[prop] = (...args2)=>{
2030
+ let ret = pack.tokenizer[prop].apply(tokenizer, args2);
2031
+ if (ret === false) {
2032
+ ret = prevTokenizer.apply(tokenizer, args2);
2033
+ }
2034
+ return ret;
2035
+ };
2036
+ }
2037
+ opts.tokenizer = tokenizer;
2038
+ }
2039
+ if (pack.hooks) {
2040
+ const hooks = this.defaults.hooks || new _Hooks();
2041
+ for(const prop in pack.hooks){
2042
+ const prevHook = hooks[prop];
2043
+ if (_Hooks.passThroughHooks.has(prop)) {
2044
+ hooks[prop] = (arg)=>{
2045
+ if (this.defaults.async) {
2046
+ return Promise.resolve(pack.hooks[prop].call(hooks, arg)).then((ret2)=>{
2047
+ return prevHook.call(hooks, ret2);
2048
+ });
2049
+ }
2050
+ const ret = pack.hooks[prop].call(hooks, arg);
2051
+ return prevHook.call(hooks, ret);
2052
+ };
2053
+ } else {
2054
+ hooks[prop] = (...args2)=>{
2055
+ let ret = pack.hooks[prop].apply(hooks, args2);
2056
+ if (ret === false) {
2057
+ ret = prevHook.apply(hooks, args2);
2058
+ }
2059
+ return ret;
2060
+ };
2061
+ }
2062
+ }
2063
+ opts.hooks = hooks;
2064
+ }
2065
+ if (pack.walkTokens) {
2066
+ const walkTokens2 = this.defaults.walkTokens;
2067
+ opts.walkTokens = function(token) {
2068
+ let values = [];
2069
+ values.push(pack.walkTokens.call(this, token));
2070
+ if (walkTokens2) {
2071
+ values = values.concat(walkTokens2.call(this, token));
2072
+ }
2073
+ return values;
2074
+ };
2075
+ }
2076
+ this.defaults = {
2077
+ ...this.defaults,
2078
+ ...opts
2079
+ };
2080
+ });
2081
+ return this;
2082
+ }
2083
+ setOptions(opt) {
2084
+ this.defaults = {
2085
+ ...this.defaults,
2086
+ ...opt
2087
+ };
2088
+ return this;
2089
+ }
2090
+ };
2091
+ _parseMarkdown = new WeakSet();
2092
+ parseMarkdown_fn = function(lexer2, parser2) {
2093
+ return (src, optOrCallback, callback)=>{
2094
+ if (typeof optOrCallback === "function") {
2095
+ callback = optOrCallback;
2096
+ optOrCallback = null;
2097
+ }
2098
+ const origOpt = {
2099
+ ...optOrCallback
2100
+ };
2101
+ const opt = {
2102
+ ...this.defaults,
2103
+ ...origOpt
2104
+ };
2105
+ const throwError = __privateMethod(this, _onError, onError_fn).call(this, !!opt.silent, !!opt.async, callback);
2106
+ if (typeof src === "undefined" || src === null) {
2107
+ return throwError(new Error("marked(): input parameter is undefined or null"));
2108
+ }
2109
+ if (typeof src !== "string") {
2110
+ return throwError(new Error("marked(): input parameter is of type " + Object.prototype.toString.call(src) + ", string expected"));
2111
+ }
2112
+ checkDeprecations(opt, callback);
2113
+ if (opt.hooks) {
2114
+ opt.hooks.options = opt;
2115
+ }
2116
+ if (callback) {
2117
+ const highlight = opt.highlight;
2118
+ let tokens;
2119
+ try {
2120
+ if (opt.hooks) {
2121
+ src = opt.hooks.preprocess(src);
2122
+ }
2123
+ tokens = lexer2(src, opt);
2124
+ } catch (e) {
2125
+ return throwError(e);
2126
+ }
2127
+ const done = (err)=>{
2128
+ let out;
2129
+ if (!err) {
2130
+ try {
2131
+ if (opt.walkTokens) {
2132
+ this.walkTokens(tokens, opt.walkTokens);
2133
+ }
2134
+ out = parser2(tokens, opt);
2135
+ if (opt.hooks) {
2136
+ out = opt.hooks.postprocess(out);
2137
+ }
2138
+ } catch (e) {
2139
+ err = e;
2140
+ }
2141
+ }
2142
+ opt.highlight = highlight;
2143
+ return err ? throwError(err) : callback(null, out);
2144
+ };
2145
+ if (!highlight || highlight.length < 3) {
2146
+ return done();
2147
+ }
2148
+ delete opt.highlight;
2149
+ if (!tokens.length) return done();
2150
+ let pending = 0;
2151
+ this.walkTokens(tokens, (token)=>{
2152
+ if (token.type === "code") {
2153
+ pending++;
2154
+ setTimeout(()=>{
2155
+ highlight(token.text, token.lang, (err, code)=>{
2156
+ if (err) {
2157
+ return done(err);
2158
+ }
2159
+ if (code != null && code !== token.text) {
2160
+ token.text = code;
2161
+ token.escaped = true;
2162
+ }
2163
+ pending--;
2164
+ if (pending === 0) {
2165
+ done();
2166
+ }
2167
+ });
2168
+ }, 0);
2169
+ }
2170
+ });
2171
+ if (pending === 0) {
2172
+ done();
2173
+ }
2174
+ return;
2175
+ }
2176
+ if (opt.async) {
2177
+ return Promise.resolve(opt.hooks ? opt.hooks.preprocess(src) : src).then((src2)=>lexer2(src2, opt)).then((tokens)=>opt.walkTokens ? Promise.all(this.walkTokens(tokens, opt.walkTokens)).then(()=>tokens) : tokens).then((tokens)=>parser2(tokens, opt)).then((html)=>opt.hooks ? opt.hooks.postprocess(html) : html).catch(throwError);
2178
+ }
2179
+ try {
2180
+ if (opt.hooks) {
2181
+ src = opt.hooks.preprocess(src);
2182
+ }
2183
+ const tokens = lexer2(src, opt);
2184
+ if (opt.walkTokens) {
2185
+ this.walkTokens(tokens, opt.walkTokens);
2186
+ }
2187
+ let html = parser2(tokens, opt);
2188
+ if (opt.hooks) {
2189
+ html = opt.hooks.postprocess(html);
2190
+ }
2191
+ return html;
2192
+ } catch (e) {
2193
+ return throwError(e);
2194
+ }
2195
+ };
2196
+ };
2197
+ _onError = new WeakSet();
2198
+ onError_fn = function(silent, async, callback) {
2199
+ return (e)=>{
2200
+ e.message += "\nPlease report this to https://github.com/markedjs/marked.";
2201
+ if (silent) {
2202
+ const msg = "<p>An error occurred:</p><pre>" + escape(e.message + "", true) + "</pre>";
2203
+ if (async) {
2204
+ return Promise.resolve(msg);
2205
+ }
2206
+ if (callback) {
2207
+ callback(null, msg);
2208
+ return;
2209
+ }
2210
+ return msg;
2211
+ }
2212
+ if (async) {
2213
+ return Promise.reject(e);
2214
+ }
2215
+ if (callback) {
2216
+ callback(e);
2217
+ return;
2218
+ }
2219
+ throw e;
2220
+ };
2221
+ };
2222
+ // src/marked.ts
2223
+ var markedInstance = new Marked();
2224
+ function marked(src, opt, callback) {
2225
+ return markedInstance.parse(src, opt, callback);
2226
+ }
2227
+ marked.options = marked.setOptions = function(options2) {
2228
+ markedInstance.setOptions(options2);
2229
+ marked.defaults = markedInstance.defaults;
2230
+ changeDefaults(marked.defaults);
2231
+ return marked;
2232
+ };
2233
+ marked.getDefaults = _getDefaults;
2234
+ marked.defaults = _defaults;
2235
+ marked.use = function(...args) {
2236
+ markedInstance.use(...args);
2237
+ marked.defaults = markedInstance.defaults;
2238
+ changeDefaults(marked.defaults);
2239
+ return marked;
2240
+ };
2241
+ marked.walkTokens = function(tokens, callback) {
2242
+ return markedInstance.walkTokens(tokens, callback);
2243
+ };
2244
+ marked.parseInline = markedInstance.parseInline;
2245
+ marked.Parser = _Parser;
2246
+ marked.parser = _Parser.parse;
2247
+ marked.Renderer = _Renderer;
2248
+ marked.TextRenderer = _TextRenderer;
2249
+ marked.Lexer = _Lexer;
2250
+ marked.lexer = _Lexer.lex;
2251
+ marked.Tokenizer = _Tokenizer;
2252
+ marked.Slugger = _Slugger;
2253
+ marked.Hooks = _Hooks;
2254
+ marked.parse = marked;
2255
+ marked.options;
2256
+ marked.setOptions;
2257
+ marked.use;
2258
+ marked.walkTokens;
2259
+ marked.parseInline;
2260
+ _Parser.parse;
2261
+ _Lexer.lex;
2262
+
2263
+ let SkillMarkedService = class SkillMarkedService {
2264
+ async convert(params, _pinsSettingsList, _context) {
2265
+ const { text = '' } = params;
2266
+ return marked.parse(text);
2267
+ }
2268
+ };
2269
+ const convert = (params, pinsSettingsList, context)=>new SkillMarkedService().convert(params, pinsSettingsList, context);
2270
+
2271
+ export { convert };