@waline/client 1.3.5 → 1.3.6

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 (50) hide show
  1. package/dist/Waline.min.d.ts +67 -60
  2. package/dist/Waline.min.js +1 -1
  3. package/dist/Waline.min.js.map +1 -1
  4. package/dist/Waline.noStyle.d.ts +67 -60
  5. package/dist/Waline.noStyle.js +1 -1
  6. package/dist/Waline.noStyle.js.map +1 -1
  7. package/package.json +1 -1
  8. package/dist/Waline.commonjs.min.js +0 -13676
  9. package/dist/Waline.commonjs.min.js.LICENSE.txt +0 -5
  10. package/dist/Waline.commonjs.min.js.map +0 -1
  11. package/dist/Waline.min.js.LICENSE.txt +0 -5
  12. package/dist/Waline.noStyle.js.LICENSE.txt +0 -5
  13. package/dist/markdown.commonjs.min.js +0 -2870
  14. package/dist/markdown.commonjs.min.js.map +0 -1
  15. package/dist/markdown.min.js +0 -2870
  16. package/dist/markdown.min.js.map +0 -1
  17. package/dist/markdown.noStyle.js +0 -2870
  18. package/dist/markdown.noStyle.js.map +0 -1
  19. package/test/dist/main.js +0 -0
  20. package/test/dist/main.js.LICENSE.txt +0 -355
  21. package/test/node_modules/.package-lock.json +0 -36
  22. package/test/node_modules/comment-regex/index.js +0 -13
  23. package/test/node_modules/comment-regex/license +0 -21
  24. package/test/node_modules/comment-regex/package.json +0 -41
  25. package/test/node_modules/comment-regex/readme.md +0 -52
  26. package/test/node_modules/hanabi/LICENSE +0 -21
  27. package/test/node_modules/hanabi/README.md +0 -43
  28. package/test/node_modules/hanabi/dist/hanabi.js +0 -68
  29. package/test/node_modules/hanabi/dist/hanabi.min.js +0 -2
  30. package/test/node_modules/hanabi/dist/hanabi.min.js.map +0 -1
  31. package/test/node_modules/hanabi/package.json +0 -57
  32. package/test/node_modules/marked/LICENSE.md +0 -44
  33. package/test/node_modules/marked/README.md +0 -74
  34. package/test/node_modules/marked/bin/marked +0 -215
  35. package/test/node_modules/marked/lib/marked.esm.js +0 -2637
  36. package/test/node_modules/marked/lib/marked.js +0 -2787
  37. package/test/node_modules/marked/man/marked.1 +0 -111
  38. package/test/node_modules/marked/man/marked.1.txt +0 -96
  39. package/test/node_modules/marked/marked.min.js +0 -6
  40. package/test/node_modules/marked/package.json +0 -88
  41. package/test/node_modules/marked/src/Lexer.js +0 -491
  42. package/test/node_modules/marked/src/Parser.js +0 -263
  43. package/test/node_modules/marked/src/Renderer.js +0 -166
  44. package/test/node_modules/marked/src/Slugger.js +0 -49
  45. package/test/node_modules/marked/src/TextRenderer.js +0 -42
  46. package/test/node_modules/marked/src/Tokenizer.js +0 -730
  47. package/test/node_modules/marked/src/defaults.js +0 -32
  48. package/test/node_modules/marked/src/helpers.js +0 -260
  49. package/test/node_modules/marked/src/marked.js +0 -270
  50. package/test/node_modules/marked/src/rules.js +0 -310
@@ -1,2870 +0,0 @@
1
- (self["webpackChunkWaline"] = self["webpackChunkWaline"] || []).push([["markdown"],{
2
-
3
- /***/ "./node_modules/hanabi/dist/hanabi.js":
4
- /*!********************************************!*\
5
- !*** ./node_modules/hanabi/dist/hanabi.js ***!
6
- \********************************************/
7
- /***/ (function(module) {
8
-
9
- (function (global, factory) {
10
- true ? module.exports = factory() :
11
- 0;
12
- }(this, (function () { 'use strict';
13
-
14
- function createCommonjsModule(fn, module) {
15
- return module = { exports: {} }, fn(module, module.exports), module.exports;
16
- }
17
-
18
- var index$1 = createCommonjsModule(function (module) {
19
- 'use strict';
20
-
21
- var comment = module.exports = function () {
22
- return new RegExp('(?:' + comment.line().source + ')|(?:' + comment.block().source + ')', 'gm');
23
- };
24
-
25
- comment.line = function () {
26
- return /(?:^|\s)\/\/(.+?)$/gm;
27
- };
28
-
29
- comment.block = function () {
30
- return /\/\*([\S\s]*?)\*\//gm;
31
- };
32
- });
33
-
34
- var defaultColors = ['23AC69', '91C132', 'F19726', 'E8552D', '1AAB8E', 'E1147F', '2980C1', '1BA1E6', '9FA0A0', 'F19726', 'E30B20', 'E30B20', 'A3338B'];
35
-
36
- var index = function (input, ref) {
37
- if ( ref === void 0 ) ref = {};
38
- var colors = ref.colors; if ( colors === void 0 ) colors = defaultColors;
39
-
40
- var index = 0;
41
- var cache = {};
42
- var wordRe = /[\u4E00-\u9FFF\u3400-\u4dbf\uf900-\ufaff\u3040-\u309f\uac00-\ud7af\u0400-\u04FF]+|\w+/;
43
- var leftAngleRe = /</;
44
-
45
- var re = new RegExp(("(" + (wordRe.source) + "|" + (leftAngleRe.source) + ")|(" + (index$1().source) + ")"), 'gmi');
46
- return input
47
- .replace(re, function (m, word, cm) {
48
- if (cm) {
49
- return toComment(cm)
50
- }
51
-
52
- if (word === '<') {
53
- return '&lt;'
54
- }
55
- var color;
56
- if (cache[word]) {
57
- color = cache[word];
58
- } else {
59
- color = colors[index];
60
- cache[word] = color;
61
- }
62
-
63
- var out = "<span style=\"color: #" + color + "\">" + word + "</span>";
64
- index = ++index % colors.length;
65
- return out
66
- })
67
- };
68
-
69
- function toComment(cm) {
70
- return ("<span style=\"color: slategray\">" + cm + "</span>")
71
- }
72
-
73
- return index;
74
-
75
- })));
76
-
77
-
78
- /***/ }),
79
-
80
- /***/ "./node_modules/marked/lib/marked.js":
81
- /*!*******************************************!*\
82
- !*** ./node_modules/marked/lib/marked.js ***!
83
- \*******************************************/
84
- /***/ (function(module) {
85
-
86
- /**
87
- * marked - a markdown parser
88
- * Copyright (c) 2011-2021, Christopher Jeffrey. (MIT Licensed)
89
- * https://github.com/markedjs/marked
90
- */
91
-
92
- /**
93
- * DO NOT EDIT THIS FILE
94
- * The code in this file is generated from files in ./src/
95
- */
96
-
97
- (function (global, factory) {
98
- true ? module.exports = factory() :
99
- 0;
100
- }(this, (function () { 'use strict';
101
-
102
- function _defineProperties(target, props) {
103
- for (var i = 0; i < props.length; i++) {
104
- var descriptor = props[i];
105
- descriptor.enumerable = descriptor.enumerable || false;
106
- descriptor.configurable = true;
107
- if ("value" in descriptor) descriptor.writable = true;
108
- Object.defineProperty(target, descriptor.key, descriptor);
109
- }
110
- }
111
-
112
- function _createClass(Constructor, protoProps, staticProps) {
113
- if (protoProps) _defineProperties(Constructor.prototype, protoProps);
114
- if (staticProps) _defineProperties(Constructor, staticProps);
115
- return Constructor;
116
- }
117
-
118
- function _unsupportedIterableToArray(o, minLen) {
119
- if (!o) return;
120
- if (typeof o === "string") return _arrayLikeToArray(o, minLen);
121
- var n = Object.prototype.toString.call(o).slice(8, -1);
122
- if (n === "Object" && o.constructor) n = o.constructor.name;
123
- if (n === "Map" || n === "Set") return Array.from(o);
124
- if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen);
125
- }
126
-
127
- function _arrayLikeToArray(arr, len) {
128
- if (len == null || len > arr.length) len = arr.length;
129
-
130
- for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i];
131
-
132
- return arr2;
133
- }
134
-
135
- function _createForOfIteratorHelperLoose(o, allowArrayLike) {
136
- var it;
137
-
138
- if (typeof Symbol === "undefined" || o[Symbol.iterator] == null) {
139
- if (Array.isArray(o) || (it = _unsupportedIterableToArray(o)) || allowArrayLike && o && typeof o.length === "number") {
140
- if (it) o = it;
141
- var i = 0;
142
- return function () {
143
- if (i >= o.length) return {
144
- done: true
145
- };
146
- return {
147
- done: false,
148
- value: o[i++]
149
- };
150
- };
151
- }
152
-
153
- throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
154
- }
155
-
156
- it = o[Symbol.iterator]();
157
- return it.next.bind(it);
158
- }
159
-
160
- function createCommonjsModule(fn) {
161
- var module = { exports: {} };
162
- return fn(module, module.exports), module.exports;
163
- }
164
-
165
- var defaults$5 = createCommonjsModule(function (module) {
166
- function getDefaults() {
167
- return {
168
- baseUrl: null,
169
- breaks: false,
170
- gfm: true,
171
- headerIds: true,
172
- headerPrefix: '',
173
- highlight: null,
174
- langPrefix: 'language-',
175
- mangle: true,
176
- pedantic: false,
177
- renderer: null,
178
- sanitize: false,
179
- sanitizer: null,
180
- silent: false,
181
- smartLists: false,
182
- smartypants: false,
183
- tokenizer: null,
184
- walkTokens: null,
185
- xhtml: false
186
- };
187
- }
188
-
189
- function changeDefaults(newDefaults) {
190
- module.exports.defaults = newDefaults;
191
- }
192
-
193
- module.exports = {
194
- defaults: getDefaults(),
195
- getDefaults: getDefaults,
196
- changeDefaults: changeDefaults
197
- };
198
- });
199
-
200
- /**
201
- * Helpers
202
- */
203
- var escapeTest = /[&<>"']/;
204
- var escapeReplace = /[&<>"']/g;
205
- var escapeTestNoEncode = /[<>"']|&(?!#?\w+;)/;
206
- var escapeReplaceNoEncode = /[<>"']|&(?!#?\w+;)/g;
207
- var escapeReplacements = {
208
- '&': '&amp;',
209
- '<': '&lt;',
210
- '>': '&gt;',
211
- '"': '&quot;',
212
- "'": '&#39;'
213
- };
214
-
215
- var getEscapeReplacement = function getEscapeReplacement(ch) {
216
- return escapeReplacements[ch];
217
- };
218
-
219
- function escape$2(html, encode) {
220
- if (encode) {
221
- if (escapeTest.test(html)) {
222
- return html.replace(escapeReplace, getEscapeReplacement);
223
- }
224
- } else {
225
- if (escapeTestNoEncode.test(html)) {
226
- return html.replace(escapeReplaceNoEncode, getEscapeReplacement);
227
- }
228
- }
229
-
230
- return html;
231
- }
232
-
233
- var unescapeTest = /&(#(?:\d+)|(?:#x[0-9A-Fa-f]+)|(?:\w+));?/ig;
234
-
235
- function unescape$1(html) {
236
- // explicitly match decimal, hex, and named HTML entities
237
- return html.replace(unescapeTest, function (_, n) {
238
- n = n.toLowerCase();
239
- if (n === 'colon') return ':';
240
-
241
- if (n.charAt(0) === '#') {
242
- return n.charAt(1) === 'x' ? String.fromCharCode(parseInt(n.substring(2), 16)) : String.fromCharCode(+n.substring(1));
243
- }
244
-
245
- return '';
246
- });
247
- }
248
-
249
- var caret = /(^|[^\[])\^/g;
250
-
251
- function edit$1(regex, opt) {
252
- regex = regex.source || regex;
253
- opt = opt || '';
254
- var obj = {
255
- replace: function replace(name, val) {
256
- val = val.source || val;
257
- val = val.replace(caret, '$1');
258
- regex = regex.replace(name, val);
259
- return obj;
260
- },
261
- getRegex: function getRegex() {
262
- return new RegExp(regex, opt);
263
- }
264
- };
265
- return obj;
266
- }
267
-
268
- var nonWordAndColonTest = /[^\w:]/g;
269
- var originIndependentUrl = /^$|^[a-z][a-z0-9+.-]*:|^[?#]/i;
270
-
271
- function cleanUrl$1(sanitize, base, href) {
272
- if (sanitize) {
273
- var prot;
274
-
275
- try {
276
- prot = decodeURIComponent(unescape$1(href)).replace(nonWordAndColonTest, '').toLowerCase();
277
- } catch (e) {
278
- return null;
279
- }
280
-
281
- if (prot.indexOf('javascript:') === 0 || prot.indexOf('vbscript:') === 0 || prot.indexOf('data:') === 0) {
282
- return null;
283
- }
284
- }
285
-
286
- if (base && !originIndependentUrl.test(href)) {
287
- href = resolveUrl(base, href);
288
- }
289
-
290
- try {
291
- href = encodeURI(href).replace(/%25/g, '%');
292
- } catch (e) {
293
- return null;
294
- }
295
-
296
- return href;
297
- }
298
-
299
- var baseUrls = {};
300
- var justDomain = /^[^:]+:\/*[^/]*$/;
301
- var protocol = /^([^:]+:)[\s\S]*$/;
302
- var domain = /^([^:]+:\/*[^/]*)[\s\S]*$/;
303
-
304
- function resolveUrl(base, href) {
305
- if (!baseUrls[' ' + base]) {
306
- // we can ignore everything in base after the last slash of its path component,
307
- // but we might need to add _that_
308
- // https://tools.ietf.org/html/rfc3986#section-3
309
- if (justDomain.test(base)) {
310
- baseUrls[' ' + base] = base + '/';
311
- } else {
312
- baseUrls[' ' + base] = rtrim$1(base, '/', true);
313
- }
314
- }
315
-
316
- base = baseUrls[' ' + base];
317
- var relativeBase = base.indexOf(':') === -1;
318
-
319
- if (href.substring(0, 2) === '//') {
320
- if (relativeBase) {
321
- return href;
322
- }
323
-
324
- return base.replace(protocol, '$1') + href;
325
- } else if (href.charAt(0) === '/') {
326
- if (relativeBase) {
327
- return href;
328
- }
329
-
330
- return base.replace(domain, '$1') + href;
331
- } else {
332
- return base + href;
333
- }
334
- }
335
-
336
- var noopTest$1 = {
337
- exec: function noopTest() {}
338
- };
339
-
340
- function merge$2(obj) {
341
- var i = 1,
342
- target,
343
- key;
344
-
345
- for (; i < arguments.length; i++) {
346
- target = arguments[i];
347
-
348
- for (key in target) {
349
- if (Object.prototype.hasOwnProperty.call(target, key)) {
350
- obj[key] = target[key];
351
- }
352
- }
353
- }
354
-
355
- return obj;
356
- }
357
-
358
- function splitCells$1(tableRow, count) {
359
- // ensure that every cell-delimiting pipe has a space
360
- // before it to distinguish it from an escaped pipe
361
- var row = tableRow.replace(/\|/g, function (match, offset, str) {
362
- var escaped = false,
363
- curr = offset;
364
-
365
- while (--curr >= 0 && str[curr] === '\\') {
366
- escaped = !escaped;
367
- }
368
-
369
- if (escaped) {
370
- // odd number of slashes means | is escaped
371
- // so we leave it alone
372
- return '|';
373
- } else {
374
- // add space before unescaped |
375
- return ' |';
376
- }
377
- }),
378
- cells = row.split(/ \|/);
379
- var i = 0;
380
-
381
- if (cells.length > count) {
382
- cells.splice(count);
383
- } else {
384
- while (cells.length < count) {
385
- cells.push('');
386
- }
387
- }
388
-
389
- for (; i < cells.length; i++) {
390
- // leading or trailing whitespace is ignored per the gfm spec
391
- cells[i] = cells[i].trim().replace(/\\\|/g, '|');
392
- }
393
-
394
- return cells;
395
- } // Remove trailing 'c's. Equivalent to str.replace(/c*$/, '').
396
- // /c*$/ is vulnerable to REDOS.
397
- // invert: Remove suffix of non-c chars instead. Default falsey.
398
-
399
-
400
- function rtrim$1(str, c, invert) {
401
- var l = str.length;
402
-
403
- if (l === 0) {
404
- return '';
405
- } // Length of suffix matching the invert condition.
406
-
407
-
408
- var suffLen = 0; // Step left until we fail to match the invert condition.
409
-
410
- while (suffLen < l) {
411
- var currChar = str.charAt(l - suffLen - 1);
412
-
413
- if (currChar === c && !invert) {
414
- suffLen++;
415
- } else if (currChar !== c && invert) {
416
- suffLen++;
417
- } else {
418
- break;
419
- }
420
- }
421
-
422
- return str.substr(0, l - suffLen);
423
- }
424
-
425
- function findClosingBracket$1(str, b) {
426
- if (str.indexOf(b[1]) === -1) {
427
- return -1;
428
- }
429
-
430
- var l = str.length;
431
- var level = 0,
432
- i = 0;
433
-
434
- for (; i < l; i++) {
435
- if (str[i] === '\\') {
436
- i++;
437
- } else if (str[i] === b[0]) {
438
- level++;
439
- } else if (str[i] === b[1]) {
440
- level--;
441
-
442
- if (level < 0) {
443
- return i;
444
- }
445
- }
446
- }
447
-
448
- return -1;
449
- }
450
-
451
- function checkSanitizeDeprecation$1(opt) {
452
- if (opt && opt.sanitize && !opt.silent) {
453
- 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');
454
- }
455
- } // copied from https://stackoverflow.com/a/5450113/806777
456
-
457
-
458
- function repeatString$1(pattern, count) {
459
- if (count < 1) {
460
- return '';
461
- }
462
-
463
- var result = '';
464
-
465
- while (count > 1) {
466
- if (count & 1) {
467
- result += pattern;
468
- }
469
-
470
- count >>= 1;
471
- pattern += pattern;
472
- }
473
-
474
- return result + pattern;
475
- }
476
-
477
- var helpers = {
478
- escape: escape$2,
479
- unescape: unescape$1,
480
- edit: edit$1,
481
- cleanUrl: cleanUrl$1,
482
- resolveUrl: resolveUrl,
483
- noopTest: noopTest$1,
484
- merge: merge$2,
485
- splitCells: splitCells$1,
486
- rtrim: rtrim$1,
487
- findClosingBracket: findClosingBracket$1,
488
- checkSanitizeDeprecation: checkSanitizeDeprecation$1,
489
- repeatString: repeatString$1
490
- };
491
-
492
- var defaults$4 = defaults$5.defaults;
493
- var rtrim = helpers.rtrim,
494
- splitCells = helpers.splitCells,
495
- _escape = helpers.escape,
496
- findClosingBracket = helpers.findClosingBracket;
497
-
498
- function outputLink(cap, link, raw) {
499
- var href = link.href;
500
- var title = link.title ? _escape(link.title) : null;
501
- var text = cap[1].replace(/\\([\[\]])/g, '$1');
502
-
503
- if (cap[0].charAt(0) !== '!') {
504
- return {
505
- type: 'link',
506
- raw: raw,
507
- href: href,
508
- title: title,
509
- text: text
510
- };
511
- } else {
512
- return {
513
- type: 'image',
514
- raw: raw,
515
- href: href,
516
- title: title,
517
- text: _escape(text)
518
- };
519
- }
520
- }
521
-
522
- function indentCodeCompensation(raw, text) {
523
- var matchIndentToCode = raw.match(/^(\s+)(?:```)/);
524
-
525
- if (matchIndentToCode === null) {
526
- return text;
527
- }
528
-
529
- var indentToCode = matchIndentToCode[1];
530
- return text.split('\n').map(function (node) {
531
- var matchIndentInNode = node.match(/^\s+/);
532
-
533
- if (matchIndentInNode === null) {
534
- return node;
535
- }
536
-
537
- var indentInNode = matchIndentInNode[0];
538
-
539
- if (indentInNode.length >= indentToCode.length) {
540
- return node.slice(indentToCode.length);
541
- }
542
-
543
- return node;
544
- }).join('\n');
545
- }
546
- /**
547
- * Tokenizer
548
- */
549
-
550
-
551
- var Tokenizer_1 = /*#__PURE__*/function () {
552
- function Tokenizer(options) {
553
- this.options = options || defaults$4;
554
- }
555
-
556
- var _proto = Tokenizer.prototype;
557
-
558
- _proto.space = function space(src) {
559
- var cap = this.rules.block.newline.exec(src);
560
-
561
- if (cap) {
562
- if (cap[0].length > 1) {
563
- return {
564
- type: 'space',
565
- raw: cap[0]
566
- };
567
- }
568
-
569
- return {
570
- raw: '\n'
571
- };
572
- }
573
- };
574
-
575
- _proto.code = function code(src) {
576
- var cap = this.rules.block.code.exec(src);
577
-
578
- if (cap) {
579
- var text = cap[0].replace(/^ {1,4}/gm, '');
580
- return {
581
- type: 'code',
582
- raw: cap[0],
583
- codeBlockStyle: 'indented',
584
- text: !this.options.pedantic ? rtrim(text, '\n') : text
585
- };
586
- }
587
- };
588
-
589
- _proto.fences = function fences(src) {
590
- var cap = this.rules.block.fences.exec(src);
591
-
592
- if (cap) {
593
- var raw = cap[0];
594
- var text = indentCodeCompensation(raw, cap[3] || '');
595
- return {
596
- type: 'code',
597
- raw: raw,
598
- lang: cap[2] ? cap[2].trim() : cap[2],
599
- text: text
600
- };
601
- }
602
- };
603
-
604
- _proto.heading = function heading(src) {
605
- var cap = this.rules.block.heading.exec(src);
606
-
607
- if (cap) {
608
- var text = cap[2].trim(); // remove trailing #s
609
-
610
- if (/#$/.test(text)) {
611
- var trimmed = rtrim(text, '#');
612
-
613
- if (this.options.pedantic) {
614
- text = trimmed.trim();
615
- } else if (!trimmed || / $/.test(trimmed)) {
616
- // CommonMark requires space before trailing #s
617
- text = trimmed.trim();
618
- }
619
- }
620
-
621
- return {
622
- type: 'heading',
623
- raw: cap[0],
624
- depth: cap[1].length,
625
- text: text
626
- };
627
- }
628
- };
629
-
630
- _proto.nptable = function nptable(src) {
631
- var cap = this.rules.block.nptable.exec(src);
632
-
633
- if (cap) {
634
- var item = {
635
- type: 'table',
636
- header: splitCells(cap[1].replace(/^ *| *\| *$/g, '')),
637
- align: cap[2].replace(/^ *|\| *$/g, '').split(/ *\| */),
638
- cells: cap[3] ? cap[3].replace(/\n$/, '').split('\n') : [],
639
- raw: cap[0]
640
- };
641
-
642
- if (item.header.length === item.align.length) {
643
- var l = item.align.length;
644
- var i;
645
-
646
- for (i = 0; i < l; i++) {
647
- if (/^ *-+: *$/.test(item.align[i])) {
648
- item.align[i] = 'right';
649
- } else if (/^ *:-+: *$/.test(item.align[i])) {
650
- item.align[i] = 'center';
651
- } else if (/^ *:-+ *$/.test(item.align[i])) {
652
- item.align[i] = 'left';
653
- } else {
654
- item.align[i] = null;
655
- }
656
- }
657
-
658
- l = item.cells.length;
659
-
660
- for (i = 0; i < l; i++) {
661
- item.cells[i] = splitCells(item.cells[i], item.header.length);
662
- }
663
-
664
- return item;
665
- }
666
- }
667
- };
668
-
669
- _proto.hr = function hr(src) {
670
- var cap = this.rules.block.hr.exec(src);
671
-
672
- if (cap) {
673
- return {
674
- type: 'hr',
675
- raw: cap[0]
676
- };
677
- }
678
- };
679
-
680
- _proto.blockquote = function blockquote(src) {
681
- var cap = this.rules.block.blockquote.exec(src);
682
-
683
- if (cap) {
684
- var text = cap[0].replace(/^ *> ?/gm, '');
685
- return {
686
- type: 'blockquote',
687
- raw: cap[0],
688
- text: text
689
- };
690
- }
691
- };
692
-
693
- _proto.list = function list(src) {
694
- var cap = this.rules.block.list.exec(src);
695
-
696
- if (cap) {
697
- var raw = cap[0];
698
- var bull = cap[2];
699
- var isordered = bull.length > 1;
700
- var list = {
701
- type: 'list',
702
- raw: raw,
703
- ordered: isordered,
704
- start: isordered ? +bull.slice(0, -1) : '',
705
- loose: false,
706
- items: []
707
- }; // Get each top-level item.
708
-
709
- var itemMatch = cap[0].match(this.rules.block.item);
710
- var next = false,
711
- item,
712
- space,
713
- bcurr,
714
- bnext,
715
- addBack,
716
- loose,
717
- istask,
718
- ischecked,
719
- endMatch;
720
- var l = itemMatch.length;
721
- bcurr = this.rules.block.listItemStart.exec(itemMatch[0]);
722
-
723
- for (var i = 0; i < l; i++) {
724
- item = itemMatch[i];
725
- raw = item;
726
-
727
- if (!this.options.pedantic) {
728
- // Determine if current item contains the end of the list
729
- endMatch = item.match(new RegExp('\\n\\s*\\n {0,' + (bcurr[0].length - 1) + '}\\S'));
730
-
731
- if (endMatch) {
732
- addBack = item.length - endMatch.index + itemMatch.slice(i + 1).join('\n').length;
733
- list.raw = list.raw.substring(0, list.raw.length - addBack);
734
- item = item.substring(0, endMatch.index);
735
- raw = item;
736
- l = i + 1;
737
- }
738
- } // Determine whether the next list item belongs here.
739
- // Backpedal if it does not belong in this list.
740
-
741
-
742
- if (i !== l - 1) {
743
- bnext = this.rules.block.listItemStart.exec(itemMatch[i + 1]);
744
-
745
- if (!this.options.pedantic ? bnext[1].length >= bcurr[0].length || bnext[1].length > 3 : bnext[1].length > bcurr[1].length) {
746
- // nested list or continuation
747
- itemMatch.splice(i, 2, itemMatch[i] + (!this.options.pedantic && bnext[1].length < bcurr[0].length && !itemMatch[i].match(/\n$/) ? '' : '\n') + itemMatch[i + 1]);
748
- i--;
749
- l--;
750
- continue;
751
- } else if ( // different bullet style
752
- !this.options.pedantic || this.options.smartLists ? bnext[2][bnext[2].length - 1] !== bull[bull.length - 1] : isordered === (bnext[2].length === 1)) {
753
- addBack = itemMatch.slice(i + 1).join('\n').length;
754
- list.raw = list.raw.substring(0, list.raw.length - addBack);
755
- i = l - 1;
756
- }
757
-
758
- bcurr = bnext;
759
- } // Remove the list item's bullet
760
- // so it is seen as the next token.
761
-
762
-
763
- space = item.length;
764
- item = item.replace(/^ *([*+-]|\d+[.)]) ?/, ''); // Outdent whatever the
765
- // list item contains. Hacky.
766
-
767
- if (~item.indexOf('\n ')) {
768
- space -= item.length;
769
- item = !this.options.pedantic ? item.replace(new RegExp('^ {1,' + space + '}', 'gm'), '') : item.replace(/^ {1,4}/gm, '');
770
- } // trim item newlines at end
771
-
772
-
773
- item = rtrim(item, '\n');
774
-
775
- if (i !== l - 1) {
776
- raw = raw + '\n';
777
- } // Determine whether item is loose or not.
778
- // Use: /(^|\n)(?! )[^\n]+\n\n(?!\s*$)/
779
- // for discount behavior.
780
-
781
-
782
- loose = next || /\n\n(?!\s*$)/.test(raw);
783
-
784
- if (i !== l - 1) {
785
- next = raw.slice(-2) === '\n\n';
786
- if (!loose) loose = next;
787
- }
788
-
789
- if (loose) {
790
- list.loose = true;
791
- } // Check for task list items
792
-
793
-
794
- if (this.options.gfm) {
795
- istask = /^\[[ xX]\] /.test(item);
796
- ischecked = undefined;
797
-
798
- if (istask) {
799
- ischecked = item[1] !== ' ';
800
- item = item.replace(/^\[[ xX]\] +/, '');
801
- }
802
- }
803
-
804
- list.items.push({
805
- type: 'list_item',
806
- raw: raw,
807
- task: istask,
808
- checked: ischecked,
809
- loose: loose,
810
- text: item
811
- });
812
- }
813
-
814
- return list;
815
- }
816
- };
817
-
818
- _proto.html = function html(src) {
819
- var cap = this.rules.block.html.exec(src);
820
-
821
- if (cap) {
822
- return {
823
- type: this.options.sanitize ? 'paragraph' : 'html',
824
- raw: cap[0],
825
- pre: !this.options.sanitizer && (cap[1] === 'pre' || cap[1] === 'script' || cap[1] === 'style'),
826
- text: this.options.sanitize ? this.options.sanitizer ? this.options.sanitizer(cap[0]) : _escape(cap[0]) : cap[0]
827
- };
828
- }
829
- };
830
-
831
- _proto.def = function def(src) {
832
- var cap = this.rules.block.def.exec(src);
833
-
834
- if (cap) {
835
- if (cap[3]) cap[3] = cap[3].substring(1, cap[3].length - 1);
836
- var tag = cap[1].toLowerCase().replace(/\s+/g, ' ');
837
- return {
838
- type: 'def',
839
- tag: tag,
840
- raw: cap[0],
841
- href: cap[2],
842
- title: cap[3]
843
- };
844
- }
845
- };
846
-
847
- _proto.table = function table(src) {
848
- var cap = this.rules.block.table.exec(src);
849
-
850
- if (cap) {
851
- var item = {
852
- type: 'table',
853
- header: splitCells(cap[1].replace(/^ *| *\| *$/g, '')),
854
- align: cap[2].replace(/^ *|\| *$/g, '').split(/ *\| */),
855
- cells: cap[3] ? cap[3].replace(/\n$/, '').split('\n') : []
856
- };
857
-
858
- if (item.header.length === item.align.length) {
859
- item.raw = cap[0];
860
- var l = item.align.length;
861
- var i;
862
-
863
- for (i = 0; i < l; i++) {
864
- if (/^ *-+: *$/.test(item.align[i])) {
865
- item.align[i] = 'right';
866
- } else if (/^ *:-+: *$/.test(item.align[i])) {
867
- item.align[i] = 'center';
868
- } else if (/^ *:-+ *$/.test(item.align[i])) {
869
- item.align[i] = 'left';
870
- } else {
871
- item.align[i] = null;
872
- }
873
- }
874
-
875
- l = item.cells.length;
876
-
877
- for (i = 0; i < l; i++) {
878
- item.cells[i] = splitCells(item.cells[i].replace(/^ *\| *| *\| *$/g, ''), item.header.length);
879
- }
880
-
881
- return item;
882
- }
883
- }
884
- };
885
-
886
- _proto.lheading = function lheading(src) {
887
- var cap = this.rules.block.lheading.exec(src);
888
-
889
- if (cap) {
890
- return {
891
- type: 'heading',
892
- raw: cap[0],
893
- depth: cap[2].charAt(0) === '=' ? 1 : 2,
894
- text: cap[1]
895
- };
896
- }
897
- };
898
-
899
- _proto.paragraph = function paragraph(src) {
900
- var cap = this.rules.block.paragraph.exec(src);
901
-
902
- if (cap) {
903
- return {
904
- type: 'paragraph',
905
- raw: cap[0],
906
- text: cap[1].charAt(cap[1].length - 1) === '\n' ? cap[1].slice(0, -1) : cap[1]
907
- };
908
- }
909
- };
910
-
911
- _proto.text = function text(src) {
912
- var cap = this.rules.block.text.exec(src);
913
-
914
- if (cap) {
915
- return {
916
- type: 'text',
917
- raw: cap[0],
918
- text: cap[0]
919
- };
920
- }
921
- };
922
-
923
- _proto.escape = function escape(src) {
924
- var cap = this.rules.inline.escape.exec(src);
925
-
926
- if (cap) {
927
- return {
928
- type: 'escape',
929
- raw: cap[0],
930
- text: _escape(cap[1])
931
- };
932
- }
933
- };
934
-
935
- _proto.tag = function tag(src, inLink, inRawBlock) {
936
- var cap = this.rules.inline.tag.exec(src);
937
-
938
- if (cap) {
939
- if (!inLink && /^<a /i.test(cap[0])) {
940
- inLink = true;
941
- } else if (inLink && /^<\/a>/i.test(cap[0])) {
942
- inLink = false;
943
- }
944
-
945
- if (!inRawBlock && /^<(pre|code|kbd|script)(\s|>)/i.test(cap[0])) {
946
- inRawBlock = true;
947
- } else if (inRawBlock && /^<\/(pre|code|kbd|script)(\s|>)/i.test(cap[0])) {
948
- inRawBlock = false;
949
- }
950
-
951
- return {
952
- type: this.options.sanitize ? 'text' : 'html',
953
- raw: cap[0],
954
- inLink: inLink,
955
- inRawBlock: inRawBlock,
956
- text: this.options.sanitize ? this.options.sanitizer ? this.options.sanitizer(cap[0]) : _escape(cap[0]) : cap[0]
957
- };
958
- }
959
- };
960
-
961
- _proto.link = function link(src) {
962
- var cap = this.rules.inline.link.exec(src);
963
-
964
- if (cap) {
965
- var trimmedUrl = cap[2].trim();
966
-
967
- if (!this.options.pedantic && /^</.test(trimmedUrl)) {
968
- // commonmark requires matching angle brackets
969
- if (!/>$/.test(trimmedUrl)) {
970
- return;
971
- } // ending angle bracket cannot be escaped
972
-
973
-
974
- var rtrimSlash = rtrim(trimmedUrl.slice(0, -1), '\\');
975
-
976
- if ((trimmedUrl.length - rtrimSlash.length) % 2 === 0) {
977
- return;
978
- }
979
- } else {
980
- // find closing parenthesis
981
- var lastParenIndex = findClosingBracket(cap[2], '()');
982
-
983
- if (lastParenIndex > -1) {
984
- var start = cap[0].indexOf('!') === 0 ? 5 : 4;
985
- var linkLen = start + cap[1].length + lastParenIndex;
986
- cap[2] = cap[2].substring(0, lastParenIndex);
987
- cap[0] = cap[0].substring(0, linkLen).trim();
988
- cap[3] = '';
989
- }
990
- }
991
-
992
- var href = cap[2];
993
- var title = '';
994
-
995
- if (this.options.pedantic) {
996
- // split pedantic href and title
997
- var link = /^([^'"]*[^\s])\s+(['"])(.*)\2/.exec(href);
998
-
999
- if (link) {
1000
- href = link[1];
1001
- title = link[3];
1002
- }
1003
- } else {
1004
- title = cap[3] ? cap[3].slice(1, -1) : '';
1005
- }
1006
-
1007
- href = href.trim();
1008
-
1009
- if (/^</.test(href)) {
1010
- if (this.options.pedantic && !/>$/.test(trimmedUrl)) {
1011
- // pedantic allows starting angle bracket without ending angle bracket
1012
- href = href.slice(1);
1013
- } else {
1014
- href = href.slice(1, -1);
1015
- }
1016
- }
1017
-
1018
- return outputLink(cap, {
1019
- href: href ? href.replace(this.rules.inline._escapes, '$1') : href,
1020
- title: title ? title.replace(this.rules.inline._escapes, '$1') : title
1021
- }, cap[0]);
1022
- }
1023
- };
1024
-
1025
- _proto.reflink = function reflink(src, links) {
1026
- var cap;
1027
-
1028
- if ((cap = this.rules.inline.reflink.exec(src)) || (cap = this.rules.inline.nolink.exec(src))) {
1029
- var link = (cap[2] || cap[1]).replace(/\s+/g, ' ');
1030
- link = links[link.toLowerCase()];
1031
-
1032
- if (!link || !link.href) {
1033
- var text = cap[0].charAt(0);
1034
- return {
1035
- type: 'text',
1036
- raw: text,
1037
- text: text
1038
- };
1039
- }
1040
-
1041
- return outputLink(cap, link, cap[0]);
1042
- }
1043
- };
1044
-
1045
- _proto.emStrong = function emStrong(src, maskedSrc, prevChar) {
1046
- if (prevChar === void 0) {
1047
- prevChar = '';
1048
- }
1049
-
1050
- var match = this.rules.inline.emStrong.lDelim.exec(src);
1051
- if (!match) return;
1052
- if (match[3] && prevChar.match(/(?:[0-9A-Za-z\xAA\xB2\xB3\xB5\xB9\xBA\xBC-\xBE\xC0-\xD6\xD8-\xF6\xF8-\u02C1\u02C6-\u02D1\u02E0-\u02E4\u02EC\u02EE\u0370-\u0374\u0376\u0377\u037A-\u037D\u037F\u0386\u0388-\u038A\u038C\u038E-\u03A1\u03A3-\u03F5\u03F7-\u0481\u048A-\u052F\u0531-\u0556\u0559\u0560-\u0588\u05D0-\u05EA\u05EF-\u05F2\u0620-\u064A\u0660-\u0669\u066E\u066F\u0671-\u06D3\u06D5\u06E5\u06E6\u06EE-\u06FC\u06FF\u0710\u0712-\u072F\u074D-\u07A5\u07B1\u07C0-\u07EA\u07F4\u07F5\u07FA\u0800-\u0815\u081A\u0824\u0828\u0840-\u0858\u0860-\u086A\u08A0-\u08B4\u08B6-\u08C7\u0904-\u0939\u093D\u0950\u0958-\u0961\u0966-\u096F\u0971-\u0980\u0985-\u098C\u098F\u0990\u0993-\u09A8\u09AA-\u09B0\u09B2\u09B6-\u09B9\u09BD\u09CE\u09DC\u09DD\u09DF-\u09E1\u09E6-\u09F1\u09F4-\u09F9\u09FC\u0A05-\u0A0A\u0A0F\u0A10\u0A13-\u0A28\u0A2A-\u0A30\u0A32\u0A33\u0A35\u0A36\u0A38\u0A39\u0A59-\u0A5C\u0A5E\u0A66-\u0A6F\u0A72-\u0A74\u0A85-\u0A8D\u0A8F-\u0A91\u0A93-\u0AA8\u0AAA-\u0AB0\u0AB2\u0AB3\u0AB5-\u0AB9\u0ABD\u0AD0\u0AE0\u0AE1\u0AE6-\u0AEF\u0AF9\u0B05-\u0B0C\u0B0F\u0B10\u0B13-\u0B28\u0B2A-\u0B30\u0B32\u0B33\u0B35-\u0B39\u0B3D\u0B5C\u0B5D\u0B5F-\u0B61\u0B66-\u0B6F\u0B71-\u0B77\u0B83\u0B85-\u0B8A\u0B8E-\u0B90\u0B92-\u0B95\u0B99\u0B9A\u0B9C\u0B9E\u0B9F\u0BA3\u0BA4\u0BA8-\u0BAA\u0BAE-\u0BB9\u0BD0\u0BE6-\u0BF2\u0C05-\u0C0C\u0C0E-\u0C10\u0C12-\u0C28\u0C2A-\u0C39\u0C3D\u0C58-\u0C5A\u0C60\u0C61\u0C66-\u0C6F\u0C78-\u0C7E\u0C80\u0C85-\u0C8C\u0C8E-\u0C90\u0C92-\u0CA8\u0CAA-\u0CB3\u0CB5-\u0CB9\u0CBD\u0CDE\u0CE0\u0CE1\u0CE6-\u0CEF\u0CF1\u0CF2\u0D04-\u0D0C\u0D0E-\u0D10\u0D12-\u0D3A\u0D3D\u0D4E\u0D54-\u0D56\u0D58-\u0D61\u0D66-\u0D78\u0D7A-\u0D7F\u0D85-\u0D96\u0D9A-\u0DB1\u0DB3-\u0DBB\u0DBD\u0DC0-\u0DC6\u0DE6-\u0DEF\u0E01-\u0E30\u0E32\u0E33\u0E40-\u0E46\u0E50-\u0E59\u0E81\u0E82\u0E84\u0E86-\u0E8A\u0E8C-\u0EA3\u0EA5\u0EA7-\u0EB0\u0EB2\u0EB3\u0EBD\u0EC0-\u0EC4\u0EC6\u0ED0-\u0ED9\u0EDC-\u0EDF\u0F00\u0F20-\u0F33\u0F40-\u0F47\u0F49-\u0F6C\u0F88-\u0F8C\u1000-\u102A\u103F-\u1049\u1050-\u1055\u105A-\u105D\u1061\u1065\u1066\u106E-\u1070\u1075-\u1081\u108E\u1090-\u1099\u10A0-\u10C5\u10C7\u10CD\u10D0-\u10FA\u10FC-\u1248\u124A-\u124D\u1250-\u1256\u1258\u125A-\u125D\u1260-\u1288\u128A-\u128D\u1290-\u12B0\u12B2-\u12B5\u12B8-\u12BE\u12C0\u12C2-\u12C5\u12C8-\u12D6\u12D8-\u1310\u1312-\u1315\u1318-\u135A\u1369-\u137C\u1380-\u138F\u13A0-\u13F5\u13F8-\u13FD\u1401-\u166C\u166F-\u167F\u1681-\u169A\u16A0-\u16EA\u16EE-\u16F8\u1700-\u170C\u170E-\u1711\u1720-\u1731\u1740-\u1751\u1760-\u176C\u176E-\u1770\u1780-\u17B3\u17D7\u17DC\u17E0-\u17E9\u17F0-\u17F9\u1810-\u1819\u1820-\u1878\u1880-\u1884\u1887-\u18A8\u18AA\u18B0-\u18F5\u1900-\u191E\u1946-\u196D\u1970-\u1974\u1980-\u19AB\u19B0-\u19C9\u19D0-\u19DA\u1A00-\u1A16\u1A20-\u1A54\u1A80-\u1A89\u1A90-\u1A99\u1AA7\u1B05-\u1B33\u1B45-\u1B4B\u1B50-\u1B59\u1B83-\u1BA0\u1BAE-\u1BE5\u1C00-\u1C23\u1C40-\u1C49\u1C4D-\u1C7D\u1C80-\u1C88\u1C90-\u1CBA\u1CBD-\u1CBF\u1CE9-\u1CEC\u1CEE-\u1CF3\u1CF5\u1CF6\u1CFA\u1D00-\u1DBF\u1E00-\u1F15\u1F18-\u1F1D\u1F20-\u1F45\u1F48-\u1F4D\u1F50-\u1F57\u1F59\u1F5B\u1F5D\u1F5F-\u1F7D\u1F80-\u1FB4\u1FB6-\u1FBC\u1FBE\u1FC2-\u1FC4\u1FC6-\u1FCC\u1FD0-\u1FD3\u1FD6-\u1FDB\u1FE0-\u1FEC\u1FF2-\u1FF4\u1FF6-\u1FFC\u2070\u2071\u2074-\u2079\u207F-\u2089\u2090-\u209C\u2102\u2107\u210A-\u2113\u2115\u2119-\u211D\u2124\u2126\u2128\u212A-\u212D\u212F-\u2139\u213C-\u213F\u2145-\u2149\u214E\u2150-\u2189\u2460-\u249B\u24EA-\u24FF\u2776-\u2793\u2C00-\u2C2E\u2C30-\u2C5E\u2C60-\u2CE4\u2CEB-\u2CEE\u2CF2\u2CF3\u2CFD\u2D00-\u2D25\u2D27\u2D2D\u2D30-\u2D67\u2D6F\u2D80-\u2D96\u2DA0-\u2DA6\u2DA8-\u2DAE\u2DB0-\u2DB6\u2DB8-\u2DBE\u2DC0-\u2DC6\u2DC8-\u2DCE\u2DD0-\u2DD6\u2DD8-\u2DDE\u2E2F\u3005-\u3007\u3021-\u3029\u3031-\u3035\u3038-\u303C\u3041-\u3096\u309D-\u309F\u30A1-\u30FA\u30FC-\u30FF\u3105-\u312F\u3131-\u318E\u3192-\u3195\u31A0-\u31BF\u31F0-\u31FF\u3220-\u3229\u3248-\u324F\u3251-\u325F\u3280-\u3289\u32B1-\u32BF\u3400-\u4DBF\u4E00-\u9FFC\uA000-\uA48C\uA4D0-\uA4FD\uA500-\uA60C\uA610-\uA62B\uA640-\uA66E\uA67F-\uA69D\uA6A0-\uA6EF\uA717-\uA71F\uA722-\uA788\uA78B-\uA7BF\uA7C2-\uA7CA\uA7F5-\uA801\uA803-\uA805\uA807-\uA80A\uA80C-\uA822\uA830-\uA835\uA840-\uA873\uA882-\uA8B3\uA8D0-\uA8D9\uA8F2-\uA8F7\uA8FB\uA8FD\uA8FE\uA900-\uA925\uA930-\uA946\uA960-\uA97C\uA984-\uA9B2\uA9CF-\uA9D9\uA9E0-\uA9E4\uA9E6-\uA9FE\uAA00-\uAA28\uAA40-\uAA42\uAA44-\uAA4B\uAA50-\uAA59\uAA60-\uAA76\uAA7A\uAA7E-\uAAAF\uAAB1\uAAB5\uAAB6\uAAB9-\uAABD\uAAC0\uAAC2\uAADB-\uAADD\uAAE0-\uAAEA\uAAF2-\uAAF4\uAB01-\uAB06\uAB09-\uAB0E\uAB11-\uAB16\uAB20-\uAB26\uAB28-\uAB2E\uAB30-\uAB5A\uAB5C-\uAB69\uAB70-\uABE2\uABF0-\uABF9\uAC00-\uD7A3\uD7B0-\uD7C6\uD7CB-\uD7FB\uF900-\uFA6D\uFA70-\uFAD9\uFB00-\uFB06\uFB13-\uFB17\uFB1D\uFB1F-\uFB28\uFB2A-\uFB36\uFB38-\uFB3C\uFB3E\uFB40\uFB41\uFB43\uFB44\uFB46-\uFBB1\uFBD3-\uFD3D\uFD50-\uFD8F\uFD92-\uFDC7\uFDF0-\uFDFB\uFE70-\uFE74\uFE76-\uFEFC\uFF10-\uFF19\uFF21-\uFF3A\uFF41-\uFF5A\uFF66-\uFFBE\uFFC2-\uFFC7\uFFCA-\uFFCF\uFFD2-\uFFD7\uFFDA-\uFFDC]|\uD800[\uDC00-\uDC0B\uDC0D-\uDC26\uDC28-\uDC3A\uDC3C\uDC3D\uDC3F-\uDC4D\uDC50-\uDC5D\uDC80-\uDCFA\uDD07-\uDD33\uDD40-\uDD78\uDD8A\uDD8B\uDE80-\uDE9C\uDEA0-\uDED0\uDEE1-\uDEFB\uDF00-\uDF23\uDF2D-\uDF4A\uDF50-\uDF75\uDF80-\uDF9D\uDFA0-\uDFC3\uDFC8-\uDFCF\uDFD1-\uDFD5]|\uD801[\uDC00-\uDC9D\uDCA0-\uDCA9\uDCB0-\uDCD3\uDCD8-\uDCFB\uDD00-\uDD27\uDD30-\uDD63\uDE00-\uDF36\uDF40-\uDF55\uDF60-\uDF67]|\uD802[\uDC00-\uDC05\uDC08\uDC0A-\uDC35\uDC37\uDC38\uDC3C\uDC3F-\uDC55\uDC58-\uDC76\uDC79-\uDC9E\uDCA7-\uDCAF\uDCE0-\uDCF2\uDCF4\uDCF5\uDCFB-\uDD1B\uDD20-\uDD39\uDD80-\uDDB7\uDDBC-\uDDCF\uDDD2-\uDE00\uDE10-\uDE13\uDE15-\uDE17\uDE19-\uDE35\uDE40-\uDE48\uDE60-\uDE7E\uDE80-\uDE9F\uDEC0-\uDEC7\uDEC9-\uDEE4\uDEEB-\uDEEF\uDF00-\uDF35\uDF40-\uDF55\uDF58-\uDF72\uDF78-\uDF91\uDFA9-\uDFAF]|\uD803[\uDC00-\uDC48\uDC80-\uDCB2\uDCC0-\uDCF2\uDCFA-\uDD23\uDD30-\uDD39\uDE60-\uDE7E\uDE80-\uDEA9\uDEB0\uDEB1\uDF00-\uDF27\uDF30-\uDF45\uDF51-\uDF54\uDFB0-\uDFCB\uDFE0-\uDFF6]|\uD804[\uDC03-\uDC37\uDC52-\uDC6F\uDC83-\uDCAF\uDCD0-\uDCE8\uDCF0-\uDCF9\uDD03-\uDD26\uDD36-\uDD3F\uDD44\uDD47\uDD50-\uDD72\uDD76\uDD83-\uDDB2\uDDC1-\uDDC4\uDDD0-\uDDDA\uDDDC\uDDE1-\uDDF4\uDE00-\uDE11\uDE13-\uDE2B\uDE80-\uDE86\uDE88\uDE8A-\uDE8D\uDE8F-\uDE9D\uDE9F-\uDEA8\uDEB0-\uDEDE\uDEF0-\uDEF9\uDF05-\uDF0C\uDF0F\uDF10\uDF13-\uDF28\uDF2A-\uDF30\uDF32\uDF33\uDF35-\uDF39\uDF3D\uDF50\uDF5D-\uDF61]|\uD805[\uDC00-\uDC34\uDC47-\uDC4A\uDC50-\uDC59\uDC5F-\uDC61\uDC80-\uDCAF\uDCC4\uDCC5\uDCC7\uDCD0-\uDCD9\uDD80-\uDDAE\uDDD8-\uDDDB\uDE00-\uDE2F\uDE44\uDE50-\uDE59\uDE80-\uDEAA\uDEB8\uDEC0-\uDEC9\uDF00-\uDF1A\uDF30-\uDF3B]|\uD806[\uDC00-\uDC2B\uDCA0-\uDCF2\uDCFF-\uDD06\uDD09\uDD0C-\uDD13\uDD15\uDD16\uDD18-\uDD2F\uDD3F\uDD41\uDD50-\uDD59\uDDA0-\uDDA7\uDDAA-\uDDD0\uDDE1\uDDE3\uDE00\uDE0B-\uDE32\uDE3A\uDE50\uDE5C-\uDE89\uDE9D\uDEC0-\uDEF8]|\uD807[\uDC00-\uDC08\uDC0A-\uDC2E\uDC40\uDC50-\uDC6C\uDC72-\uDC8F\uDD00-\uDD06\uDD08\uDD09\uDD0B-\uDD30\uDD46\uDD50-\uDD59\uDD60-\uDD65\uDD67\uDD68\uDD6A-\uDD89\uDD98\uDDA0-\uDDA9\uDEE0-\uDEF2\uDFB0\uDFC0-\uDFD4]|\uD808[\uDC00-\uDF99]|\uD809[\uDC00-\uDC6E\uDC80-\uDD43]|[\uD80C\uD81C-\uD820\uD822\uD840-\uD868\uD86A-\uD86C\uD86F-\uD872\uD874-\uD879\uD880-\uD883][\uDC00-\uDFFF]|\uD80D[\uDC00-\uDC2E]|\uD811[\uDC00-\uDE46]|\uD81A[\uDC00-\uDE38\uDE40-\uDE5E\uDE60-\uDE69\uDED0-\uDEED\uDF00-\uDF2F\uDF40-\uDF43\uDF50-\uDF59\uDF5B-\uDF61\uDF63-\uDF77\uDF7D-\uDF8F]|\uD81B[\uDE40-\uDE96\uDF00-\uDF4A\uDF50\uDF93-\uDF9F\uDFE0\uDFE1\uDFE3]|\uD821[\uDC00-\uDFF7]|\uD823[\uDC00-\uDCD5\uDD00-\uDD08]|\uD82C[\uDC00-\uDD1E\uDD50-\uDD52\uDD64-\uDD67\uDD70-\uDEFB]|\uD82F[\uDC00-\uDC6A\uDC70-\uDC7C\uDC80-\uDC88\uDC90-\uDC99]|\uD834[\uDEE0-\uDEF3\uDF60-\uDF78]|\uD835[\uDC00-\uDC54\uDC56-\uDC9C\uDC9E\uDC9F\uDCA2\uDCA5\uDCA6\uDCA9-\uDCAC\uDCAE-\uDCB9\uDCBB\uDCBD-\uDCC3\uDCC5-\uDD05\uDD07-\uDD0A\uDD0D-\uDD14\uDD16-\uDD1C\uDD1E-\uDD39\uDD3B-\uDD3E\uDD40-\uDD44\uDD46\uDD4A-\uDD50\uDD52-\uDEA5\uDEA8-\uDEC0\uDEC2-\uDEDA\uDEDC-\uDEFA\uDEFC-\uDF14\uDF16-\uDF34\uDF36-\uDF4E\uDF50-\uDF6E\uDF70-\uDF88\uDF8A-\uDFA8\uDFAA-\uDFC2\uDFC4-\uDFCB\uDFCE-\uDFFF]|\uD838[\uDD00-\uDD2C\uDD37-\uDD3D\uDD40-\uDD49\uDD4E\uDEC0-\uDEEB\uDEF0-\uDEF9]|\uD83A[\uDC00-\uDCC4\uDCC7-\uDCCF\uDD00-\uDD43\uDD4B\uDD50-\uDD59]|\uD83B[\uDC71-\uDCAB\uDCAD-\uDCAF\uDCB1-\uDCB4\uDD01-\uDD2D\uDD2F-\uDD3D\uDE00-\uDE03\uDE05-\uDE1F\uDE21\uDE22\uDE24\uDE27\uDE29-\uDE32\uDE34-\uDE37\uDE39\uDE3B\uDE42\uDE47\uDE49\uDE4B\uDE4D-\uDE4F\uDE51\uDE52\uDE54\uDE57\uDE59\uDE5B\uDE5D\uDE5F\uDE61\uDE62\uDE64\uDE67-\uDE6A\uDE6C-\uDE72\uDE74-\uDE77\uDE79-\uDE7C\uDE7E\uDE80-\uDE89\uDE8B-\uDE9B\uDEA1-\uDEA3\uDEA5-\uDEA9\uDEAB-\uDEBB]|\uD83C[\uDD00-\uDD0C]|\uD83E[\uDFF0-\uDFF9]|\uD869[\uDC00-\uDEDD\uDF00-\uDFFF]|\uD86D[\uDC00-\uDF34\uDF40-\uDFFF]|\uD86E[\uDC00-\uDC1D\uDC20-\uDFFF]|\uD873[\uDC00-\uDEA1\uDEB0-\uDFFF]|\uD87A[\uDC00-\uDFE0]|\uD87E[\uDC00-\uDE1D]|\uD884[\uDC00-\uDF4A])/)) return; // _ can't be between two alphanumerics. \p{L}\p{N} includes non-english alphabet/numbers as well
1053
-
1054
- var nextChar = match[1] || match[2] || '';
1055
-
1056
- if (!nextChar || nextChar && (prevChar === '' || this.rules.inline.punctuation.exec(prevChar))) {
1057
- var lLength = match[0].length - 1;
1058
- var rDelim,
1059
- rLength,
1060
- delimTotal = lLength,
1061
- midDelimTotal = 0;
1062
- var endReg = match[0][0] === '*' ? this.rules.inline.emStrong.rDelimAst : this.rules.inline.emStrong.rDelimUnd;
1063
- endReg.lastIndex = 0;
1064
- maskedSrc = maskedSrc.slice(-1 * src.length + lLength); // Bump maskedSrc to same section of string as src (move to lexer?)
1065
-
1066
- while ((match = endReg.exec(maskedSrc)) != null) {
1067
- rDelim = match[1] || match[2] || match[3] || match[4] || match[5] || match[6];
1068
- if (!rDelim) continue; // matched the first alternative in rules.js (skip the * in __abc*abc__)
1069
-
1070
- rLength = rDelim.length;
1071
-
1072
- if (match[3] || match[4]) {
1073
- // found another Left Delim
1074
- delimTotal += rLength;
1075
- continue;
1076
- } else if (match[5] || match[6]) {
1077
- // either Left or Right Delim
1078
- if (lLength % 3 && !((lLength + rLength) % 3)) {
1079
- midDelimTotal += rLength;
1080
- continue; // CommonMark Emphasis Rules 9-10
1081
- }
1082
- }
1083
-
1084
- delimTotal -= rLength;
1085
- if (delimTotal > 0) continue; // Haven't found enough closing delimiters
1086
- // If this is the last rDelimiter, remove extra characters. *a*** -> *a*
1087
-
1088
- if (delimTotal + midDelimTotal - rLength <= 0 && !maskedSrc.slice(endReg.lastIndex).match(endReg)) {
1089
- rLength = Math.min(rLength, rLength + delimTotal + midDelimTotal);
1090
- }
1091
-
1092
- if (Math.min(lLength, rLength) % 2) {
1093
- return {
1094
- type: 'em',
1095
- raw: src.slice(0, lLength + match.index + rLength + 1),
1096
- text: src.slice(1, lLength + match.index + rLength)
1097
- };
1098
- }
1099
-
1100
- if (Math.min(lLength, rLength) % 2 === 0) {
1101
- return {
1102
- type: 'strong',
1103
- raw: src.slice(0, lLength + match.index + rLength + 1),
1104
- text: src.slice(2, lLength + match.index + rLength - 1)
1105
- };
1106
- }
1107
- }
1108
- }
1109
- };
1110
-
1111
- _proto.codespan = function codespan(src) {
1112
- var cap = this.rules.inline.code.exec(src);
1113
-
1114
- if (cap) {
1115
- var text = cap[2].replace(/\n/g, ' ');
1116
- var hasNonSpaceChars = /[^ ]/.test(text);
1117
- var hasSpaceCharsOnBothEnds = /^ /.test(text) && / $/.test(text);
1118
-
1119
- if (hasNonSpaceChars && hasSpaceCharsOnBothEnds) {
1120
- text = text.substring(1, text.length - 1);
1121
- }
1122
-
1123
- text = _escape(text, true);
1124
- return {
1125
- type: 'codespan',
1126
- raw: cap[0],
1127
- text: text
1128
- };
1129
- }
1130
- };
1131
-
1132
- _proto.br = function br(src) {
1133
- var cap = this.rules.inline.br.exec(src);
1134
-
1135
- if (cap) {
1136
- return {
1137
- type: 'br',
1138
- raw: cap[0]
1139
- };
1140
- }
1141
- };
1142
-
1143
- _proto.del = function del(src) {
1144
- var cap = this.rules.inline.del.exec(src);
1145
-
1146
- if (cap) {
1147
- return {
1148
- type: 'del',
1149
- raw: cap[0],
1150
- text: cap[2]
1151
- };
1152
- }
1153
- };
1154
-
1155
- _proto.autolink = function autolink(src, mangle) {
1156
- var cap = this.rules.inline.autolink.exec(src);
1157
-
1158
- if (cap) {
1159
- var text, href;
1160
-
1161
- if (cap[2] === '@') {
1162
- text = _escape(this.options.mangle ? mangle(cap[1]) : cap[1]);
1163
- href = 'mailto:' + text;
1164
- } else {
1165
- text = _escape(cap[1]);
1166
- href = text;
1167
- }
1168
-
1169
- return {
1170
- type: 'link',
1171
- raw: cap[0],
1172
- text: text,
1173
- href: href,
1174
- tokens: [{
1175
- type: 'text',
1176
- raw: text,
1177
- text: text
1178
- }]
1179
- };
1180
- }
1181
- };
1182
-
1183
- _proto.url = function url(src, mangle) {
1184
- var cap;
1185
-
1186
- if (cap = this.rules.inline.url.exec(src)) {
1187
- var text, href;
1188
-
1189
- if (cap[2] === '@') {
1190
- text = _escape(this.options.mangle ? mangle(cap[0]) : cap[0]);
1191
- href = 'mailto:' + text;
1192
- } else {
1193
- // do extended autolink path validation
1194
- var prevCapZero;
1195
-
1196
- do {
1197
- prevCapZero = cap[0];
1198
- cap[0] = this.rules.inline._backpedal.exec(cap[0])[0];
1199
- } while (prevCapZero !== cap[0]);
1200
-
1201
- text = _escape(cap[0]);
1202
-
1203
- if (cap[1] === 'www.') {
1204
- href = 'http://' + text;
1205
- } else {
1206
- href = text;
1207
- }
1208
- }
1209
-
1210
- return {
1211
- type: 'link',
1212
- raw: cap[0],
1213
- text: text,
1214
- href: href,
1215
- tokens: [{
1216
- type: 'text',
1217
- raw: text,
1218
- text: text
1219
- }]
1220
- };
1221
- }
1222
- };
1223
-
1224
- _proto.inlineText = function inlineText(src, inRawBlock, smartypants) {
1225
- var cap = this.rules.inline.text.exec(src);
1226
-
1227
- if (cap) {
1228
- var text;
1229
-
1230
- if (inRawBlock) {
1231
- text = this.options.sanitize ? this.options.sanitizer ? this.options.sanitizer(cap[0]) : _escape(cap[0]) : cap[0];
1232
- } else {
1233
- text = _escape(this.options.smartypants ? smartypants(cap[0]) : cap[0]);
1234
- }
1235
-
1236
- return {
1237
- type: 'text',
1238
- raw: cap[0],
1239
- text: text
1240
- };
1241
- }
1242
- };
1243
-
1244
- return Tokenizer;
1245
- }();
1246
-
1247
- var noopTest = helpers.noopTest,
1248
- edit = helpers.edit,
1249
- merge$1 = helpers.merge;
1250
- /**
1251
- * Block-Level Grammar
1252
- */
1253
-
1254
- var block$1 = {
1255
- newline: /^(?: *(?:\n|$))+/,
1256
- code: /^( {4}[^\n]+(?:\n(?: *(?:\n|$))*)?)+/,
1257
- fences: /^ {0,3}(`{3,}(?=[^`\n]*\n)|~{3,})([^\n]*)\n(?:|([\s\S]*?)\n)(?: {0,3}\1[~`]* *(?:\n+|$)|$)/,
1258
- hr: /^ {0,3}((?:- *){3,}|(?:_ *){3,}|(?:\* *){3,})(?:\n+|$)/,
1259
- heading: /^ {0,3}(#{1,6})(?=\s|$)(.*)(?:\n+|$)/,
1260
- blockquote: /^( {0,3}> ?(paragraph|[^\n]*)(?:\n|$))+/,
1261
- list: /^( {0,3})(bull) [\s\S]+?(?:hr|def|\n{2,}(?! )(?! {0,3}bull )\n*|\s*$)/,
1262
- html: '^ {0,3}(?:' // optional indentation
1263
- + '<(script|pre|style)[\\s>][\\s\\S]*?(?:</\\1>[^\\n]*\\n+|$)' // (1)
1264
- + '|comment[^\\n]*(\\n+|$)' // (2)
1265
- + '|<\\?[\\s\\S]*?(?:\\?>\\n*|$)' // (3)
1266
- + '|<![A-Z][\\s\\S]*?(?:>\\n*|$)' // (4)
1267
- + '|<!\\[CDATA\\[[\\s\\S]*?(?:\\]\\]>\\n*|$)' // (5)
1268
- + '|</?(tag)(?: +|\\n|/?>)[\\s\\S]*?(?:\\n{2,}|$)' // (6)
1269
- + '|<(?!script|pre|style)([a-z][\\w-]*)(?:attribute)*? */?>(?=[ \\t]*(?:\\n|$))[\\s\\S]*?(?:\\n{2,}|$)' // (7) open tag
1270
- + '|</(?!script|pre|style)[a-z][\\w-]*\\s*>(?=[ \\t]*(?:\\n|$))[\\s\\S]*?(?:\\n{2,}|$)' // (7) closing tag
1271
- + ')',
1272
- def: /^ {0,3}\[(label)\]: *\n? *<?([^\s>]+)>?(?:(?: +\n? *| *\n *)(title))? *(?:\n+|$)/,
1273
- nptable: noopTest,
1274
- table: noopTest,
1275
- lheading: /^([^\n]+)\n {0,3}(=+|-+) *(?:\n+|$)/,
1276
- // regex template, placeholders will be replaced according to different paragraph
1277
- // interruption rules of commonmark and the original markdown spec:
1278
- _paragraph: /^([^\n]+(?:\n(?!hr|heading|lheading|blockquote|fences|list|html| +\n)[^\n]+)*)/,
1279
- text: /^[^\n]+/
1280
- };
1281
- block$1._label = /(?!\s*\])(?:\\[\[\]]|[^\[\]])+/;
1282
- block$1._title = /(?:"(?:\\"?|[^"\\])*"|'[^'\n]*(?:\n[^'\n]+)*\n?'|\([^()]*\))/;
1283
- block$1.def = edit(block$1.def).replace('label', block$1._label).replace('title', block$1._title).getRegex();
1284
- block$1.bullet = /(?:[*+-]|\d{1,9}[.)])/;
1285
- block$1.item = /^( *)(bull) ?[^\n]*(?:\n(?! *bull ?)[^\n]*)*/;
1286
- block$1.item = edit(block$1.item, 'gm').replace(/bull/g, block$1.bullet).getRegex();
1287
- block$1.listItemStart = edit(/^( *)(bull) */).replace('bull', block$1.bullet).getRegex();
1288
- block$1.list = edit(block$1.list).replace(/bull/g, block$1.bullet).replace('hr', '\\n+(?=\\1?(?:(?:- *){3,}|(?:_ *){3,}|(?:\\* *){3,})(?:\\n+|$))').replace('def', '\\n+(?=' + block$1.def.source + ')').getRegex();
1289
- block$1._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';
1290
- block$1._comment = /<!--(?!-?>)[\s\S]*?(?:-->|$)/;
1291
- block$1.html = edit(block$1.html, 'i').replace('comment', block$1._comment).replace('tag', block$1._tag).replace('attribute', / +[a-zA-Z:_][\w.:-]*(?: *= *"[^"\n]*"| *= *'[^'\n]*'| *= *[^\s"'=<>`]+)?/).getRegex();
1292
- block$1.paragraph = edit(block$1._paragraph).replace('hr', block$1.hr).replace('heading', ' {0,3}#{1,6} ').replace('|lheading', '') // setex headings don't interrupt commonmark paragraphs
1293
- .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
1294
- .replace('html', '</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|!--)').replace('tag', block$1._tag) // pars can be interrupted by type (6) html blocks
1295
- .getRegex();
1296
- block$1.blockquote = edit(block$1.blockquote).replace('paragraph', block$1.paragraph).getRegex();
1297
- /**
1298
- * Normal Block Grammar
1299
- */
1300
-
1301
- block$1.normal = merge$1({}, block$1);
1302
- /**
1303
- * GFM Block Grammar
1304
- */
1305
-
1306
- block$1.gfm = merge$1({}, block$1.normal, {
1307
- nptable: '^ *([^|\\n ].*\\|.*)\\n' // Header
1308
- + ' {0,3}([-:]+ *\\|[-| :]*)' // Align
1309
- + '(?:\\n((?:(?!\\n|hr|heading|blockquote|code|fences|list|html).*(?:\\n|$))*)\\n*|$)',
1310
- // Cells
1311
- table: '^ *\\|(.+)\\n' // Header
1312
- + ' {0,3}\\|?( *[-:]+[-| :]*)' // Align
1313
- + '(?:\\n *((?:(?!\\n|hr|heading|blockquote|code|fences|list|html).*(?:\\n|$))*)\\n*|$)' // Cells
1314
-
1315
- });
1316
- block$1.gfm.nptable = edit(block$1.gfm.nptable).replace('hr', block$1.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
1317
- .replace('html', '</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|!--)').replace('tag', block$1._tag) // tables can be interrupted by type (6) html blocks
1318
- .getRegex();
1319
- block$1.gfm.table = edit(block$1.gfm.table).replace('hr', block$1.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
1320
- .replace('html', '</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|!--)').replace('tag', block$1._tag) // tables can be interrupted by type (6) html blocks
1321
- .getRegex();
1322
- /**
1323
- * Pedantic grammar (original John Gruber's loose markdown specification)
1324
- */
1325
-
1326
- block$1.pedantic = merge$1({}, block$1.normal, {
1327
- html: edit('^ *(?:comment *(?:\\n|\\s*$)' + '|<(tag)[\\s\\S]+?</\\1> *(?:\\n{2,}|\\s*$)' // closed tag
1328
- + '|<tag(?:"[^"]*"|\'[^\']*\'|\\s[^\'"/>\\s]*)*?/?> *(?:\\n{2,}|\\s*$))').replace('comment', block$1._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(),
1329
- def: /^ *\[([^\]]+)\]: *<?([^\s>]+)>?(?: +(["(][^\n]+[")]))? *(?:\n+|$)/,
1330
- heading: /^(#{1,6})(.*)(?:\n+|$)/,
1331
- fences: noopTest,
1332
- // fences not supported
1333
- paragraph: edit(block$1.normal._paragraph).replace('hr', block$1.hr).replace('heading', ' *#{1,6} *[^\n]').replace('lheading', block$1.lheading).replace('blockquote', ' {0,3}>').replace('|fences', '').replace('|list', '').replace('|html', '').getRegex()
1334
- });
1335
- /**
1336
- * Inline-Level Grammar
1337
- */
1338
-
1339
- var inline$1 = {
1340
- escape: /^\\([!"#$%&'()*+,\-./:;<=>?@\[\]\\^_`{|}~])/,
1341
- autolink: /^<(scheme:[^\s\x00-\x1f<>]*|email)>/,
1342
- url: noopTest,
1343
- tag: '^comment' + '|^</[a-zA-Z][\\w:-]*\\s*>' // self-closing tag
1344
- + '|^<[a-zA-Z][\\w-]*(?:attribute)*?\\s*/?>' // open tag
1345
- + '|^<\\?[\\s\\S]*?\\?>' // processing instruction, e.g. <?php ?>
1346
- + '|^<![a-zA-Z]+\\s[\\s\\S]*?>' // declaration, e.g. <!DOCTYPE html>
1347
- + '|^<!\\[CDATA\\[[\\s\\S]*?\\]\\]>',
1348
- // CDATA section
1349
- link: /^!?\[(label)\]\(\s*(href)(?:\s+(title))?\s*\)/,
1350
- reflink: /^!?\[(label)\]\[(?!\s*\])((?:\\[\[\]]?|[^\[\]\\])+)\]/,
1351
- nolink: /^!?\[(?!\s*\])((?:\[[^\[\]]*\]|\\[\[\]]|[^\[\]])*)\](?:\[\])?/,
1352
- reflinkSearch: 'reflink|nolink(?!\\()',
1353
- emStrong: {
1354
- lDelim: /^(?:\*+(?:([punct_])|[^\s*]))|^_+(?:([punct*])|([^\s_]))/,
1355
- // (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.
1356
- // () Skip other delimiter (1) #*** (2) a***#, a*** (3) #***a, ***a (4) ***# (5) #***# (6) a***a
1357
- rDelimAst: /\_\_[^_]*?\*[^_]*?\_\_|[punct_](\*+)(?=[\s]|$)|[^punct*_\s](\*+)(?=[punct_\s]|$)|[punct_\s](\*+)(?=[^punct*_\s])|[\s](\*+)(?=[punct_])|[punct_](\*+)(?=[punct_])|[^punct*_\s](\*+)(?=[^punct*_\s])/,
1358
- rDelimUnd: /\*\*[^*]*?\_[^*]*?\*\*|[punct*](\_+)(?=[\s]|$)|[^punct*_\s](\_+)(?=[punct*\s]|$)|[punct*\s](\_+)(?=[^punct*_\s])|[\s](\_+)(?=[punct*])|[punct*](\_+)(?=[punct*])/ // ^- Not allowed for _
1359
-
1360
- },
1361
- code: /^(`+)([^`]|[^`][\s\S]*?[^`])\1(?!`)/,
1362
- br: /^( {2,}|\\)\n(?!\s*$)/,
1363
- del: noopTest,
1364
- text: /^(`+|[^`])(?:(?= {2,}\n)|[\s\S]*?(?:(?=[\\<!\[`*_]|\b_|$)|[^ ](?= {2,}\n)))/,
1365
- punctuation: /^([\spunctuation])/
1366
- }; // list of punctuation marks from CommonMark spec
1367
- // without * and _ to handle the different emphasis markers * and _
1368
-
1369
- inline$1._punctuation = '!"#$%&\'()+\\-.,/:;<=>?@\\[\\]`^{|}~';
1370
- inline$1.punctuation = edit(inline$1.punctuation).replace(/punctuation/g, inline$1._punctuation).getRegex(); // sequences em should skip over [title](link), `code`, <html>
1371
-
1372
- inline$1.blockSkip = /\[[^\]]*?\]\([^\)]*?\)|`[^`]*?`|<[^>]*?>/g;
1373
- inline$1.escapedEmSt = /\\\*|\\_/g;
1374
- inline$1._comment = edit(block$1._comment).replace('(?:-->|$)', '-->').getRegex();
1375
- inline$1.emStrong.lDelim = edit(inline$1.emStrong.lDelim).replace(/punct/g, inline$1._punctuation).getRegex();
1376
- inline$1.emStrong.rDelimAst = edit(inline$1.emStrong.rDelimAst, 'g').replace(/punct/g, inline$1._punctuation).getRegex();
1377
- inline$1.emStrong.rDelimUnd = edit(inline$1.emStrong.rDelimUnd, 'g').replace(/punct/g, inline$1._punctuation).getRegex();
1378
- inline$1._escapes = /\\([!"#$%&'()*+,\-./:;<=>?@\[\]\\^_`{|}~])/g;
1379
- inline$1._scheme = /[a-zA-Z][a-zA-Z0-9+.-]{1,31}/;
1380
- inline$1._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])?)+(?![-_])/;
1381
- inline$1.autolink = edit(inline$1.autolink).replace('scheme', inline$1._scheme).replace('email', inline$1._email).getRegex();
1382
- inline$1._attribute = /\s+[a-zA-Z:_][\w.:-]*(?:\s*=\s*"[^"]*"|\s*=\s*'[^']*'|\s*=\s*[^\s"'=<>`]+)?/;
1383
- inline$1.tag = edit(inline$1.tag).replace('comment', inline$1._comment).replace('attribute', inline$1._attribute).getRegex();
1384
- inline$1._label = /(?:\[(?:\\.|[^\[\]\\])*\]|\\.|`[^`]*`|[^\[\]\\`])*?/;
1385
- inline$1._href = /<(?:\\.|[^\n<>\\])+>|[^\s\x00-\x1f]*/;
1386
- inline$1._title = /"(?:\\"?|[^"\\])*"|'(?:\\'?|[^'\\])*'|\((?:\\\)?|[^)\\])*\)/;
1387
- inline$1.link = edit(inline$1.link).replace('label', inline$1._label).replace('href', inline$1._href).replace('title', inline$1._title).getRegex();
1388
- inline$1.reflink = edit(inline$1.reflink).replace('label', inline$1._label).getRegex();
1389
- inline$1.reflinkSearch = edit(inline$1.reflinkSearch, 'g').replace('reflink', inline$1.reflink).replace('nolink', inline$1.nolink).getRegex();
1390
- /**
1391
- * Normal Inline Grammar
1392
- */
1393
-
1394
- inline$1.normal = merge$1({}, inline$1);
1395
- /**
1396
- * Pedantic Inline Grammar
1397
- */
1398
-
1399
- inline$1.pedantic = merge$1({}, inline$1.normal, {
1400
- strong: {
1401
- start: /^__|\*\*/,
1402
- middle: /^__(?=\S)([\s\S]*?\S)__(?!_)|^\*\*(?=\S)([\s\S]*?\S)\*\*(?!\*)/,
1403
- endAst: /\*\*(?!\*)/g,
1404
- endUnd: /__(?!_)/g
1405
- },
1406
- em: {
1407
- start: /^_|\*/,
1408
- middle: /^()\*(?=\S)([\s\S]*?\S)\*(?!\*)|^_(?=\S)([\s\S]*?\S)_(?!_)/,
1409
- endAst: /\*(?!\*)/g,
1410
- endUnd: /_(?!_)/g
1411
- },
1412
- link: edit(/^!?\[(label)\]\((.*?)\)/).replace('label', inline$1._label).getRegex(),
1413
- reflink: edit(/^!?\[(label)\]\s*\[([^\]]*)\]/).replace('label', inline$1._label).getRegex()
1414
- });
1415
- /**
1416
- * GFM Inline Grammar
1417
- */
1418
-
1419
- inline$1.gfm = merge$1({}, inline$1.normal, {
1420
- escape: edit(inline$1.escape).replace('])', '~|])').getRegex(),
1421
- _extended_email: /[A-Za-z0-9._+-]+(@)[a-zA-Z0-9-_]+(?:\.[a-zA-Z0-9-_]*[a-zA-Z0-9])+(?![-_])/,
1422
- url: /^((?:ftp|https?):\/\/|www\.)(?:[a-zA-Z0-9\-]+\.?)+[^\s<]*|^email/,
1423
- _backpedal: /(?:[^?!.,:;*_~()&]+|\([^)]*\)|&(?![a-zA-Z0-9]+;$)|[?!.,:;*_~)]+(?!$))+/,
1424
- del: /^(~~?)(?=[^\s~])([\s\S]*?[^\s~])\1(?=[^~]|$)/,
1425
- text: /^([`~]+|[^`~])(?:(?= {2,}\n)|[\s\S]*?(?:(?=[\\<!\[`*~_]|\b_|https?:\/\/|ftp:\/\/|www\.|$)|[^ ](?= {2,}\n)|[^a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-](?=[a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-]+@))|(?=[a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-]+@))/
1426
- });
1427
- inline$1.gfm.url = edit(inline$1.gfm.url, 'i').replace('email', inline$1.gfm._extended_email).getRegex();
1428
- /**
1429
- * GFM + Line Breaks Inline Grammar
1430
- */
1431
-
1432
- inline$1.breaks = merge$1({}, inline$1.gfm, {
1433
- br: edit(inline$1.br).replace('{2,}', '*').getRegex(),
1434
- text: edit(inline$1.gfm.text).replace('\\b_', '\\b_| {2,}\\n').replace(/\{2,\}/g, '*').getRegex()
1435
- });
1436
- var rules = {
1437
- block: block$1,
1438
- inline: inline$1
1439
- };
1440
-
1441
- var defaults$3 = defaults$5.defaults;
1442
- var block = rules.block,
1443
- inline = rules.inline;
1444
- var repeatString = helpers.repeatString;
1445
- /**
1446
- * smartypants text replacement
1447
- */
1448
-
1449
- function smartypants(text) {
1450
- return text // em-dashes
1451
- .replace(/---/g, "\u2014") // en-dashes
1452
- .replace(/--/g, "\u2013") // opening singles
1453
- .replace(/(^|[-\u2014/(\[{"\s])'/g, "$1\u2018") // closing singles & apostrophes
1454
- .replace(/'/g, "\u2019") // opening doubles
1455
- .replace(/(^|[-\u2014/(\[{\u2018\s])"/g, "$1\u201C") // closing doubles
1456
- .replace(/"/g, "\u201D") // ellipses
1457
- .replace(/\.{3}/g, "\u2026");
1458
- }
1459
- /**
1460
- * mangle email addresses
1461
- */
1462
-
1463
-
1464
- function mangle(text) {
1465
- var out = '',
1466
- i,
1467
- ch;
1468
- var l = text.length;
1469
-
1470
- for (i = 0; i < l; i++) {
1471
- ch = text.charCodeAt(i);
1472
-
1473
- if (Math.random() > 0.5) {
1474
- ch = 'x' + ch.toString(16);
1475
- }
1476
-
1477
- out += '&#' + ch + ';';
1478
- }
1479
-
1480
- return out;
1481
- }
1482
- /**
1483
- * Block Lexer
1484
- */
1485
-
1486
-
1487
- var Lexer_1 = /*#__PURE__*/function () {
1488
- function Lexer(options) {
1489
- this.tokens = [];
1490
- this.tokens.links = Object.create(null);
1491
- this.options = options || defaults$3;
1492
- this.options.tokenizer = this.options.tokenizer || new Tokenizer_1();
1493
- this.tokenizer = this.options.tokenizer;
1494
- this.tokenizer.options = this.options;
1495
- var rules = {
1496
- block: block.normal,
1497
- inline: inline.normal
1498
- };
1499
-
1500
- if (this.options.pedantic) {
1501
- rules.block = block.pedantic;
1502
- rules.inline = inline.pedantic;
1503
- } else if (this.options.gfm) {
1504
- rules.block = block.gfm;
1505
-
1506
- if (this.options.breaks) {
1507
- rules.inline = inline.breaks;
1508
- } else {
1509
- rules.inline = inline.gfm;
1510
- }
1511
- }
1512
-
1513
- this.tokenizer.rules = rules;
1514
- }
1515
- /**
1516
- * Expose Rules
1517
- */
1518
-
1519
-
1520
- /**
1521
- * Static Lex Method
1522
- */
1523
- Lexer.lex = function lex(src, options) {
1524
- var lexer = new Lexer(options);
1525
- return lexer.lex(src);
1526
- }
1527
- /**
1528
- * Static Lex Inline Method
1529
- */
1530
- ;
1531
-
1532
- Lexer.lexInline = function lexInline(src, options) {
1533
- var lexer = new Lexer(options);
1534
- return lexer.inlineTokens(src);
1535
- }
1536
- /**
1537
- * Preprocessing
1538
- */
1539
- ;
1540
-
1541
- var _proto = Lexer.prototype;
1542
-
1543
- _proto.lex = function lex(src) {
1544
- src = src.replace(/\r\n|\r/g, '\n').replace(/\t/g, ' ');
1545
- this.blockTokens(src, this.tokens, true);
1546
- this.inline(this.tokens);
1547
- return this.tokens;
1548
- }
1549
- /**
1550
- * Lexing
1551
- */
1552
- ;
1553
-
1554
- _proto.blockTokens = function blockTokens(src, tokens, top) {
1555
- if (tokens === void 0) {
1556
- tokens = [];
1557
- }
1558
-
1559
- if (top === void 0) {
1560
- top = true;
1561
- }
1562
-
1563
- if (this.options.pedantic) {
1564
- src = src.replace(/^ +$/gm, '');
1565
- }
1566
-
1567
- var token, i, l, lastToken;
1568
-
1569
- while (src) {
1570
- // newline
1571
- if (token = this.tokenizer.space(src)) {
1572
- src = src.substring(token.raw.length);
1573
-
1574
- if (token.type) {
1575
- tokens.push(token);
1576
- }
1577
-
1578
- continue;
1579
- } // code
1580
-
1581
-
1582
- if (token = this.tokenizer.code(src)) {
1583
- src = src.substring(token.raw.length);
1584
- lastToken = tokens[tokens.length - 1]; // An indented code block cannot interrupt a paragraph.
1585
-
1586
- if (lastToken && lastToken.type === 'paragraph') {
1587
- lastToken.raw += '\n' + token.raw;
1588
- lastToken.text += '\n' + token.text;
1589
- } else {
1590
- tokens.push(token);
1591
- }
1592
-
1593
- continue;
1594
- } // fences
1595
-
1596
-
1597
- if (token = this.tokenizer.fences(src)) {
1598
- src = src.substring(token.raw.length);
1599
- tokens.push(token);
1600
- continue;
1601
- } // heading
1602
-
1603
-
1604
- if (token = this.tokenizer.heading(src)) {
1605
- src = src.substring(token.raw.length);
1606
- tokens.push(token);
1607
- continue;
1608
- } // table no leading pipe (gfm)
1609
-
1610
-
1611
- if (token = this.tokenizer.nptable(src)) {
1612
- src = src.substring(token.raw.length);
1613
- tokens.push(token);
1614
- continue;
1615
- } // hr
1616
-
1617
-
1618
- if (token = this.tokenizer.hr(src)) {
1619
- src = src.substring(token.raw.length);
1620
- tokens.push(token);
1621
- continue;
1622
- } // blockquote
1623
-
1624
-
1625
- if (token = this.tokenizer.blockquote(src)) {
1626
- src = src.substring(token.raw.length);
1627
- token.tokens = this.blockTokens(token.text, [], top);
1628
- tokens.push(token);
1629
- continue;
1630
- } // list
1631
-
1632
-
1633
- if (token = this.tokenizer.list(src)) {
1634
- src = src.substring(token.raw.length);
1635
- l = token.items.length;
1636
-
1637
- for (i = 0; i < l; i++) {
1638
- token.items[i].tokens = this.blockTokens(token.items[i].text, [], false);
1639
- }
1640
-
1641
- tokens.push(token);
1642
- continue;
1643
- } // html
1644
-
1645
-
1646
- if (token = this.tokenizer.html(src)) {
1647
- src = src.substring(token.raw.length);
1648
- tokens.push(token);
1649
- continue;
1650
- } // def
1651
-
1652
-
1653
- if (top && (token = this.tokenizer.def(src))) {
1654
- src = src.substring(token.raw.length);
1655
-
1656
- if (!this.tokens.links[token.tag]) {
1657
- this.tokens.links[token.tag] = {
1658
- href: token.href,
1659
- title: token.title
1660
- };
1661
- }
1662
-
1663
- continue;
1664
- } // table (gfm)
1665
-
1666
-
1667
- if (token = this.tokenizer.table(src)) {
1668
- src = src.substring(token.raw.length);
1669
- tokens.push(token);
1670
- continue;
1671
- } // lheading
1672
-
1673
-
1674
- if (token = this.tokenizer.lheading(src)) {
1675
- src = src.substring(token.raw.length);
1676
- tokens.push(token);
1677
- continue;
1678
- } // top-level paragraph
1679
-
1680
-
1681
- if (top && (token = this.tokenizer.paragraph(src))) {
1682
- src = src.substring(token.raw.length);
1683
- tokens.push(token);
1684
- continue;
1685
- } // text
1686
-
1687
-
1688
- if (token = this.tokenizer.text(src)) {
1689
- src = src.substring(token.raw.length);
1690
- lastToken = tokens[tokens.length - 1];
1691
-
1692
- if (lastToken && lastToken.type === 'text') {
1693
- lastToken.raw += '\n' + token.raw;
1694
- lastToken.text += '\n' + token.text;
1695
- } else {
1696
- tokens.push(token);
1697
- }
1698
-
1699
- continue;
1700
- }
1701
-
1702
- if (src) {
1703
- var errMsg = 'Infinite loop on byte: ' + src.charCodeAt(0);
1704
-
1705
- if (this.options.silent) {
1706
- console.error(errMsg);
1707
- break;
1708
- } else {
1709
- throw new Error(errMsg);
1710
- }
1711
- }
1712
- }
1713
-
1714
- return tokens;
1715
- };
1716
-
1717
- _proto.inline = function inline(tokens) {
1718
- var i, j, k, l2, row, token;
1719
- var l = tokens.length;
1720
-
1721
- for (i = 0; i < l; i++) {
1722
- token = tokens[i];
1723
-
1724
- switch (token.type) {
1725
- case 'paragraph':
1726
- case 'text':
1727
- case 'heading':
1728
- {
1729
- token.tokens = [];
1730
- this.inlineTokens(token.text, token.tokens);
1731
- break;
1732
- }
1733
-
1734
- case 'table':
1735
- {
1736
- token.tokens = {
1737
- header: [],
1738
- cells: []
1739
- }; // header
1740
-
1741
- l2 = token.header.length;
1742
-
1743
- for (j = 0; j < l2; j++) {
1744
- token.tokens.header[j] = [];
1745
- this.inlineTokens(token.header[j], token.tokens.header[j]);
1746
- } // cells
1747
-
1748
-
1749
- l2 = token.cells.length;
1750
-
1751
- for (j = 0; j < l2; j++) {
1752
- row = token.cells[j];
1753
- token.tokens.cells[j] = [];
1754
-
1755
- for (k = 0; k < row.length; k++) {
1756
- token.tokens.cells[j][k] = [];
1757
- this.inlineTokens(row[k], token.tokens.cells[j][k]);
1758
- }
1759
- }
1760
-
1761
- break;
1762
- }
1763
-
1764
- case 'blockquote':
1765
- {
1766
- this.inline(token.tokens);
1767
- break;
1768
- }
1769
-
1770
- case 'list':
1771
- {
1772
- l2 = token.items.length;
1773
-
1774
- for (j = 0; j < l2; j++) {
1775
- this.inline(token.items[j].tokens);
1776
- }
1777
-
1778
- break;
1779
- }
1780
- }
1781
- }
1782
-
1783
- return tokens;
1784
- }
1785
- /**
1786
- * Lexing/Compiling
1787
- */
1788
- ;
1789
-
1790
- _proto.inlineTokens = function inlineTokens(src, tokens, inLink, inRawBlock) {
1791
- if (tokens === void 0) {
1792
- tokens = [];
1793
- }
1794
-
1795
- if (inLink === void 0) {
1796
- inLink = false;
1797
- }
1798
-
1799
- if (inRawBlock === void 0) {
1800
- inRawBlock = false;
1801
- }
1802
-
1803
- var token, lastToken; // String with links masked to avoid interference with em and strong
1804
-
1805
- var maskedSrc = src;
1806
- var match;
1807
- var keepPrevChar, prevChar; // Mask out reflinks
1808
-
1809
- if (this.tokens.links) {
1810
- var links = Object.keys(this.tokens.links);
1811
-
1812
- if (links.length > 0) {
1813
- while ((match = this.tokenizer.rules.inline.reflinkSearch.exec(maskedSrc)) != null) {
1814
- if (links.includes(match[0].slice(match[0].lastIndexOf('[') + 1, -1))) {
1815
- maskedSrc = maskedSrc.slice(0, match.index) + '[' + repeatString('a', match[0].length - 2) + ']' + maskedSrc.slice(this.tokenizer.rules.inline.reflinkSearch.lastIndex);
1816
- }
1817
- }
1818
- }
1819
- } // Mask out other blocks
1820
-
1821
-
1822
- while ((match = this.tokenizer.rules.inline.blockSkip.exec(maskedSrc)) != null) {
1823
- maskedSrc = maskedSrc.slice(0, match.index) + '[' + repeatString('a', match[0].length - 2) + ']' + maskedSrc.slice(this.tokenizer.rules.inline.blockSkip.lastIndex);
1824
- } // Mask out escaped em & strong delimiters
1825
-
1826
-
1827
- while ((match = this.tokenizer.rules.inline.escapedEmSt.exec(maskedSrc)) != null) {
1828
- maskedSrc = maskedSrc.slice(0, match.index) + '++' + maskedSrc.slice(this.tokenizer.rules.inline.escapedEmSt.lastIndex);
1829
- }
1830
-
1831
- while (src) {
1832
- if (!keepPrevChar) {
1833
- prevChar = '';
1834
- }
1835
-
1836
- keepPrevChar = false; // escape
1837
-
1838
- if (token = this.tokenizer.escape(src)) {
1839
- src = src.substring(token.raw.length);
1840
- tokens.push(token);
1841
- continue;
1842
- } // tag
1843
-
1844
-
1845
- if (token = this.tokenizer.tag(src, inLink, inRawBlock)) {
1846
- src = src.substring(token.raw.length);
1847
- inLink = token.inLink;
1848
- inRawBlock = token.inRawBlock;
1849
- var _lastToken = tokens[tokens.length - 1];
1850
-
1851
- if (_lastToken && token.type === 'text' && _lastToken.type === 'text') {
1852
- _lastToken.raw += token.raw;
1853
- _lastToken.text += token.text;
1854
- } else {
1855
- tokens.push(token);
1856
- }
1857
-
1858
- continue;
1859
- } // link
1860
-
1861
-
1862
- if (token = this.tokenizer.link(src)) {
1863
- src = src.substring(token.raw.length);
1864
-
1865
- if (token.type === 'link') {
1866
- token.tokens = this.inlineTokens(token.text, [], true, inRawBlock);
1867
- }
1868
-
1869
- tokens.push(token);
1870
- continue;
1871
- } // reflink, nolink
1872
-
1873
-
1874
- if (token = this.tokenizer.reflink(src, this.tokens.links)) {
1875
- src = src.substring(token.raw.length);
1876
- var _lastToken2 = tokens[tokens.length - 1];
1877
-
1878
- if (token.type === 'link') {
1879
- token.tokens = this.inlineTokens(token.text, [], true, inRawBlock);
1880
- tokens.push(token);
1881
- } else if (_lastToken2 && token.type === 'text' && _lastToken2.type === 'text') {
1882
- _lastToken2.raw += token.raw;
1883
- _lastToken2.text += token.text;
1884
- } else {
1885
- tokens.push(token);
1886
- }
1887
-
1888
- continue;
1889
- } // em & strong
1890
-
1891
-
1892
- if (token = this.tokenizer.emStrong(src, maskedSrc, prevChar)) {
1893
- src = src.substring(token.raw.length);
1894
- token.tokens = this.inlineTokens(token.text, [], inLink, inRawBlock);
1895
- tokens.push(token);
1896
- continue;
1897
- } // code
1898
-
1899
-
1900
- if (token = this.tokenizer.codespan(src)) {
1901
- src = src.substring(token.raw.length);
1902
- tokens.push(token);
1903
- continue;
1904
- } // br
1905
-
1906
-
1907
- if (token = this.tokenizer.br(src)) {
1908
- src = src.substring(token.raw.length);
1909
- tokens.push(token);
1910
- continue;
1911
- } // del (gfm)
1912
-
1913
-
1914
- if (token = this.tokenizer.del(src)) {
1915
- src = src.substring(token.raw.length);
1916
- token.tokens = this.inlineTokens(token.text, [], inLink, inRawBlock);
1917
- tokens.push(token);
1918
- continue;
1919
- } // autolink
1920
-
1921
-
1922
- if (token = this.tokenizer.autolink(src, mangle)) {
1923
- src = src.substring(token.raw.length);
1924
- tokens.push(token);
1925
- continue;
1926
- } // url (gfm)
1927
-
1928
-
1929
- if (!inLink && (token = this.tokenizer.url(src, mangle))) {
1930
- src = src.substring(token.raw.length);
1931
- tokens.push(token);
1932
- continue;
1933
- } // text
1934
-
1935
-
1936
- if (token = this.tokenizer.inlineText(src, inRawBlock, smartypants)) {
1937
- src = src.substring(token.raw.length);
1938
-
1939
- if (token.raw.slice(-1) !== '_') {
1940
- // Track prevChar before string of ____ started
1941
- prevChar = token.raw.slice(-1);
1942
- }
1943
-
1944
- keepPrevChar = true;
1945
- lastToken = tokens[tokens.length - 1];
1946
-
1947
- if (lastToken && lastToken.type === 'text') {
1948
- lastToken.raw += token.raw;
1949
- lastToken.text += token.text;
1950
- } else {
1951
- tokens.push(token);
1952
- }
1953
-
1954
- continue;
1955
- }
1956
-
1957
- if (src) {
1958
- var errMsg = 'Infinite loop on byte: ' + src.charCodeAt(0);
1959
-
1960
- if (this.options.silent) {
1961
- console.error(errMsg);
1962
- break;
1963
- } else {
1964
- throw new Error(errMsg);
1965
- }
1966
- }
1967
- }
1968
-
1969
- return tokens;
1970
- };
1971
-
1972
- _createClass(Lexer, null, [{
1973
- key: "rules",
1974
- get: function get() {
1975
- return {
1976
- block: block,
1977
- inline: inline
1978
- };
1979
- }
1980
- }]);
1981
-
1982
- return Lexer;
1983
- }();
1984
-
1985
- var defaults$2 = defaults$5.defaults;
1986
- var cleanUrl = helpers.cleanUrl,
1987
- escape$1 = helpers.escape;
1988
- /**
1989
- * Renderer
1990
- */
1991
-
1992
- var Renderer_1 = /*#__PURE__*/function () {
1993
- function Renderer(options) {
1994
- this.options = options || defaults$2;
1995
- }
1996
-
1997
- var _proto = Renderer.prototype;
1998
-
1999
- _proto.code = function code(_code, infostring, escaped) {
2000
- var lang = (infostring || '').match(/\S*/)[0];
2001
-
2002
- if (this.options.highlight) {
2003
- var out = this.options.highlight(_code, lang);
2004
-
2005
- if (out != null && out !== _code) {
2006
- escaped = true;
2007
- _code = out;
2008
- }
2009
- }
2010
-
2011
- _code = _code.replace(/\n$/, '') + '\n';
2012
-
2013
- if (!lang) {
2014
- return '<pre><code>' + (escaped ? _code : escape$1(_code, true)) + '</code></pre>\n';
2015
- }
2016
-
2017
- return '<pre><code class="' + this.options.langPrefix + escape$1(lang, true) + '">' + (escaped ? _code : escape$1(_code, true)) + '</code></pre>\n';
2018
- };
2019
-
2020
- _proto.blockquote = function blockquote(quote) {
2021
- return '<blockquote>\n' + quote + '</blockquote>\n';
2022
- };
2023
-
2024
- _proto.html = function html(_html) {
2025
- return _html;
2026
- };
2027
-
2028
- _proto.heading = function heading(text, level, raw, slugger) {
2029
- if (this.options.headerIds) {
2030
- return '<h' + level + ' id="' + this.options.headerPrefix + slugger.slug(raw) + '">' + text + '</h' + level + '>\n';
2031
- } // ignore IDs
2032
-
2033
-
2034
- return '<h' + level + '>' + text + '</h' + level + '>\n';
2035
- };
2036
-
2037
- _proto.hr = function hr() {
2038
- return this.options.xhtml ? '<hr/>\n' : '<hr>\n';
2039
- };
2040
-
2041
- _proto.list = function list(body, ordered, start) {
2042
- var type = ordered ? 'ol' : 'ul',
2043
- startatt = ordered && start !== 1 ? ' start="' + start + '"' : '';
2044
- return '<' + type + startatt + '>\n' + body + '</' + type + '>\n';
2045
- };
2046
-
2047
- _proto.listitem = function listitem(text) {
2048
- return '<li>' + text + '</li>\n';
2049
- };
2050
-
2051
- _proto.checkbox = function checkbox(checked) {
2052
- return '<input ' + (checked ? 'checked="" ' : '') + 'disabled="" type="checkbox"' + (this.options.xhtml ? ' /' : '') + '> ';
2053
- };
2054
-
2055
- _proto.paragraph = function paragraph(text) {
2056
- return '<p>' + text + '</p>\n';
2057
- };
2058
-
2059
- _proto.table = function table(header, body) {
2060
- if (body) body = '<tbody>' + body + '</tbody>';
2061
- return '<table>\n' + '<thead>\n' + header + '</thead>\n' + body + '</table>\n';
2062
- };
2063
-
2064
- _proto.tablerow = function tablerow(content) {
2065
- return '<tr>\n' + content + '</tr>\n';
2066
- };
2067
-
2068
- _proto.tablecell = function tablecell(content, flags) {
2069
- var type = flags.header ? 'th' : 'td';
2070
- var tag = flags.align ? '<' + type + ' align="' + flags.align + '">' : '<' + type + '>';
2071
- return tag + content + '</' + type + '>\n';
2072
- } // span level renderer
2073
- ;
2074
-
2075
- _proto.strong = function strong(text) {
2076
- return '<strong>' + text + '</strong>';
2077
- };
2078
-
2079
- _proto.em = function em(text) {
2080
- return '<em>' + text + '</em>';
2081
- };
2082
-
2083
- _proto.codespan = function codespan(text) {
2084
- return '<code>' + text + '</code>';
2085
- };
2086
-
2087
- _proto.br = function br() {
2088
- return this.options.xhtml ? '<br/>' : '<br>';
2089
- };
2090
-
2091
- _proto.del = function del(text) {
2092
- return '<del>' + text + '</del>';
2093
- };
2094
-
2095
- _proto.link = function link(href, title, text) {
2096
- href = cleanUrl(this.options.sanitize, this.options.baseUrl, href);
2097
-
2098
- if (href === null) {
2099
- return text;
2100
- }
2101
-
2102
- var out = '<a href="' + escape$1(href) + '"';
2103
-
2104
- if (title) {
2105
- out += ' title="' + title + '"';
2106
- }
2107
-
2108
- out += '>' + text + '</a>';
2109
- return out;
2110
- };
2111
-
2112
- _proto.image = function image(href, title, text) {
2113
- href = cleanUrl(this.options.sanitize, this.options.baseUrl, href);
2114
-
2115
- if (href === null) {
2116
- return text;
2117
- }
2118
-
2119
- var out = '<img src="' + href + '" alt="' + text + '"';
2120
-
2121
- if (title) {
2122
- out += ' title="' + title + '"';
2123
- }
2124
-
2125
- out += this.options.xhtml ? '/>' : '>';
2126
- return out;
2127
- };
2128
-
2129
- _proto.text = function text(_text) {
2130
- return _text;
2131
- };
2132
-
2133
- return Renderer;
2134
- }();
2135
-
2136
- /**
2137
- * TextRenderer
2138
- * returns only the textual part of the token
2139
- */
2140
- var TextRenderer_1 = /*#__PURE__*/function () {
2141
- function TextRenderer() {}
2142
-
2143
- var _proto = TextRenderer.prototype;
2144
-
2145
- // no need for block level renderers
2146
- _proto.strong = function strong(text) {
2147
- return text;
2148
- };
2149
-
2150
- _proto.em = function em(text) {
2151
- return text;
2152
- };
2153
-
2154
- _proto.codespan = function codespan(text) {
2155
- return text;
2156
- };
2157
-
2158
- _proto.del = function del(text) {
2159
- return text;
2160
- };
2161
-
2162
- _proto.html = function html(text) {
2163
- return text;
2164
- };
2165
-
2166
- _proto.text = function text(_text) {
2167
- return _text;
2168
- };
2169
-
2170
- _proto.link = function link(href, title, text) {
2171
- return '' + text;
2172
- };
2173
-
2174
- _proto.image = function image(href, title, text) {
2175
- return '' + text;
2176
- };
2177
-
2178
- _proto.br = function br() {
2179
- return '';
2180
- };
2181
-
2182
- return TextRenderer;
2183
- }();
2184
-
2185
- /**
2186
- * Slugger generates header id
2187
- */
2188
- var Slugger_1 = /*#__PURE__*/function () {
2189
- function Slugger() {
2190
- this.seen = {};
2191
- }
2192
-
2193
- var _proto = Slugger.prototype;
2194
-
2195
- _proto.serialize = function serialize(value) {
2196
- return value.toLowerCase().trim() // remove html tags
2197
- .replace(/<[!\/a-z].*?>/ig, '') // remove unwanted chars
2198
- .replace(/[\u2000-\u206F\u2E00-\u2E7F\\'!"#$%&()*+,./:;<=>?@[\]^`{|}~]/g, '').replace(/\s/g, '-');
2199
- }
2200
- /**
2201
- * Finds the next safe (unique) slug to use
2202
- */
2203
- ;
2204
-
2205
- _proto.getNextSafeSlug = function getNextSafeSlug(originalSlug, isDryRun) {
2206
- var slug = originalSlug;
2207
- var occurenceAccumulator = 0;
2208
-
2209
- if (this.seen.hasOwnProperty(slug)) {
2210
- occurenceAccumulator = this.seen[originalSlug];
2211
-
2212
- do {
2213
- occurenceAccumulator++;
2214
- slug = originalSlug + '-' + occurenceAccumulator;
2215
- } while (this.seen.hasOwnProperty(slug));
2216
- }
2217
-
2218
- if (!isDryRun) {
2219
- this.seen[originalSlug] = occurenceAccumulator;
2220
- this.seen[slug] = 0;
2221
- }
2222
-
2223
- return slug;
2224
- }
2225
- /**
2226
- * Convert string to unique id
2227
- * @param {object} options
2228
- * @param {boolean} options.dryrun Generates the next unique slug without updating the internal accumulator.
2229
- */
2230
- ;
2231
-
2232
- _proto.slug = function slug(value, options) {
2233
- if (options === void 0) {
2234
- options = {};
2235
- }
2236
-
2237
- var slug = this.serialize(value);
2238
- return this.getNextSafeSlug(slug, options.dryrun);
2239
- };
2240
-
2241
- return Slugger;
2242
- }();
2243
-
2244
- var defaults$1 = defaults$5.defaults;
2245
- var unescape = helpers.unescape;
2246
- /**
2247
- * Parsing & Compiling
2248
- */
2249
-
2250
- var Parser_1 = /*#__PURE__*/function () {
2251
- function Parser(options) {
2252
- this.options = options || defaults$1;
2253
- this.options.renderer = this.options.renderer || new Renderer_1();
2254
- this.renderer = this.options.renderer;
2255
- this.renderer.options = this.options;
2256
- this.textRenderer = new TextRenderer_1();
2257
- this.slugger = new Slugger_1();
2258
- }
2259
- /**
2260
- * Static Parse Method
2261
- */
2262
-
2263
-
2264
- Parser.parse = function parse(tokens, options) {
2265
- var parser = new Parser(options);
2266
- return parser.parse(tokens);
2267
- }
2268
- /**
2269
- * Static Parse Inline Method
2270
- */
2271
- ;
2272
-
2273
- Parser.parseInline = function parseInline(tokens, options) {
2274
- var parser = new Parser(options);
2275
- return parser.parseInline(tokens);
2276
- }
2277
- /**
2278
- * Parse Loop
2279
- */
2280
- ;
2281
-
2282
- var _proto = Parser.prototype;
2283
-
2284
- _proto.parse = function parse(tokens, top) {
2285
- if (top === void 0) {
2286
- top = true;
2287
- }
2288
-
2289
- var out = '',
2290
- i,
2291
- j,
2292
- k,
2293
- l2,
2294
- l3,
2295
- row,
2296
- cell,
2297
- header,
2298
- body,
2299
- token,
2300
- ordered,
2301
- start,
2302
- loose,
2303
- itemBody,
2304
- item,
2305
- checked,
2306
- task,
2307
- checkbox;
2308
- var l = tokens.length;
2309
-
2310
- for (i = 0; i < l; i++) {
2311
- token = tokens[i];
2312
-
2313
- switch (token.type) {
2314
- case 'space':
2315
- {
2316
- continue;
2317
- }
2318
-
2319
- case 'hr':
2320
- {
2321
- out += this.renderer.hr();
2322
- continue;
2323
- }
2324
-
2325
- case 'heading':
2326
- {
2327
- out += this.renderer.heading(this.parseInline(token.tokens), token.depth, unescape(this.parseInline(token.tokens, this.textRenderer)), this.slugger);
2328
- continue;
2329
- }
2330
-
2331
- case 'code':
2332
- {
2333
- out += this.renderer.code(token.text, token.lang, token.escaped);
2334
- continue;
2335
- }
2336
-
2337
- case 'table':
2338
- {
2339
- header = ''; // header
2340
-
2341
- cell = '';
2342
- l2 = token.header.length;
2343
-
2344
- for (j = 0; j < l2; j++) {
2345
- cell += this.renderer.tablecell(this.parseInline(token.tokens.header[j]), {
2346
- header: true,
2347
- align: token.align[j]
2348
- });
2349
- }
2350
-
2351
- header += this.renderer.tablerow(cell);
2352
- body = '';
2353
- l2 = token.cells.length;
2354
-
2355
- for (j = 0; j < l2; j++) {
2356
- row = token.tokens.cells[j];
2357
- cell = '';
2358
- l3 = row.length;
2359
-
2360
- for (k = 0; k < l3; k++) {
2361
- cell += this.renderer.tablecell(this.parseInline(row[k]), {
2362
- header: false,
2363
- align: token.align[k]
2364
- });
2365
- }
2366
-
2367
- body += this.renderer.tablerow(cell);
2368
- }
2369
-
2370
- out += this.renderer.table(header, body);
2371
- continue;
2372
- }
2373
-
2374
- case 'blockquote':
2375
- {
2376
- body = this.parse(token.tokens);
2377
- out += this.renderer.blockquote(body);
2378
- continue;
2379
- }
2380
-
2381
- case 'list':
2382
- {
2383
- ordered = token.ordered;
2384
- start = token.start;
2385
- loose = token.loose;
2386
- l2 = token.items.length;
2387
- body = '';
2388
-
2389
- for (j = 0; j < l2; j++) {
2390
- item = token.items[j];
2391
- checked = item.checked;
2392
- task = item.task;
2393
- itemBody = '';
2394
-
2395
- if (item.task) {
2396
- checkbox = this.renderer.checkbox(checked);
2397
-
2398
- if (loose) {
2399
- if (item.tokens.length > 0 && item.tokens[0].type === 'text') {
2400
- item.tokens[0].text = checkbox + ' ' + item.tokens[0].text;
2401
-
2402
- if (item.tokens[0].tokens && item.tokens[0].tokens.length > 0 && item.tokens[0].tokens[0].type === 'text') {
2403
- item.tokens[0].tokens[0].text = checkbox + ' ' + item.tokens[0].tokens[0].text;
2404
- }
2405
- } else {
2406
- item.tokens.unshift({
2407
- type: 'text',
2408
- text: checkbox
2409
- });
2410
- }
2411
- } else {
2412
- itemBody += checkbox;
2413
- }
2414
- }
2415
-
2416
- itemBody += this.parse(item.tokens, loose);
2417
- body += this.renderer.listitem(itemBody, task, checked);
2418
- }
2419
-
2420
- out += this.renderer.list(body, ordered, start);
2421
- continue;
2422
- }
2423
-
2424
- case 'html':
2425
- {
2426
- // TODO parse inline content if parameter markdown=1
2427
- out += this.renderer.html(token.text);
2428
- continue;
2429
- }
2430
-
2431
- case 'paragraph':
2432
- {
2433
- out += this.renderer.paragraph(this.parseInline(token.tokens));
2434
- continue;
2435
- }
2436
-
2437
- case 'text':
2438
- {
2439
- body = token.tokens ? this.parseInline(token.tokens) : token.text;
2440
-
2441
- while (i + 1 < l && tokens[i + 1].type === 'text') {
2442
- token = tokens[++i];
2443
- body += '\n' + (token.tokens ? this.parseInline(token.tokens) : token.text);
2444
- }
2445
-
2446
- out += top ? this.renderer.paragraph(body) : body;
2447
- continue;
2448
- }
2449
-
2450
- default:
2451
- {
2452
- var errMsg = 'Token with "' + token.type + '" type was not found.';
2453
-
2454
- if (this.options.silent) {
2455
- console.error(errMsg);
2456
- return;
2457
- } else {
2458
- throw new Error(errMsg);
2459
- }
2460
- }
2461
- }
2462
- }
2463
-
2464
- return out;
2465
- }
2466
- /**
2467
- * Parse Inline Tokens
2468
- */
2469
- ;
2470
-
2471
- _proto.parseInline = function parseInline(tokens, renderer) {
2472
- renderer = renderer || this.renderer;
2473
- var out = '',
2474
- i,
2475
- token;
2476
- var l = tokens.length;
2477
-
2478
- for (i = 0; i < l; i++) {
2479
- token = tokens[i];
2480
-
2481
- switch (token.type) {
2482
- case 'escape':
2483
- {
2484
- out += renderer.text(token.text);
2485
- break;
2486
- }
2487
-
2488
- case 'html':
2489
- {
2490
- out += renderer.html(token.text);
2491
- break;
2492
- }
2493
-
2494
- case 'link':
2495
- {
2496
- out += renderer.link(token.href, token.title, this.parseInline(token.tokens, renderer));
2497
- break;
2498
- }
2499
-
2500
- case 'image':
2501
- {
2502
- out += renderer.image(token.href, token.title, token.text);
2503
- break;
2504
- }
2505
-
2506
- case 'strong':
2507
- {
2508
- out += renderer.strong(this.parseInline(token.tokens, renderer));
2509
- break;
2510
- }
2511
-
2512
- case 'em':
2513
- {
2514
- out += renderer.em(this.parseInline(token.tokens, renderer));
2515
- break;
2516
- }
2517
-
2518
- case 'codespan':
2519
- {
2520
- out += renderer.codespan(token.text);
2521
- break;
2522
- }
2523
-
2524
- case 'br':
2525
- {
2526
- out += renderer.br();
2527
- break;
2528
- }
2529
-
2530
- case 'del':
2531
- {
2532
- out += renderer.del(this.parseInline(token.tokens, renderer));
2533
- break;
2534
- }
2535
-
2536
- case 'text':
2537
- {
2538
- out += renderer.text(token.text);
2539
- break;
2540
- }
2541
-
2542
- default:
2543
- {
2544
- var errMsg = 'Token with "' + token.type + '" type was not found.';
2545
-
2546
- if (this.options.silent) {
2547
- console.error(errMsg);
2548
- return;
2549
- } else {
2550
- throw new Error(errMsg);
2551
- }
2552
- }
2553
- }
2554
- }
2555
-
2556
- return out;
2557
- };
2558
-
2559
- return Parser;
2560
- }();
2561
-
2562
- var merge = helpers.merge,
2563
- checkSanitizeDeprecation = helpers.checkSanitizeDeprecation,
2564
- escape = helpers.escape;
2565
- var getDefaults = defaults$5.getDefaults,
2566
- changeDefaults = defaults$5.changeDefaults,
2567
- defaults = defaults$5.defaults;
2568
- /**
2569
- * Marked
2570
- */
2571
-
2572
- function marked(src, opt, callback) {
2573
- // throw error in case of non string input
2574
- if (typeof src === 'undefined' || src === null) {
2575
- throw new Error('marked(): input parameter is undefined or null');
2576
- }
2577
-
2578
- if (typeof src !== 'string') {
2579
- throw new Error('marked(): input parameter is of type ' + Object.prototype.toString.call(src) + ', string expected');
2580
- }
2581
-
2582
- if (typeof opt === 'function') {
2583
- callback = opt;
2584
- opt = null;
2585
- }
2586
-
2587
- opt = merge({}, marked.defaults, opt || {});
2588
- checkSanitizeDeprecation(opt);
2589
-
2590
- if (callback) {
2591
- var highlight = opt.highlight;
2592
- var tokens;
2593
-
2594
- try {
2595
- tokens = Lexer_1.lex(src, opt);
2596
- } catch (e) {
2597
- return callback(e);
2598
- }
2599
-
2600
- var done = function done(err) {
2601
- var out;
2602
-
2603
- if (!err) {
2604
- try {
2605
- out = Parser_1.parse(tokens, opt);
2606
- } catch (e) {
2607
- err = e;
2608
- }
2609
- }
2610
-
2611
- opt.highlight = highlight;
2612
- return err ? callback(err) : callback(null, out);
2613
- };
2614
-
2615
- if (!highlight || highlight.length < 3) {
2616
- return done();
2617
- }
2618
-
2619
- delete opt.highlight;
2620
- if (!tokens.length) return done();
2621
- var pending = 0;
2622
- marked.walkTokens(tokens, function (token) {
2623
- if (token.type === 'code') {
2624
- pending++;
2625
- setTimeout(function () {
2626
- highlight(token.text, token.lang, function (err, code) {
2627
- if (err) {
2628
- return done(err);
2629
- }
2630
-
2631
- if (code != null && code !== token.text) {
2632
- token.text = code;
2633
- token.escaped = true;
2634
- }
2635
-
2636
- pending--;
2637
-
2638
- if (pending === 0) {
2639
- done();
2640
- }
2641
- });
2642
- }, 0);
2643
- }
2644
- });
2645
-
2646
- if (pending === 0) {
2647
- done();
2648
- }
2649
-
2650
- return;
2651
- }
2652
-
2653
- try {
2654
- var _tokens = Lexer_1.lex(src, opt);
2655
-
2656
- if (opt.walkTokens) {
2657
- marked.walkTokens(_tokens, opt.walkTokens);
2658
- }
2659
-
2660
- return Parser_1.parse(_tokens, opt);
2661
- } catch (e) {
2662
- e.message += '\nPlease report this to https://github.com/markedjs/marked.';
2663
-
2664
- if (opt.silent) {
2665
- return '<p>An error occurred:</p><pre>' + escape(e.message + '', true) + '</pre>';
2666
- }
2667
-
2668
- throw e;
2669
- }
2670
- }
2671
- /**
2672
- * Options
2673
- */
2674
-
2675
-
2676
- marked.options = marked.setOptions = function (opt) {
2677
- merge(marked.defaults, opt);
2678
- changeDefaults(marked.defaults);
2679
- return marked;
2680
- };
2681
-
2682
- marked.getDefaults = getDefaults;
2683
- marked.defaults = defaults;
2684
- /**
2685
- * Use Extension
2686
- */
2687
-
2688
- marked.use = function (extension) {
2689
- var opts = merge({}, extension);
2690
-
2691
- if (extension.renderer) {
2692
- (function () {
2693
- var renderer = marked.defaults.renderer || new Renderer_1();
2694
-
2695
- var _loop = function _loop(prop) {
2696
- var prevRenderer = renderer[prop];
2697
-
2698
- renderer[prop] = function () {
2699
- for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
2700
- args[_key] = arguments[_key];
2701
- }
2702
-
2703
- var ret = extension.renderer[prop].apply(renderer, args);
2704
-
2705
- if (ret === false) {
2706
- ret = prevRenderer.apply(renderer, args);
2707
- }
2708
-
2709
- return ret;
2710
- };
2711
- };
2712
-
2713
- for (var prop in extension.renderer) {
2714
- _loop(prop);
2715
- }
2716
-
2717
- opts.renderer = renderer;
2718
- })();
2719
- }
2720
-
2721
- if (extension.tokenizer) {
2722
- (function () {
2723
- var tokenizer = marked.defaults.tokenizer || new Tokenizer_1();
2724
-
2725
- var _loop2 = function _loop2(prop) {
2726
- var prevTokenizer = tokenizer[prop];
2727
-
2728
- tokenizer[prop] = function () {
2729
- for (var _len2 = arguments.length, args = new Array(_len2), _key2 = 0; _key2 < _len2; _key2++) {
2730
- args[_key2] = arguments[_key2];
2731
- }
2732
-
2733
- var ret = extension.tokenizer[prop].apply(tokenizer, args);
2734
-
2735
- if (ret === false) {
2736
- ret = prevTokenizer.apply(tokenizer, args);
2737
- }
2738
-
2739
- return ret;
2740
- };
2741
- };
2742
-
2743
- for (var prop in extension.tokenizer) {
2744
- _loop2(prop);
2745
- }
2746
-
2747
- opts.tokenizer = tokenizer;
2748
- })();
2749
- }
2750
-
2751
- if (extension.walkTokens) {
2752
- var walkTokens = marked.defaults.walkTokens;
2753
-
2754
- opts.walkTokens = function (token) {
2755
- extension.walkTokens(token);
2756
-
2757
- if (walkTokens) {
2758
- walkTokens(token);
2759
- }
2760
- };
2761
- }
2762
-
2763
- marked.setOptions(opts);
2764
- };
2765
- /**
2766
- * Run callback for every token
2767
- */
2768
-
2769
-
2770
- marked.walkTokens = function (tokens, callback) {
2771
- for (var _iterator = _createForOfIteratorHelperLoose(tokens), _step; !(_step = _iterator()).done;) {
2772
- var token = _step.value;
2773
- callback(token);
2774
-
2775
- switch (token.type) {
2776
- case 'table':
2777
- {
2778
- for (var _iterator2 = _createForOfIteratorHelperLoose(token.tokens.header), _step2; !(_step2 = _iterator2()).done;) {
2779
- var cell = _step2.value;
2780
- marked.walkTokens(cell, callback);
2781
- }
2782
-
2783
- for (var _iterator3 = _createForOfIteratorHelperLoose(token.tokens.cells), _step3; !(_step3 = _iterator3()).done;) {
2784
- var row = _step3.value;
2785
-
2786
- for (var _iterator4 = _createForOfIteratorHelperLoose(row), _step4; !(_step4 = _iterator4()).done;) {
2787
- var _cell = _step4.value;
2788
- marked.walkTokens(_cell, callback);
2789
- }
2790
- }
2791
-
2792
- break;
2793
- }
2794
-
2795
- case 'list':
2796
- {
2797
- marked.walkTokens(token.items, callback);
2798
- break;
2799
- }
2800
-
2801
- default:
2802
- {
2803
- if (token.tokens) {
2804
- marked.walkTokens(token.tokens, callback);
2805
- }
2806
- }
2807
- }
2808
- }
2809
- };
2810
- /**
2811
- * Parse Inline
2812
- */
2813
-
2814
-
2815
- marked.parseInline = function (src, opt) {
2816
- // throw error in case of non string input
2817
- if (typeof src === 'undefined' || src === null) {
2818
- throw new Error('marked.parseInline(): input parameter is undefined or null');
2819
- }
2820
-
2821
- if (typeof src !== 'string') {
2822
- throw new Error('marked.parseInline(): input parameter is of type ' + Object.prototype.toString.call(src) + ', string expected');
2823
- }
2824
-
2825
- opt = merge({}, marked.defaults, opt || {});
2826
- checkSanitizeDeprecation(opt);
2827
-
2828
- try {
2829
- var tokens = Lexer_1.lexInline(src, opt);
2830
-
2831
- if (opt.walkTokens) {
2832
- marked.walkTokens(tokens, opt.walkTokens);
2833
- }
2834
-
2835
- return Parser_1.parseInline(tokens, opt);
2836
- } catch (e) {
2837
- e.message += '\nPlease report this to https://github.com/markedjs/marked.';
2838
-
2839
- if (opt.silent) {
2840
- return '<p>An error occurred:</p><pre>' + escape(e.message + '', true) + '</pre>';
2841
- }
2842
-
2843
- throw e;
2844
- }
2845
- };
2846
- /**
2847
- * Expose
2848
- */
2849
-
2850
-
2851
- marked.Parser = Parser_1;
2852
- marked.parser = Parser_1.parse;
2853
- marked.Renderer = Renderer_1;
2854
- marked.TextRenderer = TextRenderer_1;
2855
- marked.Lexer = Lexer_1;
2856
- marked.lexer = Lexer_1.lex;
2857
- marked.Tokenizer = Tokenizer_1;
2858
- marked.Slugger = Slugger_1;
2859
- marked.parse = marked;
2860
- var marked_1 = marked;
2861
-
2862
- return marked_1;
2863
-
2864
- })));
2865
-
2866
-
2867
- /***/ })
2868
-
2869
- }]);
2870
- //# sourceMappingURL=markdown.noStyle.js.map