@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,2787 +0,0 @@
1
- /**
2
- * marked - a markdown parser
3
- * Copyright (c) 2011-2021, Christopher Jeffrey. (MIT Licensed)
4
- * https://github.com/markedjs/marked
5
- */
6
-
7
- /**
8
- * DO NOT EDIT THIS FILE
9
- * The code in this file is generated from files in ./src/
10
- */
11
-
12
- (function (global, factory) {
13
- typeof exports === 'object' && typeof module !== 'undefined' ? module.exports = factory() :
14
- typeof define === 'function' && define.amd ? define(factory) :
15
- (global = typeof globalThis !== 'undefined' ? globalThis : global || self, global.marked = factory());
16
- }(this, (function () { 'use strict';
17
-
18
- function _defineProperties(target, props) {
19
- for (var i = 0; i < props.length; i++) {
20
- var descriptor = props[i];
21
- descriptor.enumerable = descriptor.enumerable || false;
22
- descriptor.configurable = true;
23
- if ("value" in descriptor) descriptor.writable = true;
24
- Object.defineProperty(target, descriptor.key, descriptor);
25
- }
26
- }
27
-
28
- function _createClass(Constructor, protoProps, staticProps) {
29
- if (protoProps) _defineProperties(Constructor.prototype, protoProps);
30
- if (staticProps) _defineProperties(Constructor, staticProps);
31
- return Constructor;
32
- }
33
-
34
- function _unsupportedIterableToArray(o, minLen) {
35
- if (!o) return;
36
- if (typeof o === "string") return _arrayLikeToArray(o, minLen);
37
- var n = Object.prototype.toString.call(o).slice(8, -1);
38
- if (n === "Object" && o.constructor) n = o.constructor.name;
39
- if (n === "Map" || n === "Set") return Array.from(o);
40
- if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen);
41
- }
42
-
43
- function _arrayLikeToArray(arr, len) {
44
- if (len == null || len > arr.length) len = arr.length;
45
-
46
- for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i];
47
-
48
- return arr2;
49
- }
50
-
51
- function _createForOfIteratorHelperLoose(o, allowArrayLike) {
52
- var it = typeof Symbol !== "undefined" && o[Symbol.iterator] || o["@@iterator"];
53
- if (it) return (it = it.call(o)).next.bind(it);
54
-
55
- if (Array.isArray(o) || (it = _unsupportedIterableToArray(o)) || allowArrayLike && o && typeof o.length === "number") {
56
- if (it) o = it;
57
- var i = 0;
58
- return function () {
59
- if (i >= o.length) return {
60
- done: true
61
- };
62
- return {
63
- done: false,
64
- value: o[i++]
65
- };
66
- };
67
- }
68
-
69
- throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
70
- }
71
-
72
- var defaults$5 = {exports: {}};
73
-
74
- function getDefaults$1() {
75
- return {
76
- baseUrl: null,
77
- breaks: false,
78
- gfm: true,
79
- headerIds: true,
80
- headerPrefix: '',
81
- highlight: null,
82
- langPrefix: 'language-',
83
- mangle: true,
84
- pedantic: false,
85
- renderer: null,
86
- sanitize: false,
87
- sanitizer: null,
88
- silent: false,
89
- smartLists: false,
90
- smartypants: false,
91
- tokenizer: null,
92
- walkTokens: null,
93
- xhtml: false
94
- };
95
- }
96
-
97
- function changeDefaults$1(newDefaults) {
98
- defaults$5.exports.defaults = newDefaults;
99
- }
100
-
101
- defaults$5.exports = {
102
- defaults: getDefaults$1(),
103
- getDefaults: getDefaults$1,
104
- changeDefaults: changeDefaults$1
105
- };
106
-
107
- /**
108
- * Helpers
109
- */
110
- var escapeTest = /[&<>"']/;
111
- var escapeReplace = /[&<>"']/g;
112
- var escapeTestNoEncode = /[<>"']|&(?!#?\w+;)/;
113
- var escapeReplaceNoEncode = /[<>"']|&(?!#?\w+;)/g;
114
- var escapeReplacements = {
115
- '&': '&amp;',
116
- '<': '&lt;',
117
- '>': '&gt;',
118
- '"': '&quot;',
119
- "'": '&#39;'
120
- };
121
-
122
- var getEscapeReplacement = function getEscapeReplacement(ch) {
123
- return escapeReplacements[ch];
124
- };
125
-
126
- function escape$2(html, encode) {
127
- if (encode) {
128
- if (escapeTest.test(html)) {
129
- return html.replace(escapeReplace, getEscapeReplacement);
130
- }
131
- } else {
132
- if (escapeTestNoEncode.test(html)) {
133
- return html.replace(escapeReplaceNoEncode, getEscapeReplacement);
134
- }
135
- }
136
-
137
- return html;
138
- }
139
-
140
- var unescapeTest = /&(#(?:\d+)|(?:#x[0-9A-Fa-f]+)|(?:\w+));?/ig;
141
-
142
- function unescape$1(html) {
143
- // explicitly match decimal, hex, and named HTML entities
144
- return html.replace(unescapeTest, function (_, n) {
145
- n = n.toLowerCase();
146
- if (n === 'colon') return ':';
147
-
148
- if (n.charAt(0) === '#') {
149
- return n.charAt(1) === 'x' ? String.fromCharCode(parseInt(n.substring(2), 16)) : String.fromCharCode(+n.substring(1));
150
- }
151
-
152
- return '';
153
- });
154
- }
155
-
156
- var caret = /(^|[^\[])\^/g;
157
-
158
- function edit$1(regex, opt) {
159
- regex = regex.source || regex;
160
- opt = opt || '';
161
- var obj = {
162
- replace: function replace(name, val) {
163
- val = val.source || val;
164
- val = val.replace(caret, '$1');
165
- regex = regex.replace(name, val);
166
- return obj;
167
- },
168
- getRegex: function getRegex() {
169
- return new RegExp(regex, opt);
170
- }
171
- };
172
- return obj;
173
- }
174
-
175
- var nonWordAndColonTest = /[^\w:]/g;
176
- var originIndependentUrl = /^$|^[a-z][a-z0-9+.-]*:|^[?#]/i;
177
-
178
- function cleanUrl$1(sanitize, base, href) {
179
- if (sanitize) {
180
- var prot;
181
-
182
- try {
183
- prot = decodeURIComponent(unescape$1(href)).replace(nonWordAndColonTest, '').toLowerCase();
184
- } catch (e) {
185
- return null;
186
- }
187
-
188
- if (prot.indexOf('javascript:') === 0 || prot.indexOf('vbscript:') === 0 || prot.indexOf('data:') === 0) {
189
- return null;
190
- }
191
- }
192
-
193
- if (base && !originIndependentUrl.test(href)) {
194
- href = resolveUrl(base, href);
195
- }
196
-
197
- try {
198
- href = encodeURI(href).replace(/%25/g, '%');
199
- } catch (e) {
200
- return null;
201
- }
202
-
203
- return href;
204
- }
205
-
206
- var baseUrls = {};
207
- var justDomain = /^[^:]+:\/*[^/]*$/;
208
- var protocol = /^([^:]+:)[\s\S]*$/;
209
- var domain = /^([^:]+:\/*[^/]*)[\s\S]*$/;
210
-
211
- function resolveUrl(base, href) {
212
- if (!baseUrls[' ' + base]) {
213
- // we can ignore everything in base after the last slash of its path component,
214
- // but we might need to add _that_
215
- // https://tools.ietf.org/html/rfc3986#section-3
216
- if (justDomain.test(base)) {
217
- baseUrls[' ' + base] = base + '/';
218
- } else {
219
- baseUrls[' ' + base] = rtrim$1(base, '/', true);
220
- }
221
- }
222
-
223
- base = baseUrls[' ' + base];
224
- var relativeBase = base.indexOf(':') === -1;
225
-
226
- if (href.substring(0, 2) === '//') {
227
- if (relativeBase) {
228
- return href;
229
- }
230
-
231
- return base.replace(protocol, '$1') + href;
232
- } else if (href.charAt(0) === '/') {
233
- if (relativeBase) {
234
- return href;
235
- }
236
-
237
- return base.replace(domain, '$1') + href;
238
- } else {
239
- return base + href;
240
- }
241
- }
242
-
243
- var noopTest$1 = {
244
- exec: function noopTest() {}
245
- };
246
-
247
- function merge$2(obj) {
248
- var i = 1,
249
- target,
250
- key;
251
-
252
- for (; i < arguments.length; i++) {
253
- target = arguments[i];
254
-
255
- for (key in target) {
256
- if (Object.prototype.hasOwnProperty.call(target, key)) {
257
- obj[key] = target[key];
258
- }
259
- }
260
- }
261
-
262
- return obj;
263
- }
264
-
265
- function splitCells$1(tableRow, count) {
266
- // ensure that every cell-delimiting pipe has a space
267
- // before it to distinguish it from an escaped pipe
268
- var row = tableRow.replace(/\|/g, function (match, offset, str) {
269
- var escaped = false,
270
- curr = offset;
271
-
272
- while (--curr >= 0 && str[curr] === '\\') {
273
- escaped = !escaped;
274
- }
275
-
276
- if (escaped) {
277
- // odd number of slashes means | is escaped
278
- // so we leave it alone
279
- return '|';
280
- } else {
281
- // add space before unescaped |
282
- return ' |';
283
- }
284
- }),
285
- cells = row.split(/ \|/);
286
- var i = 0;
287
-
288
- if (cells.length > count) {
289
- cells.splice(count);
290
- } else {
291
- while (cells.length < count) {
292
- cells.push('');
293
- }
294
- }
295
-
296
- for (; i < cells.length; i++) {
297
- // leading or trailing whitespace is ignored per the gfm spec
298
- cells[i] = cells[i].trim().replace(/\\\|/g, '|');
299
- }
300
-
301
- return cells;
302
- } // Remove trailing 'c's. Equivalent to str.replace(/c*$/, '').
303
- // /c*$/ is vulnerable to REDOS.
304
- // invert: Remove suffix of non-c chars instead. Default falsey.
305
-
306
-
307
- function rtrim$1(str, c, invert) {
308
- var l = str.length;
309
-
310
- if (l === 0) {
311
- return '';
312
- } // Length of suffix matching the invert condition.
313
-
314
-
315
- var suffLen = 0; // Step left until we fail to match the invert condition.
316
-
317
- while (suffLen < l) {
318
- var currChar = str.charAt(l - suffLen - 1);
319
-
320
- if (currChar === c && !invert) {
321
- suffLen++;
322
- } else if (currChar !== c && invert) {
323
- suffLen++;
324
- } else {
325
- break;
326
- }
327
- }
328
-
329
- return str.substr(0, l - suffLen);
330
- }
331
-
332
- function findClosingBracket$1(str, b) {
333
- if (str.indexOf(b[1]) === -1) {
334
- return -1;
335
- }
336
-
337
- var l = str.length;
338
- var level = 0,
339
- i = 0;
340
-
341
- for (; i < l; i++) {
342
- if (str[i] === '\\') {
343
- i++;
344
- } else if (str[i] === b[0]) {
345
- level++;
346
- } else if (str[i] === b[1]) {
347
- level--;
348
-
349
- if (level < 0) {
350
- return i;
351
- }
352
- }
353
- }
354
-
355
- return -1;
356
- }
357
-
358
- function checkSanitizeDeprecation$1(opt) {
359
- if (opt && opt.sanitize && !opt.silent) {
360
- 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');
361
- }
362
- } // copied from https://stackoverflow.com/a/5450113/806777
363
-
364
-
365
- function repeatString$1(pattern, count) {
366
- if (count < 1) {
367
- return '';
368
- }
369
-
370
- var result = '';
371
-
372
- while (count > 1) {
373
- if (count & 1) {
374
- result += pattern;
375
- }
376
-
377
- count >>= 1;
378
- pattern += pattern;
379
- }
380
-
381
- return result + pattern;
382
- }
383
-
384
- var helpers = {
385
- escape: escape$2,
386
- unescape: unescape$1,
387
- edit: edit$1,
388
- cleanUrl: cleanUrl$1,
389
- resolveUrl: resolveUrl,
390
- noopTest: noopTest$1,
391
- merge: merge$2,
392
- splitCells: splitCells$1,
393
- rtrim: rtrim$1,
394
- findClosingBracket: findClosingBracket$1,
395
- checkSanitizeDeprecation: checkSanitizeDeprecation$1,
396
- repeatString: repeatString$1
397
- };
398
-
399
- var defaults$4 = defaults$5.exports.defaults;
400
- var rtrim = helpers.rtrim,
401
- splitCells = helpers.splitCells,
402
- _escape = helpers.escape,
403
- findClosingBracket = helpers.findClosingBracket;
404
-
405
- function outputLink(cap, link, raw) {
406
- var href = link.href;
407
- var title = link.title ? _escape(link.title) : null;
408
- var text = cap[1].replace(/\\([\[\]])/g, '$1');
409
-
410
- if (cap[0].charAt(0) !== '!') {
411
- return {
412
- type: 'link',
413
- raw: raw,
414
- href: href,
415
- title: title,
416
- text: text
417
- };
418
- } else {
419
- return {
420
- type: 'image',
421
- raw: raw,
422
- href: href,
423
- title: title,
424
- text: _escape(text)
425
- };
426
- }
427
- }
428
-
429
- function indentCodeCompensation(raw, text) {
430
- var matchIndentToCode = raw.match(/^(\s+)(?:```)/);
431
-
432
- if (matchIndentToCode === null) {
433
- return text;
434
- }
435
-
436
- var indentToCode = matchIndentToCode[1];
437
- return text.split('\n').map(function (node) {
438
- var matchIndentInNode = node.match(/^\s+/);
439
-
440
- if (matchIndentInNode === null) {
441
- return node;
442
- }
443
-
444
- var indentInNode = matchIndentInNode[0];
445
-
446
- if (indentInNode.length >= indentToCode.length) {
447
- return node.slice(indentToCode.length);
448
- }
449
-
450
- return node;
451
- }).join('\n');
452
- }
453
- /**
454
- * Tokenizer
455
- */
456
-
457
-
458
- var Tokenizer_1 = /*#__PURE__*/function () {
459
- function Tokenizer(options) {
460
- this.options = options || defaults$4;
461
- }
462
-
463
- var _proto = Tokenizer.prototype;
464
-
465
- _proto.space = function space(src) {
466
- var cap = this.rules.block.newline.exec(src);
467
-
468
- if (cap) {
469
- if (cap[0].length > 1) {
470
- return {
471
- type: 'space',
472
- raw: cap[0]
473
- };
474
- }
475
-
476
- return {
477
- raw: '\n'
478
- };
479
- }
480
- };
481
-
482
- _proto.code = function code(src) {
483
- var cap = this.rules.block.code.exec(src);
484
-
485
- if (cap) {
486
- var text = cap[0].replace(/^ {1,4}/gm, '');
487
- return {
488
- type: 'code',
489
- raw: cap[0],
490
- codeBlockStyle: 'indented',
491
- text: !this.options.pedantic ? rtrim(text, '\n') : text
492
- };
493
- }
494
- };
495
-
496
- _proto.fences = function fences(src) {
497
- var cap = this.rules.block.fences.exec(src);
498
-
499
- if (cap) {
500
- var raw = cap[0];
501
- var text = indentCodeCompensation(raw, cap[3] || '');
502
- return {
503
- type: 'code',
504
- raw: raw,
505
- lang: cap[2] ? cap[2].trim() : cap[2],
506
- text: text
507
- };
508
- }
509
- };
510
-
511
- _proto.heading = function heading(src) {
512
- var cap = this.rules.block.heading.exec(src);
513
-
514
- if (cap) {
515
- var text = cap[2].trim(); // remove trailing #s
516
-
517
- if (/#$/.test(text)) {
518
- var trimmed = rtrim(text, '#');
519
-
520
- if (this.options.pedantic) {
521
- text = trimmed.trim();
522
- } else if (!trimmed || / $/.test(trimmed)) {
523
- // CommonMark requires space before trailing #s
524
- text = trimmed.trim();
525
- }
526
- }
527
-
528
- return {
529
- type: 'heading',
530
- raw: cap[0],
531
- depth: cap[1].length,
532
- text: text
533
- };
534
- }
535
- };
536
-
537
- _proto.nptable = function nptable(src) {
538
- var cap = this.rules.block.nptable.exec(src);
539
-
540
- if (cap) {
541
- var item = {
542
- type: 'table',
543
- header: splitCells(cap[1].replace(/^ *| *\| *$/g, '')),
544
- align: cap[2].replace(/^ *|\| *$/g, '').split(/ *\| */),
545
- cells: cap[3] ? cap[3].replace(/\n$/, '').split('\n') : [],
546
- raw: cap[0]
547
- };
548
-
549
- if (item.header.length === item.align.length) {
550
- var l = item.align.length;
551
- var i;
552
-
553
- for (i = 0; i < l; i++) {
554
- if (/^ *-+: *$/.test(item.align[i])) {
555
- item.align[i] = 'right';
556
- } else if (/^ *:-+: *$/.test(item.align[i])) {
557
- item.align[i] = 'center';
558
- } else if (/^ *:-+ *$/.test(item.align[i])) {
559
- item.align[i] = 'left';
560
- } else {
561
- item.align[i] = null;
562
- }
563
- }
564
-
565
- l = item.cells.length;
566
-
567
- for (i = 0; i < l; i++) {
568
- item.cells[i] = splitCells(item.cells[i], item.header.length);
569
- }
570
-
571
- return item;
572
- }
573
- }
574
- };
575
-
576
- _proto.hr = function hr(src) {
577
- var cap = this.rules.block.hr.exec(src);
578
-
579
- if (cap) {
580
- return {
581
- type: 'hr',
582
- raw: cap[0]
583
- };
584
- }
585
- };
586
-
587
- _proto.blockquote = function blockquote(src) {
588
- var cap = this.rules.block.blockquote.exec(src);
589
-
590
- if (cap) {
591
- var text = cap[0].replace(/^ *> ?/gm, '');
592
- return {
593
- type: 'blockquote',
594
- raw: cap[0],
595
- text: text
596
- };
597
- }
598
- };
599
-
600
- _proto.list = function list(src) {
601
- var cap = this.rules.block.list.exec(src);
602
-
603
- if (cap) {
604
- var raw = cap[0];
605
- var bull = cap[2];
606
- var isordered = bull.length > 1;
607
- var list = {
608
- type: 'list',
609
- raw: raw,
610
- ordered: isordered,
611
- start: isordered ? +bull.slice(0, -1) : '',
612
- loose: false,
613
- items: []
614
- }; // Get each top-level item.
615
-
616
- var itemMatch = cap[0].match(this.rules.block.item);
617
- var next = false,
618
- item,
619
- space,
620
- bcurr,
621
- bnext,
622
- addBack,
623
- loose,
624
- istask,
625
- ischecked,
626
- endMatch;
627
- var l = itemMatch.length;
628
- bcurr = this.rules.block.listItemStart.exec(itemMatch[0]);
629
-
630
- for (var i = 0; i < l; i++) {
631
- item = itemMatch[i];
632
- raw = item;
633
-
634
- if (!this.options.pedantic) {
635
- // Determine if current item contains the end of the list
636
- endMatch = item.match(new RegExp('\\n\\s*\\n {0,' + (bcurr[0].length - 1) + '}\\S'));
637
-
638
- if (endMatch) {
639
- addBack = item.length - endMatch.index + itemMatch.slice(i + 1).join('\n').length;
640
- list.raw = list.raw.substring(0, list.raw.length - addBack);
641
- item = item.substring(0, endMatch.index);
642
- raw = item;
643
- l = i + 1;
644
- }
645
- } // Determine whether the next list item belongs here.
646
- // Backpedal if it does not belong in this list.
647
-
648
-
649
- if (i !== l - 1) {
650
- bnext = this.rules.block.listItemStart.exec(itemMatch[i + 1]);
651
-
652
- if (!this.options.pedantic ? bnext[1].length >= bcurr[0].length || bnext[1].length > 3 : bnext[1].length > bcurr[1].length) {
653
- // nested list or continuation
654
- itemMatch.splice(i, 2, itemMatch[i] + (!this.options.pedantic && bnext[1].length < bcurr[0].length && !itemMatch[i].match(/\n$/) ? '' : '\n') + itemMatch[i + 1]);
655
- i--;
656
- l--;
657
- continue;
658
- } else if ( // different bullet style
659
- !this.options.pedantic || this.options.smartLists ? bnext[2][bnext[2].length - 1] !== bull[bull.length - 1] : isordered === (bnext[2].length === 1)) {
660
- addBack = itemMatch.slice(i + 1).join('\n').length;
661
- list.raw = list.raw.substring(0, list.raw.length - addBack);
662
- i = l - 1;
663
- }
664
-
665
- bcurr = bnext;
666
- } // Remove the list item's bullet
667
- // so it is seen as the next token.
668
-
669
-
670
- space = item.length;
671
- item = item.replace(/^ *([*+-]|\d+[.)]) ?/, ''); // Outdent whatever the
672
- // list item contains. Hacky.
673
-
674
- if (~item.indexOf('\n ')) {
675
- space -= item.length;
676
- item = !this.options.pedantic ? item.replace(new RegExp('^ {1,' + space + '}', 'gm'), '') : item.replace(/^ {1,4}/gm, '');
677
- } // trim item newlines at end
678
-
679
-
680
- item = rtrim(item, '\n');
681
-
682
- if (i !== l - 1) {
683
- raw = raw + '\n';
684
- } // Determine whether item is loose or not.
685
- // Use: /(^|\n)(?! )[^\n]+\n\n(?!\s*$)/
686
- // for discount behavior.
687
-
688
-
689
- loose = next || /\n\n(?!\s*$)/.test(raw);
690
-
691
- if (i !== l - 1) {
692
- next = raw.slice(-2) === '\n\n';
693
- if (!loose) loose = next;
694
- }
695
-
696
- if (loose) {
697
- list.loose = true;
698
- } // Check for task list items
699
-
700
-
701
- if (this.options.gfm) {
702
- istask = /^\[[ xX]\] /.test(item);
703
- ischecked = undefined;
704
-
705
- if (istask) {
706
- ischecked = item[1] !== ' ';
707
- item = item.replace(/^\[[ xX]\] +/, '');
708
- }
709
- }
710
-
711
- list.items.push({
712
- type: 'list_item',
713
- raw: raw,
714
- task: istask,
715
- checked: ischecked,
716
- loose: loose,
717
- text: item
718
- });
719
- }
720
-
721
- return list;
722
- }
723
- };
724
-
725
- _proto.html = function html(src) {
726
- var cap = this.rules.block.html.exec(src);
727
-
728
- if (cap) {
729
- return {
730
- type: this.options.sanitize ? 'paragraph' : 'html',
731
- raw: cap[0],
732
- pre: !this.options.sanitizer && (cap[1] === 'pre' || cap[1] === 'script' || cap[1] === 'style'),
733
- text: this.options.sanitize ? this.options.sanitizer ? this.options.sanitizer(cap[0]) : _escape(cap[0]) : cap[0]
734
- };
735
- }
736
- };
737
-
738
- _proto.def = function def(src) {
739
- var cap = this.rules.block.def.exec(src);
740
-
741
- if (cap) {
742
- if (cap[3]) cap[3] = cap[3].substring(1, cap[3].length - 1);
743
- var tag = cap[1].toLowerCase().replace(/\s+/g, ' ');
744
- return {
745
- type: 'def',
746
- tag: tag,
747
- raw: cap[0],
748
- href: cap[2],
749
- title: cap[3]
750
- };
751
- }
752
- };
753
-
754
- _proto.table = function table(src) {
755
- var cap = this.rules.block.table.exec(src);
756
-
757
- if (cap) {
758
- var item = {
759
- type: 'table',
760
- header: splitCells(cap[1].replace(/^ *| *\| *$/g, '')),
761
- align: cap[2].replace(/^ *|\| *$/g, '').split(/ *\| */),
762
- cells: cap[3] ? cap[3].replace(/\n$/, '').split('\n') : []
763
- };
764
-
765
- if (item.header.length === item.align.length) {
766
- item.raw = cap[0];
767
- var l = item.align.length;
768
- var i;
769
-
770
- for (i = 0; i < l; i++) {
771
- if (/^ *-+: *$/.test(item.align[i])) {
772
- item.align[i] = 'right';
773
- } else if (/^ *:-+: *$/.test(item.align[i])) {
774
- item.align[i] = 'center';
775
- } else if (/^ *:-+ *$/.test(item.align[i])) {
776
- item.align[i] = 'left';
777
- } else {
778
- item.align[i] = null;
779
- }
780
- }
781
-
782
- l = item.cells.length;
783
-
784
- for (i = 0; i < l; i++) {
785
- item.cells[i] = splitCells(item.cells[i].replace(/^ *\| *| *\| *$/g, ''), item.header.length);
786
- }
787
-
788
- return item;
789
- }
790
- }
791
- };
792
-
793
- _proto.lheading = function lheading(src) {
794
- var cap = this.rules.block.lheading.exec(src);
795
-
796
- if (cap) {
797
- return {
798
- type: 'heading',
799
- raw: cap[0],
800
- depth: cap[2].charAt(0) === '=' ? 1 : 2,
801
- text: cap[1]
802
- };
803
- }
804
- };
805
-
806
- _proto.paragraph = function paragraph(src) {
807
- var cap = this.rules.block.paragraph.exec(src);
808
-
809
- if (cap) {
810
- return {
811
- type: 'paragraph',
812
- raw: cap[0],
813
- text: cap[1].charAt(cap[1].length - 1) === '\n' ? cap[1].slice(0, -1) : cap[1]
814
- };
815
- }
816
- };
817
-
818
- _proto.text = function text(src) {
819
- var cap = this.rules.block.text.exec(src);
820
-
821
- if (cap) {
822
- return {
823
- type: 'text',
824
- raw: cap[0],
825
- text: cap[0]
826
- };
827
- }
828
- };
829
-
830
- _proto.escape = function escape(src) {
831
- var cap = this.rules.inline.escape.exec(src);
832
-
833
- if (cap) {
834
- return {
835
- type: 'escape',
836
- raw: cap[0],
837
- text: _escape(cap[1])
838
- };
839
- }
840
- };
841
-
842
- _proto.tag = function tag(src, inLink, inRawBlock) {
843
- var cap = this.rules.inline.tag.exec(src);
844
-
845
- if (cap) {
846
- if (!inLink && /^<a /i.test(cap[0])) {
847
- inLink = true;
848
- } else if (inLink && /^<\/a>/i.test(cap[0])) {
849
- inLink = false;
850
- }
851
-
852
- if (!inRawBlock && /^<(pre|code|kbd|script)(\s|>)/i.test(cap[0])) {
853
- inRawBlock = true;
854
- } else if (inRawBlock && /^<\/(pre|code|kbd|script)(\s|>)/i.test(cap[0])) {
855
- inRawBlock = false;
856
- }
857
-
858
- return {
859
- type: this.options.sanitize ? 'text' : 'html',
860
- raw: cap[0],
861
- inLink: inLink,
862
- inRawBlock: inRawBlock,
863
- text: this.options.sanitize ? this.options.sanitizer ? this.options.sanitizer(cap[0]) : _escape(cap[0]) : cap[0]
864
- };
865
- }
866
- };
867
-
868
- _proto.link = function link(src) {
869
- var cap = this.rules.inline.link.exec(src);
870
-
871
- if (cap) {
872
- var trimmedUrl = cap[2].trim();
873
-
874
- if (!this.options.pedantic && /^</.test(trimmedUrl)) {
875
- // commonmark requires matching angle brackets
876
- if (!/>$/.test(trimmedUrl)) {
877
- return;
878
- } // ending angle bracket cannot be escaped
879
-
880
-
881
- var rtrimSlash = rtrim(trimmedUrl.slice(0, -1), '\\');
882
-
883
- if ((trimmedUrl.length - rtrimSlash.length) % 2 === 0) {
884
- return;
885
- }
886
- } else {
887
- // find closing parenthesis
888
- var lastParenIndex = findClosingBracket(cap[2], '()');
889
-
890
- if (lastParenIndex > -1) {
891
- var start = cap[0].indexOf('!') === 0 ? 5 : 4;
892
- var linkLen = start + cap[1].length + lastParenIndex;
893
- cap[2] = cap[2].substring(0, lastParenIndex);
894
- cap[0] = cap[0].substring(0, linkLen).trim();
895
- cap[3] = '';
896
- }
897
- }
898
-
899
- var href = cap[2];
900
- var title = '';
901
-
902
- if (this.options.pedantic) {
903
- // split pedantic href and title
904
- var link = /^([^'"]*[^\s])\s+(['"])(.*)\2/.exec(href);
905
-
906
- if (link) {
907
- href = link[1];
908
- title = link[3];
909
- }
910
- } else {
911
- title = cap[3] ? cap[3].slice(1, -1) : '';
912
- }
913
-
914
- href = href.trim();
915
-
916
- if (/^</.test(href)) {
917
- if (this.options.pedantic && !/>$/.test(trimmedUrl)) {
918
- // pedantic allows starting angle bracket without ending angle bracket
919
- href = href.slice(1);
920
- } else {
921
- href = href.slice(1, -1);
922
- }
923
- }
924
-
925
- return outputLink(cap, {
926
- href: href ? href.replace(this.rules.inline._escapes, '$1') : href,
927
- title: title ? title.replace(this.rules.inline._escapes, '$1') : title
928
- }, cap[0]);
929
- }
930
- };
931
-
932
- _proto.reflink = function reflink(src, links) {
933
- var cap;
934
-
935
- if ((cap = this.rules.inline.reflink.exec(src)) || (cap = this.rules.inline.nolink.exec(src))) {
936
- var link = (cap[2] || cap[1]).replace(/\s+/g, ' ');
937
- link = links[link.toLowerCase()];
938
-
939
- if (!link || !link.href) {
940
- var text = cap[0].charAt(0);
941
- return {
942
- type: 'text',
943
- raw: text,
944
- text: text
945
- };
946
- }
947
-
948
- return outputLink(cap, link, cap[0]);
949
- }
950
- };
951
-
952
- _proto.emStrong = function emStrong(src, maskedSrc, prevChar) {
953
- if (prevChar === void 0) {
954
- prevChar = '';
955
- }
956
-
957
- var match = this.rules.inline.emStrong.lDelim.exec(src);
958
- if (!match) return;
959
- 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
960
-
961
- var nextChar = match[1] || match[2] || '';
962
-
963
- if (!nextChar || nextChar && (prevChar === '' || this.rules.inline.punctuation.exec(prevChar))) {
964
- var lLength = match[0].length - 1;
965
- var rDelim,
966
- rLength,
967
- delimTotal = lLength,
968
- midDelimTotal = 0;
969
- var endReg = match[0][0] === '*' ? this.rules.inline.emStrong.rDelimAst : this.rules.inline.emStrong.rDelimUnd;
970
- endReg.lastIndex = 0;
971
- maskedSrc = maskedSrc.slice(-1 * src.length + lLength); // Bump maskedSrc to same section of string as src (move to lexer?)
972
-
973
- while ((match = endReg.exec(maskedSrc)) != null) {
974
- rDelim = match[1] || match[2] || match[3] || match[4] || match[5] || match[6];
975
- if (!rDelim) continue; // matched the first alternative in rules.js (skip the * in __abc*abc__)
976
-
977
- rLength = rDelim.length;
978
-
979
- if (match[3] || match[4]) {
980
- // found another Left Delim
981
- delimTotal += rLength;
982
- continue;
983
- } else if (match[5] || match[6]) {
984
- // either Left or Right Delim
985
- if (lLength % 3 && !((lLength + rLength) % 3)) {
986
- midDelimTotal += rLength;
987
- continue; // CommonMark Emphasis Rules 9-10
988
- }
989
- }
990
-
991
- delimTotal -= rLength;
992
- if (delimTotal > 0) continue; // Haven't found enough closing delimiters
993
- // If this is the last rDelimiter, remove extra characters. *a*** -> *a*
994
-
995
- if (delimTotal + midDelimTotal - rLength <= 0 && !maskedSrc.slice(endReg.lastIndex).match(endReg)) {
996
- rLength = Math.min(rLength, rLength + delimTotal + midDelimTotal);
997
- }
998
-
999
- if (Math.min(lLength, rLength) % 2) {
1000
- return {
1001
- type: 'em',
1002
- raw: src.slice(0, lLength + match.index + rLength + 1),
1003
- text: src.slice(1, lLength + match.index + rLength)
1004
- };
1005
- }
1006
-
1007
- if (Math.min(lLength, rLength) % 2 === 0) {
1008
- return {
1009
- type: 'strong',
1010
- raw: src.slice(0, lLength + match.index + rLength + 1),
1011
- text: src.slice(2, lLength + match.index + rLength - 1)
1012
- };
1013
- }
1014
- }
1015
- }
1016
- };
1017
-
1018
- _proto.codespan = function codespan(src) {
1019
- var cap = this.rules.inline.code.exec(src);
1020
-
1021
- if (cap) {
1022
- var text = cap[2].replace(/\n/g, ' ');
1023
- var hasNonSpaceChars = /[^ ]/.test(text);
1024
- var hasSpaceCharsOnBothEnds = /^ /.test(text) && / $/.test(text);
1025
-
1026
- if (hasNonSpaceChars && hasSpaceCharsOnBothEnds) {
1027
- text = text.substring(1, text.length - 1);
1028
- }
1029
-
1030
- text = _escape(text, true);
1031
- return {
1032
- type: 'codespan',
1033
- raw: cap[0],
1034
- text: text
1035
- };
1036
- }
1037
- };
1038
-
1039
- _proto.br = function br(src) {
1040
- var cap = this.rules.inline.br.exec(src);
1041
-
1042
- if (cap) {
1043
- return {
1044
- type: 'br',
1045
- raw: cap[0]
1046
- };
1047
- }
1048
- };
1049
-
1050
- _proto.del = function del(src) {
1051
- var cap = this.rules.inline.del.exec(src);
1052
-
1053
- if (cap) {
1054
- return {
1055
- type: 'del',
1056
- raw: cap[0],
1057
- text: cap[2]
1058
- };
1059
- }
1060
- };
1061
-
1062
- _proto.autolink = function autolink(src, mangle) {
1063
- var cap = this.rules.inline.autolink.exec(src);
1064
-
1065
- if (cap) {
1066
- var text, href;
1067
-
1068
- if (cap[2] === '@') {
1069
- text = _escape(this.options.mangle ? mangle(cap[1]) : cap[1]);
1070
- href = 'mailto:' + text;
1071
- } else {
1072
- text = _escape(cap[1]);
1073
- href = text;
1074
- }
1075
-
1076
- return {
1077
- type: 'link',
1078
- raw: cap[0],
1079
- text: text,
1080
- href: href,
1081
- tokens: [{
1082
- type: 'text',
1083
- raw: text,
1084
- text: text
1085
- }]
1086
- };
1087
- }
1088
- };
1089
-
1090
- _proto.url = function url(src, mangle) {
1091
- var cap;
1092
-
1093
- if (cap = this.rules.inline.url.exec(src)) {
1094
- var text, href;
1095
-
1096
- if (cap[2] === '@') {
1097
- text = _escape(this.options.mangle ? mangle(cap[0]) : cap[0]);
1098
- href = 'mailto:' + text;
1099
- } else {
1100
- // do extended autolink path validation
1101
- var prevCapZero;
1102
-
1103
- do {
1104
- prevCapZero = cap[0];
1105
- cap[0] = this.rules.inline._backpedal.exec(cap[0])[0];
1106
- } while (prevCapZero !== cap[0]);
1107
-
1108
- text = _escape(cap[0]);
1109
-
1110
- if (cap[1] === 'www.') {
1111
- href = 'http://' + text;
1112
- } else {
1113
- href = text;
1114
- }
1115
- }
1116
-
1117
- return {
1118
- type: 'link',
1119
- raw: cap[0],
1120
- text: text,
1121
- href: href,
1122
- tokens: [{
1123
- type: 'text',
1124
- raw: text,
1125
- text: text
1126
- }]
1127
- };
1128
- }
1129
- };
1130
-
1131
- _proto.inlineText = function inlineText(src, inRawBlock, smartypants) {
1132
- var cap = this.rules.inline.text.exec(src);
1133
-
1134
- if (cap) {
1135
- var text;
1136
-
1137
- if (inRawBlock) {
1138
- text = this.options.sanitize ? this.options.sanitizer ? this.options.sanitizer(cap[0]) : _escape(cap[0]) : cap[0];
1139
- } else {
1140
- text = _escape(this.options.smartypants ? smartypants(cap[0]) : cap[0]);
1141
- }
1142
-
1143
- return {
1144
- type: 'text',
1145
- raw: cap[0],
1146
- text: text
1147
- };
1148
- }
1149
- };
1150
-
1151
- return Tokenizer;
1152
- }();
1153
-
1154
- var noopTest = helpers.noopTest,
1155
- edit = helpers.edit,
1156
- merge$1 = helpers.merge;
1157
- /**
1158
- * Block-Level Grammar
1159
- */
1160
-
1161
- var block$1 = {
1162
- newline: /^(?: *(?:\n|$))+/,
1163
- code: /^( {4}[^\n]+(?:\n(?: *(?:\n|$))*)?)+/,
1164
- fences: /^ {0,3}(`{3,}(?=[^`\n]*\n)|~{3,})([^\n]*)\n(?:|([\s\S]*?)\n)(?: {0,3}\1[~`]* *(?:\n+|$)|$)/,
1165
- hr: /^ {0,3}((?:- *){3,}|(?:_ *){3,}|(?:\* *){3,})(?:\n+|$)/,
1166
- heading: /^ {0,3}(#{1,6})(?=\s|$)(.*)(?:\n+|$)/,
1167
- blockquote: /^( {0,3}> ?(paragraph|[^\n]*)(?:\n|$))+/,
1168
- list: /^( {0,3})(bull) [\s\S]+?(?:hr|def|\n{2,}(?! )(?! {0,3}bull )\n*|\s*$)/,
1169
- html: '^ {0,3}(?:' // optional indentation
1170
- + '<(script|pre|style)[\\s>][\\s\\S]*?(?:</\\1>[^\\n]*\\n+|$)' // (1)
1171
- + '|comment[^\\n]*(\\n+|$)' // (2)
1172
- + '|<\\?[\\s\\S]*?(?:\\?>\\n*|$)' // (3)
1173
- + '|<![A-Z][\\s\\S]*?(?:>\\n*|$)' // (4)
1174
- + '|<!\\[CDATA\\[[\\s\\S]*?(?:\\]\\]>\\n*|$)' // (5)
1175
- + '|</?(tag)(?: +|\\n|/?>)[\\s\\S]*?(?:(?:\\n *)+\\n|$)' // (6)
1176
- + '|<(?!script|pre|style)([a-z][\\w-]*)(?:attribute)*? */?>(?=[ \\t]*(?:\\n|$))[\\s\\S]*?(?:(?:\\n *)+\\n|$)' // (7) open tag
1177
- + '|</(?!script|pre|style)[a-z][\\w-]*\\s*>(?=[ \\t]*(?:\\n|$))[\\s\\S]*?(?:(?:\\n *)+\\n|$)' // (7) closing tag
1178
- + ')',
1179
- def: /^ {0,3}\[(label)\]: *\n? *<?([^\s>]+)>?(?:(?: +\n? *| *\n *)(title))? *(?:\n+|$)/,
1180
- nptable: noopTest,
1181
- table: noopTest,
1182
- lheading: /^([^\n]+)\n {0,3}(=+|-+) *(?:\n+|$)/,
1183
- // regex template, placeholders will be replaced according to different paragraph
1184
- // interruption rules of commonmark and the original markdown spec:
1185
- _paragraph: /^([^\n]+(?:\n(?!hr|heading|lheading|blockquote|fences|list|html| +\n)[^\n]+)*)/,
1186
- text: /^[^\n]+/
1187
- };
1188
- block$1._label = /(?!\s*\])(?:\\[\[\]]|[^\[\]])+/;
1189
- block$1._title = /(?:"(?:\\"?|[^"\\])*"|'[^'\n]*(?:\n[^'\n]+)*\n?'|\([^()]*\))/;
1190
- block$1.def = edit(block$1.def).replace('label', block$1._label).replace('title', block$1._title).getRegex();
1191
- block$1.bullet = /(?:[*+-]|\d{1,9}[.)])/;
1192
- block$1.item = /^( *)(bull) ?[^\n]*(?:\n(?! *bull ?)[^\n]*)*/;
1193
- block$1.item = edit(block$1.item, 'gm').replace(/bull/g, block$1.bullet).getRegex();
1194
- block$1.listItemStart = edit(/^( *)(bull) */).replace('bull', block$1.bullet).getRegex();
1195
- 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();
1196
- 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';
1197
- block$1._comment = /<!--(?!-?>)[\s\S]*?(?:-->|$)/;
1198
- 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();
1199
- 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
1200
- .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
1201
- .replace('html', '</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|!--)').replace('tag', block$1._tag) // pars can be interrupted by type (6) html blocks
1202
- .getRegex();
1203
- block$1.blockquote = edit(block$1.blockquote).replace('paragraph', block$1.paragraph).getRegex();
1204
- /**
1205
- * Normal Block Grammar
1206
- */
1207
-
1208
- block$1.normal = merge$1({}, block$1);
1209
- /**
1210
- * GFM Block Grammar
1211
- */
1212
-
1213
- block$1.gfm = merge$1({}, block$1.normal, {
1214
- nptable: '^ *([^|\\n ].*\\|.*)\\n' // Header
1215
- + ' {0,3}([-:]+ *\\|[-| :]*)' // Align
1216
- + '(?:\\n((?:(?!\\n|hr|heading|blockquote|code|fences|list|html).*(?:\\n|$))*)\\n*|$)',
1217
- // Cells
1218
- table: '^ *\\|(.+)\\n' // Header
1219
- + ' {0,3}\\|?( *[-:]+[-| :]*)' // Align
1220
- + '(?:\\n *((?:(?!\\n|hr|heading|blockquote|code|fences|list|html).*(?:\\n|$))*)\\n*|$)' // Cells
1221
-
1222
- });
1223
- 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
1224
- .replace('html', '</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|!--)').replace('tag', block$1._tag) // tables can be interrupted by type (6) html blocks
1225
- .getRegex();
1226
- 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
1227
- .replace('html', '</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|!--)').replace('tag', block$1._tag) // tables can be interrupted by type (6) html blocks
1228
- .getRegex();
1229
- /**
1230
- * Pedantic grammar (original John Gruber's loose markdown specification)
1231
- */
1232
-
1233
- block$1.pedantic = merge$1({}, block$1.normal, {
1234
- html: edit('^ *(?:comment *(?:\\n|\\s*$)' + '|<(tag)[\\s\\S]+?</\\1> *(?:\\n{2,}|\\s*$)' // closed tag
1235
- + '|<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(),
1236
- def: /^ *\[([^\]]+)\]: *<?([^\s>]+)>?(?: +(["(][^\n]+[")]))? *(?:\n+|$)/,
1237
- heading: /^(#{1,6})(.*)(?:\n+|$)/,
1238
- fences: noopTest,
1239
- // fences not supported
1240
- 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()
1241
- });
1242
- /**
1243
- * Inline-Level Grammar
1244
- */
1245
-
1246
- var inline$1 = {
1247
- escape: /^\\([!"#$%&'()*+,\-./:;<=>?@\[\]\\^_`{|}~])/,
1248
- autolink: /^<(scheme:[^\s\x00-\x1f<>]*|email)>/,
1249
- url: noopTest,
1250
- tag: '^comment' + '|^</[a-zA-Z][\\w:-]*\\s*>' // self-closing tag
1251
- + '|^<[a-zA-Z][\\w-]*(?:attribute)*?\\s*/?>' // open tag
1252
- + '|^<\\?[\\s\\S]*?\\?>' // processing instruction, e.g. <?php ?>
1253
- + '|^<![a-zA-Z]+\\s[\\s\\S]*?>' // declaration, e.g. <!DOCTYPE html>
1254
- + '|^<!\\[CDATA\\[[\\s\\S]*?\\]\\]>',
1255
- // CDATA section
1256
- link: /^!?\[(label)\]\(\s*(href)(?:\s+(title))?\s*\)/,
1257
- reflink: /^!?\[(label)\]\[(?!\s*\])((?:\\[\[\]]?|[^\[\]\\])+)\]/,
1258
- nolink: /^!?\[(?!\s*\])((?:\[[^\[\]]*\]|\\[\[\]]|[^\[\]])*)\](?:\[\])?/,
1259
- reflinkSearch: 'reflink|nolink(?!\\()',
1260
- emStrong: {
1261
- lDelim: /^(?:\*+(?:([punct_])|[^\s*]))|^_+(?:([punct*])|([^\s_]))/,
1262
- // (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.
1263
- // () Skip other delimiter (1) #*** (2) a***#, a*** (3) #***a, ***a (4) ***# (5) #***# (6) a***a
1264
- rDelimAst: /\_\_[^_]*?\*[^_]*?\_\_|[punct_](\*+)(?=[\s]|$)|[^punct*_\s](\*+)(?=[punct_\s]|$)|[punct_\s](\*+)(?=[^punct*_\s])|[\s](\*+)(?=[punct_])|[punct_](\*+)(?=[punct_])|[^punct*_\s](\*+)(?=[^punct*_\s])/,
1265
- rDelimUnd: /\*\*[^*]*?\_[^*]*?\*\*|[punct*](\_+)(?=[\s]|$)|[^punct*_\s](\_+)(?=[punct*\s]|$)|[punct*\s](\_+)(?=[^punct*_\s])|[\s](\_+)(?=[punct*])|[punct*](\_+)(?=[punct*])/ // ^- Not allowed for _
1266
-
1267
- },
1268
- code: /^(`+)([^`]|[^`][\s\S]*?[^`])\1(?!`)/,
1269
- br: /^( {2,}|\\)\n(?!\s*$)/,
1270
- del: noopTest,
1271
- text: /^(`+|[^`])(?:(?= {2,}\n)|[\s\S]*?(?:(?=[\\<!\[`*_]|\b_|$)|[^ ](?= {2,}\n)))/,
1272
- punctuation: /^([\spunctuation])/
1273
- }; // list of punctuation marks from CommonMark spec
1274
- // without * and _ to handle the different emphasis markers * and _
1275
-
1276
- inline$1._punctuation = '!"#$%&\'()+\\-.,/:;<=>?@\\[\\]`^{|}~';
1277
- inline$1.punctuation = edit(inline$1.punctuation).replace(/punctuation/g, inline$1._punctuation).getRegex(); // sequences em should skip over [title](link), `code`, <html>
1278
-
1279
- inline$1.blockSkip = /\[[^\]]*?\]\([^\)]*?\)|`[^`]*?`|<[^>]*?>/g;
1280
- inline$1.escapedEmSt = /\\\*|\\_/g;
1281
- inline$1._comment = edit(block$1._comment).replace('(?:-->|$)', '-->').getRegex();
1282
- inline$1.emStrong.lDelim = edit(inline$1.emStrong.lDelim).replace(/punct/g, inline$1._punctuation).getRegex();
1283
- inline$1.emStrong.rDelimAst = edit(inline$1.emStrong.rDelimAst, 'g').replace(/punct/g, inline$1._punctuation).getRegex();
1284
- inline$1.emStrong.rDelimUnd = edit(inline$1.emStrong.rDelimUnd, 'g').replace(/punct/g, inline$1._punctuation).getRegex();
1285
- inline$1._escapes = /\\([!"#$%&'()*+,\-./:;<=>?@\[\]\\^_`{|}~])/g;
1286
- inline$1._scheme = /[a-zA-Z][a-zA-Z0-9+.-]{1,31}/;
1287
- 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])?)+(?![-_])/;
1288
- inline$1.autolink = edit(inline$1.autolink).replace('scheme', inline$1._scheme).replace('email', inline$1._email).getRegex();
1289
- inline$1._attribute = /\s+[a-zA-Z:_][\w.:-]*(?:\s*=\s*"[^"]*"|\s*=\s*'[^']*'|\s*=\s*[^\s"'=<>`]+)?/;
1290
- inline$1.tag = edit(inline$1.tag).replace('comment', inline$1._comment).replace('attribute', inline$1._attribute).getRegex();
1291
- inline$1._label = /(?:\[(?:\\.|[^\[\]\\])*\]|\\.|`[^`]*`|[^\[\]\\`])*?/;
1292
- inline$1._href = /<(?:\\.|[^\n<>\\])+>|[^\s\x00-\x1f]*/;
1293
- inline$1._title = /"(?:\\"?|[^"\\])*"|'(?:\\'?|[^'\\])*'|\((?:\\\)?|[^)\\])*\)/;
1294
- inline$1.link = edit(inline$1.link).replace('label', inline$1._label).replace('href', inline$1._href).replace('title', inline$1._title).getRegex();
1295
- inline$1.reflink = edit(inline$1.reflink).replace('label', inline$1._label).getRegex();
1296
- inline$1.reflinkSearch = edit(inline$1.reflinkSearch, 'g').replace('reflink', inline$1.reflink).replace('nolink', inline$1.nolink).getRegex();
1297
- /**
1298
- * Normal Inline Grammar
1299
- */
1300
-
1301
- inline$1.normal = merge$1({}, inline$1);
1302
- /**
1303
- * Pedantic Inline Grammar
1304
- */
1305
-
1306
- inline$1.pedantic = merge$1({}, inline$1.normal, {
1307
- strong: {
1308
- start: /^__|\*\*/,
1309
- middle: /^__(?=\S)([\s\S]*?\S)__(?!_)|^\*\*(?=\S)([\s\S]*?\S)\*\*(?!\*)/,
1310
- endAst: /\*\*(?!\*)/g,
1311
- endUnd: /__(?!_)/g
1312
- },
1313
- em: {
1314
- start: /^_|\*/,
1315
- middle: /^()\*(?=\S)([\s\S]*?\S)\*(?!\*)|^_(?=\S)([\s\S]*?\S)_(?!_)/,
1316
- endAst: /\*(?!\*)/g,
1317
- endUnd: /_(?!_)/g
1318
- },
1319
- link: edit(/^!?\[(label)\]\((.*?)\)/).replace('label', inline$1._label).getRegex(),
1320
- reflink: edit(/^!?\[(label)\]\s*\[([^\]]*)\]/).replace('label', inline$1._label).getRegex()
1321
- });
1322
- /**
1323
- * GFM Inline Grammar
1324
- */
1325
-
1326
- inline$1.gfm = merge$1({}, inline$1.normal, {
1327
- escape: edit(inline$1.escape).replace('])', '~|])').getRegex(),
1328
- _extended_email: /[A-Za-z0-9._+-]+(@)[a-zA-Z0-9-_]+(?:\.[a-zA-Z0-9-_]*[a-zA-Z0-9])+(?![-_])/,
1329
- url: /^((?:ftp|https?):\/\/|www\.)(?:[a-zA-Z0-9\-]+\.?)+[^\s<]*|^email/,
1330
- _backpedal: /(?:[^?!.,:;*_~()&]+|\([^)]*\)|&(?![a-zA-Z0-9]+;$)|[?!.,:;*_~)]+(?!$))+/,
1331
- del: /^(~~?)(?=[^\s~])([\s\S]*?[^\s~])\1(?=[^~]|$)/,
1332
- text: /^([`~]+|[^`~])(?:(?= {2,}\n)|(?=[a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-]+@)|[\s\S]*?(?:(?=[\\<!\[`*~_]|\b_|https?:\/\/|ftp:\/\/|www\.|$)|[^ ](?= {2,}\n)|[^a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-](?=[a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-]+@)))/
1333
- });
1334
- inline$1.gfm.url = edit(inline$1.gfm.url, 'i').replace('email', inline$1.gfm._extended_email).getRegex();
1335
- /**
1336
- * GFM + Line Breaks Inline Grammar
1337
- */
1338
-
1339
- inline$1.breaks = merge$1({}, inline$1.gfm, {
1340
- br: edit(inline$1.br).replace('{2,}', '*').getRegex(),
1341
- text: edit(inline$1.gfm.text).replace('\\b_', '\\b_| {2,}\\n').replace(/\{2,\}/g, '*').getRegex()
1342
- });
1343
- var rules = {
1344
- block: block$1,
1345
- inline: inline$1
1346
- };
1347
-
1348
- var Tokenizer$1 = Tokenizer_1;
1349
- var defaults$3 = defaults$5.exports.defaults;
1350
- var block = rules.block,
1351
- inline = rules.inline;
1352
- var repeatString = helpers.repeatString;
1353
- /**
1354
- * smartypants text replacement
1355
- */
1356
-
1357
- function smartypants(text) {
1358
- return text // em-dashes
1359
- .replace(/---/g, "\u2014") // en-dashes
1360
- .replace(/--/g, "\u2013") // opening singles
1361
- .replace(/(^|[-\u2014/(\[{"\s])'/g, "$1\u2018") // closing singles & apostrophes
1362
- .replace(/'/g, "\u2019") // opening doubles
1363
- .replace(/(^|[-\u2014/(\[{\u2018\s])"/g, "$1\u201C") // closing doubles
1364
- .replace(/"/g, "\u201D") // ellipses
1365
- .replace(/\.{3}/g, "\u2026");
1366
- }
1367
- /**
1368
- * mangle email addresses
1369
- */
1370
-
1371
-
1372
- function mangle(text) {
1373
- var out = '',
1374
- i,
1375
- ch;
1376
- var l = text.length;
1377
-
1378
- for (i = 0; i < l; i++) {
1379
- ch = text.charCodeAt(i);
1380
-
1381
- if (Math.random() > 0.5) {
1382
- ch = 'x' + ch.toString(16);
1383
- }
1384
-
1385
- out += '&#' + ch + ';';
1386
- }
1387
-
1388
- return out;
1389
- }
1390
- /**
1391
- * Block Lexer
1392
- */
1393
-
1394
-
1395
- var Lexer_1 = /*#__PURE__*/function () {
1396
- function Lexer(options) {
1397
- this.tokens = [];
1398
- this.tokens.links = Object.create(null);
1399
- this.options = options || defaults$3;
1400
- this.options.tokenizer = this.options.tokenizer || new Tokenizer$1();
1401
- this.tokenizer = this.options.tokenizer;
1402
- this.tokenizer.options = this.options;
1403
- var rules = {
1404
- block: block.normal,
1405
- inline: inline.normal
1406
- };
1407
-
1408
- if (this.options.pedantic) {
1409
- rules.block = block.pedantic;
1410
- rules.inline = inline.pedantic;
1411
- } else if (this.options.gfm) {
1412
- rules.block = block.gfm;
1413
-
1414
- if (this.options.breaks) {
1415
- rules.inline = inline.breaks;
1416
- } else {
1417
- rules.inline = inline.gfm;
1418
- }
1419
- }
1420
-
1421
- this.tokenizer.rules = rules;
1422
- }
1423
- /**
1424
- * Expose Rules
1425
- */
1426
-
1427
-
1428
- /**
1429
- * Static Lex Method
1430
- */
1431
- Lexer.lex = function lex(src, options) {
1432
- var lexer = new Lexer(options);
1433
- return lexer.lex(src);
1434
- }
1435
- /**
1436
- * Static Lex Inline Method
1437
- */
1438
- ;
1439
-
1440
- Lexer.lexInline = function lexInline(src, options) {
1441
- var lexer = new Lexer(options);
1442
- return lexer.inlineTokens(src);
1443
- }
1444
- /**
1445
- * Preprocessing
1446
- */
1447
- ;
1448
-
1449
- var _proto = Lexer.prototype;
1450
-
1451
- _proto.lex = function lex(src) {
1452
- src = src.replace(/\r\n|\r/g, '\n').replace(/\t/g, ' ');
1453
- this.blockTokens(src, this.tokens, true);
1454
- this.inline(this.tokens);
1455
- return this.tokens;
1456
- }
1457
- /**
1458
- * Lexing
1459
- */
1460
- ;
1461
-
1462
- _proto.blockTokens = function blockTokens(src, tokens, top) {
1463
- if (tokens === void 0) {
1464
- tokens = [];
1465
- }
1466
-
1467
- if (top === void 0) {
1468
- top = true;
1469
- }
1470
-
1471
- if (this.options.pedantic) {
1472
- src = src.replace(/^ +$/gm, '');
1473
- }
1474
-
1475
- var token, i, l, lastToken;
1476
-
1477
- while (src) {
1478
- // newline
1479
- if (token = this.tokenizer.space(src)) {
1480
- src = src.substring(token.raw.length);
1481
-
1482
- if (token.type) {
1483
- tokens.push(token);
1484
- }
1485
-
1486
- continue;
1487
- } // code
1488
-
1489
-
1490
- if (token = this.tokenizer.code(src)) {
1491
- src = src.substring(token.raw.length);
1492
- lastToken = tokens[tokens.length - 1]; // An indented code block cannot interrupt a paragraph.
1493
-
1494
- if (lastToken && lastToken.type === 'paragraph') {
1495
- lastToken.raw += '\n' + token.raw;
1496
- lastToken.text += '\n' + token.text;
1497
- } else {
1498
- tokens.push(token);
1499
- }
1500
-
1501
- continue;
1502
- } // fences
1503
-
1504
-
1505
- if (token = this.tokenizer.fences(src)) {
1506
- src = src.substring(token.raw.length);
1507
- tokens.push(token);
1508
- continue;
1509
- } // heading
1510
-
1511
-
1512
- if (token = this.tokenizer.heading(src)) {
1513
- src = src.substring(token.raw.length);
1514
- tokens.push(token);
1515
- continue;
1516
- } // table no leading pipe (gfm)
1517
-
1518
-
1519
- if (token = this.tokenizer.nptable(src)) {
1520
- src = src.substring(token.raw.length);
1521
- tokens.push(token);
1522
- continue;
1523
- } // hr
1524
-
1525
-
1526
- if (token = this.tokenizer.hr(src)) {
1527
- src = src.substring(token.raw.length);
1528
- tokens.push(token);
1529
- continue;
1530
- } // blockquote
1531
-
1532
-
1533
- if (token = this.tokenizer.blockquote(src)) {
1534
- src = src.substring(token.raw.length);
1535
- token.tokens = this.blockTokens(token.text, [], top);
1536
- tokens.push(token);
1537
- continue;
1538
- } // list
1539
-
1540
-
1541
- if (token = this.tokenizer.list(src)) {
1542
- src = src.substring(token.raw.length);
1543
- l = token.items.length;
1544
-
1545
- for (i = 0; i < l; i++) {
1546
- token.items[i].tokens = this.blockTokens(token.items[i].text, [], false);
1547
- }
1548
-
1549
- tokens.push(token);
1550
- continue;
1551
- } // html
1552
-
1553
-
1554
- if (token = this.tokenizer.html(src)) {
1555
- src = src.substring(token.raw.length);
1556
- tokens.push(token);
1557
- continue;
1558
- } // def
1559
-
1560
-
1561
- if (top && (token = this.tokenizer.def(src))) {
1562
- src = src.substring(token.raw.length);
1563
-
1564
- if (!this.tokens.links[token.tag]) {
1565
- this.tokens.links[token.tag] = {
1566
- href: token.href,
1567
- title: token.title
1568
- };
1569
- }
1570
-
1571
- continue;
1572
- } // table (gfm)
1573
-
1574
-
1575
- if (token = this.tokenizer.table(src)) {
1576
- src = src.substring(token.raw.length);
1577
- tokens.push(token);
1578
- continue;
1579
- } // lheading
1580
-
1581
-
1582
- if (token = this.tokenizer.lheading(src)) {
1583
- src = src.substring(token.raw.length);
1584
- tokens.push(token);
1585
- continue;
1586
- } // top-level paragraph
1587
-
1588
-
1589
- if (top && (token = this.tokenizer.paragraph(src))) {
1590
- src = src.substring(token.raw.length);
1591
- tokens.push(token);
1592
- continue;
1593
- } // text
1594
-
1595
-
1596
- if (token = this.tokenizer.text(src)) {
1597
- src = src.substring(token.raw.length);
1598
- lastToken = tokens[tokens.length - 1];
1599
-
1600
- if (lastToken && lastToken.type === 'text') {
1601
- lastToken.raw += '\n' + token.raw;
1602
- lastToken.text += '\n' + token.text;
1603
- } else {
1604
- tokens.push(token);
1605
- }
1606
-
1607
- continue;
1608
- }
1609
-
1610
- if (src) {
1611
- var errMsg = 'Infinite loop on byte: ' + src.charCodeAt(0);
1612
-
1613
- if (this.options.silent) {
1614
- console.error(errMsg);
1615
- break;
1616
- } else {
1617
- throw new Error(errMsg);
1618
- }
1619
- }
1620
- }
1621
-
1622
- return tokens;
1623
- };
1624
-
1625
- _proto.inline = function inline(tokens) {
1626
- var i, j, k, l2, row, token;
1627
- var l = tokens.length;
1628
-
1629
- for (i = 0; i < l; i++) {
1630
- token = tokens[i];
1631
-
1632
- switch (token.type) {
1633
- case 'paragraph':
1634
- case 'text':
1635
- case 'heading':
1636
- {
1637
- token.tokens = [];
1638
- this.inlineTokens(token.text, token.tokens);
1639
- break;
1640
- }
1641
-
1642
- case 'table':
1643
- {
1644
- token.tokens = {
1645
- header: [],
1646
- cells: []
1647
- }; // header
1648
-
1649
- l2 = token.header.length;
1650
-
1651
- for (j = 0; j < l2; j++) {
1652
- token.tokens.header[j] = [];
1653
- this.inlineTokens(token.header[j], token.tokens.header[j]);
1654
- } // cells
1655
-
1656
-
1657
- l2 = token.cells.length;
1658
-
1659
- for (j = 0; j < l2; j++) {
1660
- row = token.cells[j];
1661
- token.tokens.cells[j] = [];
1662
-
1663
- for (k = 0; k < row.length; k++) {
1664
- token.tokens.cells[j][k] = [];
1665
- this.inlineTokens(row[k], token.tokens.cells[j][k]);
1666
- }
1667
- }
1668
-
1669
- break;
1670
- }
1671
-
1672
- case 'blockquote':
1673
- {
1674
- this.inline(token.tokens);
1675
- break;
1676
- }
1677
-
1678
- case 'list':
1679
- {
1680
- l2 = token.items.length;
1681
-
1682
- for (j = 0; j < l2; j++) {
1683
- this.inline(token.items[j].tokens);
1684
- }
1685
-
1686
- break;
1687
- }
1688
- }
1689
- }
1690
-
1691
- return tokens;
1692
- }
1693
- /**
1694
- * Lexing/Compiling
1695
- */
1696
- ;
1697
-
1698
- _proto.inlineTokens = function inlineTokens(src, tokens, inLink, inRawBlock) {
1699
- if (tokens === void 0) {
1700
- tokens = [];
1701
- }
1702
-
1703
- if (inLink === void 0) {
1704
- inLink = false;
1705
- }
1706
-
1707
- if (inRawBlock === void 0) {
1708
- inRawBlock = false;
1709
- }
1710
-
1711
- var token, lastToken; // String with links masked to avoid interference with em and strong
1712
-
1713
- var maskedSrc = src;
1714
- var match;
1715
- var keepPrevChar, prevChar; // Mask out reflinks
1716
-
1717
- if (this.tokens.links) {
1718
- var links = Object.keys(this.tokens.links);
1719
-
1720
- if (links.length > 0) {
1721
- while ((match = this.tokenizer.rules.inline.reflinkSearch.exec(maskedSrc)) != null) {
1722
- if (links.includes(match[0].slice(match[0].lastIndexOf('[') + 1, -1))) {
1723
- maskedSrc = maskedSrc.slice(0, match.index) + '[' + repeatString('a', match[0].length - 2) + ']' + maskedSrc.slice(this.tokenizer.rules.inline.reflinkSearch.lastIndex);
1724
- }
1725
- }
1726
- }
1727
- } // Mask out other blocks
1728
-
1729
-
1730
- while ((match = this.tokenizer.rules.inline.blockSkip.exec(maskedSrc)) != null) {
1731
- maskedSrc = maskedSrc.slice(0, match.index) + '[' + repeatString('a', match[0].length - 2) + ']' + maskedSrc.slice(this.tokenizer.rules.inline.blockSkip.lastIndex);
1732
- } // Mask out escaped em & strong delimiters
1733
-
1734
-
1735
- while ((match = this.tokenizer.rules.inline.escapedEmSt.exec(maskedSrc)) != null) {
1736
- maskedSrc = maskedSrc.slice(0, match.index) + '++' + maskedSrc.slice(this.tokenizer.rules.inline.escapedEmSt.lastIndex);
1737
- }
1738
-
1739
- while (src) {
1740
- if (!keepPrevChar) {
1741
- prevChar = '';
1742
- }
1743
-
1744
- keepPrevChar = false; // escape
1745
-
1746
- if (token = this.tokenizer.escape(src)) {
1747
- src = src.substring(token.raw.length);
1748
- tokens.push(token);
1749
- continue;
1750
- } // tag
1751
-
1752
-
1753
- if (token = this.tokenizer.tag(src, inLink, inRawBlock)) {
1754
- src = src.substring(token.raw.length);
1755
- inLink = token.inLink;
1756
- inRawBlock = token.inRawBlock;
1757
- var _lastToken = tokens[tokens.length - 1];
1758
-
1759
- if (_lastToken && token.type === 'text' && _lastToken.type === 'text') {
1760
- _lastToken.raw += token.raw;
1761
- _lastToken.text += token.text;
1762
- } else {
1763
- tokens.push(token);
1764
- }
1765
-
1766
- continue;
1767
- } // link
1768
-
1769
-
1770
- if (token = this.tokenizer.link(src)) {
1771
- src = src.substring(token.raw.length);
1772
-
1773
- if (token.type === 'link') {
1774
- token.tokens = this.inlineTokens(token.text, [], true, inRawBlock);
1775
- }
1776
-
1777
- tokens.push(token);
1778
- continue;
1779
- } // reflink, nolink
1780
-
1781
-
1782
- if (token = this.tokenizer.reflink(src, this.tokens.links)) {
1783
- src = src.substring(token.raw.length);
1784
- var _lastToken2 = tokens[tokens.length - 1];
1785
-
1786
- if (token.type === 'link') {
1787
- token.tokens = this.inlineTokens(token.text, [], true, inRawBlock);
1788
- tokens.push(token);
1789
- } else if (_lastToken2 && token.type === 'text' && _lastToken2.type === 'text') {
1790
- _lastToken2.raw += token.raw;
1791
- _lastToken2.text += token.text;
1792
- } else {
1793
- tokens.push(token);
1794
- }
1795
-
1796
- continue;
1797
- } // em & strong
1798
-
1799
-
1800
- if (token = this.tokenizer.emStrong(src, maskedSrc, prevChar)) {
1801
- src = src.substring(token.raw.length);
1802
- token.tokens = this.inlineTokens(token.text, [], inLink, inRawBlock);
1803
- tokens.push(token);
1804
- continue;
1805
- } // code
1806
-
1807
-
1808
- if (token = this.tokenizer.codespan(src)) {
1809
- src = src.substring(token.raw.length);
1810
- tokens.push(token);
1811
- continue;
1812
- } // br
1813
-
1814
-
1815
- if (token = this.tokenizer.br(src)) {
1816
- src = src.substring(token.raw.length);
1817
- tokens.push(token);
1818
- continue;
1819
- } // del (gfm)
1820
-
1821
-
1822
- if (token = this.tokenizer.del(src)) {
1823
- src = src.substring(token.raw.length);
1824
- token.tokens = this.inlineTokens(token.text, [], inLink, inRawBlock);
1825
- tokens.push(token);
1826
- continue;
1827
- } // autolink
1828
-
1829
-
1830
- if (token = this.tokenizer.autolink(src, mangle)) {
1831
- src = src.substring(token.raw.length);
1832
- tokens.push(token);
1833
- continue;
1834
- } // url (gfm)
1835
-
1836
-
1837
- if (!inLink && (token = this.tokenizer.url(src, mangle))) {
1838
- src = src.substring(token.raw.length);
1839
- tokens.push(token);
1840
- continue;
1841
- } // text
1842
-
1843
-
1844
- if (token = this.tokenizer.inlineText(src, inRawBlock, smartypants)) {
1845
- src = src.substring(token.raw.length);
1846
-
1847
- if (token.raw.slice(-1) !== '_') {
1848
- // Track prevChar before string of ____ started
1849
- prevChar = token.raw.slice(-1);
1850
- }
1851
-
1852
- keepPrevChar = true;
1853
- lastToken = tokens[tokens.length - 1];
1854
-
1855
- if (lastToken && lastToken.type === 'text') {
1856
- lastToken.raw += token.raw;
1857
- lastToken.text += token.text;
1858
- } else {
1859
- tokens.push(token);
1860
- }
1861
-
1862
- continue;
1863
- }
1864
-
1865
- if (src) {
1866
- var errMsg = 'Infinite loop on byte: ' + src.charCodeAt(0);
1867
-
1868
- if (this.options.silent) {
1869
- console.error(errMsg);
1870
- break;
1871
- } else {
1872
- throw new Error(errMsg);
1873
- }
1874
- }
1875
- }
1876
-
1877
- return tokens;
1878
- };
1879
-
1880
- _createClass(Lexer, null, [{
1881
- key: "rules",
1882
- get: function get() {
1883
- return {
1884
- block: block,
1885
- inline: inline
1886
- };
1887
- }
1888
- }]);
1889
-
1890
- return Lexer;
1891
- }();
1892
-
1893
- var defaults$2 = defaults$5.exports.defaults;
1894
- var cleanUrl = helpers.cleanUrl,
1895
- escape$1 = helpers.escape;
1896
- /**
1897
- * Renderer
1898
- */
1899
-
1900
- var Renderer_1 = /*#__PURE__*/function () {
1901
- function Renderer(options) {
1902
- this.options = options || defaults$2;
1903
- }
1904
-
1905
- var _proto = Renderer.prototype;
1906
-
1907
- _proto.code = function code(_code, infostring, escaped) {
1908
- var lang = (infostring || '').match(/\S*/)[0];
1909
-
1910
- if (this.options.highlight) {
1911
- var out = this.options.highlight(_code, lang);
1912
-
1913
- if (out != null && out !== _code) {
1914
- escaped = true;
1915
- _code = out;
1916
- }
1917
- }
1918
-
1919
- _code = _code.replace(/\n$/, '') + '\n';
1920
-
1921
- if (!lang) {
1922
- return '<pre><code>' + (escaped ? _code : escape$1(_code, true)) + '</code></pre>\n';
1923
- }
1924
-
1925
- return '<pre><code class="' + this.options.langPrefix + escape$1(lang, true) + '">' + (escaped ? _code : escape$1(_code, true)) + '</code></pre>\n';
1926
- };
1927
-
1928
- _proto.blockquote = function blockquote(quote) {
1929
- return '<blockquote>\n' + quote + '</blockquote>\n';
1930
- };
1931
-
1932
- _proto.html = function html(_html) {
1933
- return _html;
1934
- };
1935
-
1936
- _proto.heading = function heading(text, level, raw, slugger) {
1937
- if (this.options.headerIds) {
1938
- return '<h' + level + ' id="' + this.options.headerPrefix + slugger.slug(raw) + '">' + text + '</h' + level + '>\n';
1939
- } // ignore IDs
1940
-
1941
-
1942
- return '<h' + level + '>' + text + '</h' + level + '>\n';
1943
- };
1944
-
1945
- _proto.hr = function hr() {
1946
- return this.options.xhtml ? '<hr/>\n' : '<hr>\n';
1947
- };
1948
-
1949
- _proto.list = function list(body, ordered, start) {
1950
- var type = ordered ? 'ol' : 'ul',
1951
- startatt = ordered && start !== 1 ? ' start="' + start + '"' : '';
1952
- return '<' + type + startatt + '>\n' + body + '</' + type + '>\n';
1953
- };
1954
-
1955
- _proto.listitem = function listitem(text) {
1956
- return '<li>' + text + '</li>\n';
1957
- };
1958
-
1959
- _proto.checkbox = function checkbox(checked) {
1960
- return '<input ' + (checked ? 'checked="" ' : '') + 'disabled="" type="checkbox"' + (this.options.xhtml ? ' /' : '') + '> ';
1961
- };
1962
-
1963
- _proto.paragraph = function paragraph(text) {
1964
- return '<p>' + text + '</p>\n';
1965
- };
1966
-
1967
- _proto.table = function table(header, body) {
1968
- if (body) body = '<tbody>' + body + '</tbody>';
1969
- return '<table>\n' + '<thead>\n' + header + '</thead>\n' + body + '</table>\n';
1970
- };
1971
-
1972
- _proto.tablerow = function tablerow(content) {
1973
- return '<tr>\n' + content + '</tr>\n';
1974
- };
1975
-
1976
- _proto.tablecell = function tablecell(content, flags) {
1977
- var type = flags.header ? 'th' : 'td';
1978
- var tag = flags.align ? '<' + type + ' align="' + flags.align + '">' : '<' + type + '>';
1979
- return tag + content + '</' + type + '>\n';
1980
- } // span level renderer
1981
- ;
1982
-
1983
- _proto.strong = function strong(text) {
1984
- return '<strong>' + text + '</strong>';
1985
- };
1986
-
1987
- _proto.em = function em(text) {
1988
- return '<em>' + text + '</em>';
1989
- };
1990
-
1991
- _proto.codespan = function codespan(text) {
1992
- return '<code>' + text + '</code>';
1993
- };
1994
-
1995
- _proto.br = function br() {
1996
- return this.options.xhtml ? '<br/>' : '<br>';
1997
- };
1998
-
1999
- _proto.del = function del(text) {
2000
- return '<del>' + text + '</del>';
2001
- };
2002
-
2003
- _proto.link = function link(href, title, text) {
2004
- href = cleanUrl(this.options.sanitize, this.options.baseUrl, href);
2005
-
2006
- if (href === null) {
2007
- return text;
2008
- }
2009
-
2010
- var out = '<a href="' + escape$1(href) + '"';
2011
-
2012
- if (title) {
2013
- out += ' title="' + title + '"';
2014
- }
2015
-
2016
- out += '>' + text + '</a>';
2017
- return out;
2018
- };
2019
-
2020
- _proto.image = function image(href, title, text) {
2021
- href = cleanUrl(this.options.sanitize, this.options.baseUrl, href);
2022
-
2023
- if (href === null) {
2024
- return text;
2025
- }
2026
-
2027
- var out = '<img src="' + href + '" alt="' + text + '"';
2028
-
2029
- if (title) {
2030
- out += ' title="' + title + '"';
2031
- }
2032
-
2033
- out += this.options.xhtml ? '/>' : '>';
2034
- return out;
2035
- };
2036
-
2037
- _proto.text = function text(_text) {
2038
- return _text;
2039
- };
2040
-
2041
- return Renderer;
2042
- }();
2043
-
2044
- /**
2045
- * TextRenderer
2046
- * returns only the textual part of the token
2047
- */
2048
-
2049
- var TextRenderer_1 = /*#__PURE__*/function () {
2050
- function TextRenderer() {}
2051
-
2052
- var _proto = TextRenderer.prototype;
2053
-
2054
- // no need for block level renderers
2055
- _proto.strong = function strong(text) {
2056
- return text;
2057
- };
2058
-
2059
- _proto.em = function em(text) {
2060
- return text;
2061
- };
2062
-
2063
- _proto.codespan = function codespan(text) {
2064
- return text;
2065
- };
2066
-
2067
- _proto.del = function del(text) {
2068
- return text;
2069
- };
2070
-
2071
- _proto.html = function html(text) {
2072
- return text;
2073
- };
2074
-
2075
- _proto.text = function text(_text) {
2076
- return _text;
2077
- };
2078
-
2079
- _proto.link = function link(href, title, text) {
2080
- return '' + text;
2081
- };
2082
-
2083
- _proto.image = function image(href, title, text) {
2084
- return '' + text;
2085
- };
2086
-
2087
- _proto.br = function br() {
2088
- return '';
2089
- };
2090
-
2091
- return TextRenderer;
2092
- }();
2093
-
2094
- /**
2095
- * Slugger generates header id
2096
- */
2097
-
2098
- var Slugger_1 = /*#__PURE__*/function () {
2099
- function Slugger() {
2100
- this.seen = {};
2101
- }
2102
-
2103
- var _proto = Slugger.prototype;
2104
-
2105
- _proto.serialize = function serialize(value) {
2106
- return value.toLowerCase().trim() // remove html tags
2107
- .replace(/<[!\/a-z].*?>/ig, '') // remove unwanted chars
2108
- .replace(/[\u2000-\u206F\u2E00-\u2E7F\\'!"#$%&()*+,./:;<=>?@[\]^`{|}~]/g, '').replace(/\s/g, '-');
2109
- }
2110
- /**
2111
- * Finds the next safe (unique) slug to use
2112
- */
2113
- ;
2114
-
2115
- _proto.getNextSafeSlug = function getNextSafeSlug(originalSlug, isDryRun) {
2116
- var slug = originalSlug;
2117
- var occurenceAccumulator = 0;
2118
-
2119
- if (this.seen.hasOwnProperty(slug)) {
2120
- occurenceAccumulator = this.seen[originalSlug];
2121
-
2122
- do {
2123
- occurenceAccumulator++;
2124
- slug = originalSlug + '-' + occurenceAccumulator;
2125
- } while (this.seen.hasOwnProperty(slug));
2126
- }
2127
-
2128
- if (!isDryRun) {
2129
- this.seen[originalSlug] = occurenceAccumulator;
2130
- this.seen[slug] = 0;
2131
- }
2132
-
2133
- return slug;
2134
- }
2135
- /**
2136
- * Convert string to unique id
2137
- * @param {object} options
2138
- * @param {boolean} options.dryrun Generates the next unique slug without updating the internal accumulator.
2139
- */
2140
- ;
2141
-
2142
- _proto.slug = function slug(value, options) {
2143
- if (options === void 0) {
2144
- options = {};
2145
- }
2146
-
2147
- var slug = this.serialize(value);
2148
- return this.getNextSafeSlug(slug, options.dryrun);
2149
- };
2150
-
2151
- return Slugger;
2152
- }();
2153
-
2154
- var Renderer$1 = Renderer_1;
2155
- var TextRenderer$1 = TextRenderer_1;
2156
- var Slugger$1 = Slugger_1;
2157
- var defaults$1 = defaults$5.exports.defaults;
2158
- var unescape = helpers.unescape;
2159
- /**
2160
- * Parsing & Compiling
2161
- */
2162
-
2163
- var Parser_1 = /*#__PURE__*/function () {
2164
- function Parser(options) {
2165
- this.options = options || defaults$1;
2166
- this.options.renderer = this.options.renderer || new Renderer$1();
2167
- this.renderer = this.options.renderer;
2168
- this.renderer.options = this.options;
2169
- this.textRenderer = new TextRenderer$1();
2170
- this.slugger = new Slugger$1();
2171
- }
2172
- /**
2173
- * Static Parse Method
2174
- */
2175
-
2176
-
2177
- Parser.parse = function parse(tokens, options) {
2178
- var parser = new Parser(options);
2179
- return parser.parse(tokens);
2180
- }
2181
- /**
2182
- * Static Parse Inline Method
2183
- */
2184
- ;
2185
-
2186
- Parser.parseInline = function parseInline(tokens, options) {
2187
- var parser = new Parser(options);
2188
- return parser.parseInline(tokens);
2189
- }
2190
- /**
2191
- * Parse Loop
2192
- */
2193
- ;
2194
-
2195
- var _proto = Parser.prototype;
2196
-
2197
- _proto.parse = function parse(tokens, top) {
2198
- if (top === void 0) {
2199
- top = true;
2200
- }
2201
-
2202
- var out = '',
2203
- i,
2204
- j,
2205
- k,
2206
- l2,
2207
- l3,
2208
- row,
2209
- cell,
2210
- header,
2211
- body,
2212
- token,
2213
- ordered,
2214
- start,
2215
- loose,
2216
- itemBody,
2217
- item,
2218
- checked,
2219
- task,
2220
- checkbox;
2221
- var l = tokens.length;
2222
-
2223
- for (i = 0; i < l; i++) {
2224
- token = tokens[i];
2225
-
2226
- switch (token.type) {
2227
- case 'space':
2228
- {
2229
- continue;
2230
- }
2231
-
2232
- case 'hr':
2233
- {
2234
- out += this.renderer.hr();
2235
- continue;
2236
- }
2237
-
2238
- case 'heading':
2239
- {
2240
- out += this.renderer.heading(this.parseInline(token.tokens), token.depth, unescape(this.parseInline(token.tokens, this.textRenderer)), this.slugger);
2241
- continue;
2242
- }
2243
-
2244
- case 'code':
2245
- {
2246
- out += this.renderer.code(token.text, token.lang, token.escaped);
2247
- continue;
2248
- }
2249
-
2250
- case 'table':
2251
- {
2252
- header = ''; // header
2253
-
2254
- cell = '';
2255
- l2 = token.header.length;
2256
-
2257
- for (j = 0; j < l2; j++) {
2258
- cell += this.renderer.tablecell(this.parseInline(token.tokens.header[j]), {
2259
- header: true,
2260
- align: token.align[j]
2261
- });
2262
- }
2263
-
2264
- header += this.renderer.tablerow(cell);
2265
- body = '';
2266
- l2 = token.cells.length;
2267
-
2268
- for (j = 0; j < l2; j++) {
2269
- row = token.tokens.cells[j];
2270
- cell = '';
2271
- l3 = row.length;
2272
-
2273
- for (k = 0; k < l3; k++) {
2274
- cell += this.renderer.tablecell(this.parseInline(row[k]), {
2275
- header: false,
2276
- align: token.align[k]
2277
- });
2278
- }
2279
-
2280
- body += this.renderer.tablerow(cell);
2281
- }
2282
-
2283
- out += this.renderer.table(header, body);
2284
- continue;
2285
- }
2286
-
2287
- case 'blockquote':
2288
- {
2289
- body = this.parse(token.tokens);
2290
- out += this.renderer.blockquote(body);
2291
- continue;
2292
- }
2293
-
2294
- case 'list':
2295
- {
2296
- ordered = token.ordered;
2297
- start = token.start;
2298
- loose = token.loose;
2299
- l2 = token.items.length;
2300
- body = '';
2301
-
2302
- for (j = 0; j < l2; j++) {
2303
- item = token.items[j];
2304
- checked = item.checked;
2305
- task = item.task;
2306
- itemBody = '';
2307
-
2308
- if (item.task) {
2309
- checkbox = this.renderer.checkbox(checked);
2310
-
2311
- if (loose) {
2312
- if (item.tokens.length > 0 && item.tokens[0].type === 'text') {
2313
- item.tokens[0].text = checkbox + ' ' + item.tokens[0].text;
2314
-
2315
- if (item.tokens[0].tokens && item.tokens[0].tokens.length > 0 && item.tokens[0].tokens[0].type === 'text') {
2316
- item.tokens[0].tokens[0].text = checkbox + ' ' + item.tokens[0].tokens[0].text;
2317
- }
2318
- } else {
2319
- item.tokens.unshift({
2320
- type: 'text',
2321
- text: checkbox
2322
- });
2323
- }
2324
- } else {
2325
- itemBody += checkbox;
2326
- }
2327
- }
2328
-
2329
- itemBody += this.parse(item.tokens, loose);
2330
- body += this.renderer.listitem(itemBody, task, checked);
2331
- }
2332
-
2333
- out += this.renderer.list(body, ordered, start);
2334
- continue;
2335
- }
2336
-
2337
- case 'html':
2338
- {
2339
- // TODO parse inline content if parameter markdown=1
2340
- out += this.renderer.html(token.text);
2341
- continue;
2342
- }
2343
-
2344
- case 'paragraph':
2345
- {
2346
- out += this.renderer.paragraph(this.parseInline(token.tokens));
2347
- continue;
2348
- }
2349
-
2350
- case 'text':
2351
- {
2352
- body = token.tokens ? this.parseInline(token.tokens) : token.text;
2353
-
2354
- while (i + 1 < l && tokens[i + 1].type === 'text') {
2355
- token = tokens[++i];
2356
- body += '\n' + (token.tokens ? this.parseInline(token.tokens) : token.text);
2357
- }
2358
-
2359
- out += top ? this.renderer.paragraph(body) : body;
2360
- continue;
2361
- }
2362
-
2363
- default:
2364
- {
2365
- var errMsg = 'Token with "' + token.type + '" type was not found.';
2366
-
2367
- if (this.options.silent) {
2368
- console.error(errMsg);
2369
- return;
2370
- } else {
2371
- throw new Error(errMsg);
2372
- }
2373
- }
2374
- }
2375
- }
2376
-
2377
- return out;
2378
- }
2379
- /**
2380
- * Parse Inline Tokens
2381
- */
2382
- ;
2383
-
2384
- _proto.parseInline = function parseInline(tokens, renderer) {
2385
- renderer = renderer || this.renderer;
2386
- var out = '',
2387
- i,
2388
- token;
2389
- var l = tokens.length;
2390
-
2391
- for (i = 0; i < l; i++) {
2392
- token = tokens[i];
2393
-
2394
- switch (token.type) {
2395
- case 'escape':
2396
- {
2397
- out += renderer.text(token.text);
2398
- break;
2399
- }
2400
-
2401
- case 'html':
2402
- {
2403
- out += renderer.html(token.text);
2404
- break;
2405
- }
2406
-
2407
- case 'link':
2408
- {
2409
- out += renderer.link(token.href, token.title, this.parseInline(token.tokens, renderer));
2410
- break;
2411
- }
2412
-
2413
- case 'image':
2414
- {
2415
- out += renderer.image(token.href, token.title, token.text);
2416
- break;
2417
- }
2418
-
2419
- case 'strong':
2420
- {
2421
- out += renderer.strong(this.parseInline(token.tokens, renderer));
2422
- break;
2423
- }
2424
-
2425
- case 'em':
2426
- {
2427
- out += renderer.em(this.parseInline(token.tokens, renderer));
2428
- break;
2429
- }
2430
-
2431
- case 'codespan':
2432
- {
2433
- out += renderer.codespan(token.text);
2434
- break;
2435
- }
2436
-
2437
- case 'br':
2438
- {
2439
- out += renderer.br();
2440
- break;
2441
- }
2442
-
2443
- case 'del':
2444
- {
2445
- out += renderer.del(this.parseInline(token.tokens, renderer));
2446
- break;
2447
- }
2448
-
2449
- case 'text':
2450
- {
2451
- out += renderer.text(token.text);
2452
- break;
2453
- }
2454
-
2455
- default:
2456
- {
2457
- var errMsg = 'Token with "' + token.type + '" type was not found.';
2458
-
2459
- if (this.options.silent) {
2460
- console.error(errMsg);
2461
- return;
2462
- } else {
2463
- throw new Error(errMsg);
2464
- }
2465
- }
2466
- }
2467
- }
2468
-
2469
- return out;
2470
- };
2471
-
2472
- return Parser;
2473
- }();
2474
-
2475
- var Lexer = Lexer_1;
2476
- var Parser = Parser_1;
2477
- var Tokenizer = Tokenizer_1;
2478
- var Renderer = Renderer_1;
2479
- var TextRenderer = TextRenderer_1;
2480
- var Slugger = Slugger_1;
2481
- var merge = helpers.merge,
2482
- checkSanitizeDeprecation = helpers.checkSanitizeDeprecation,
2483
- escape = helpers.escape;
2484
- var getDefaults = defaults$5.exports.getDefaults,
2485
- changeDefaults = defaults$5.exports.changeDefaults,
2486
- defaults = defaults$5.exports.defaults;
2487
- /**
2488
- * Marked
2489
- */
2490
-
2491
- function marked(src, opt, callback) {
2492
- // throw error in case of non string input
2493
- if (typeof src === 'undefined' || src === null) {
2494
- throw new Error('marked(): input parameter is undefined or null');
2495
- }
2496
-
2497
- if (typeof src !== 'string') {
2498
- throw new Error('marked(): input parameter is of type ' + Object.prototype.toString.call(src) + ', string expected');
2499
- }
2500
-
2501
- if (typeof opt === 'function') {
2502
- callback = opt;
2503
- opt = null;
2504
- }
2505
-
2506
- opt = merge({}, marked.defaults, opt || {});
2507
- checkSanitizeDeprecation(opt);
2508
-
2509
- if (callback) {
2510
- var highlight = opt.highlight;
2511
- var tokens;
2512
-
2513
- try {
2514
- tokens = Lexer.lex(src, opt);
2515
- } catch (e) {
2516
- return callback(e);
2517
- }
2518
-
2519
- var done = function done(err) {
2520
- var out;
2521
-
2522
- if (!err) {
2523
- try {
2524
- if (opt.walkTokens) {
2525
- marked.walkTokens(tokens, opt.walkTokens);
2526
- }
2527
-
2528
- out = Parser.parse(tokens, opt);
2529
- } catch (e) {
2530
- err = e;
2531
- }
2532
- }
2533
-
2534
- opt.highlight = highlight;
2535
- return err ? callback(err) : callback(null, out);
2536
- };
2537
-
2538
- if (!highlight || highlight.length < 3) {
2539
- return done();
2540
- }
2541
-
2542
- delete opt.highlight;
2543
- if (!tokens.length) return done();
2544
- var pending = 0;
2545
- marked.walkTokens(tokens, function (token) {
2546
- if (token.type === 'code') {
2547
- pending++;
2548
- setTimeout(function () {
2549
- highlight(token.text, token.lang, function (err, code) {
2550
- if (err) {
2551
- return done(err);
2552
- }
2553
-
2554
- if (code != null && code !== token.text) {
2555
- token.text = code;
2556
- token.escaped = true;
2557
- }
2558
-
2559
- pending--;
2560
-
2561
- if (pending === 0) {
2562
- done();
2563
- }
2564
- });
2565
- }, 0);
2566
- }
2567
- });
2568
-
2569
- if (pending === 0) {
2570
- done();
2571
- }
2572
-
2573
- return;
2574
- }
2575
-
2576
- try {
2577
- var _tokens = Lexer.lex(src, opt);
2578
-
2579
- if (opt.walkTokens) {
2580
- marked.walkTokens(_tokens, opt.walkTokens);
2581
- }
2582
-
2583
- return Parser.parse(_tokens, opt);
2584
- } catch (e) {
2585
- e.message += '\nPlease report this to https://github.com/markedjs/marked.';
2586
-
2587
- if (opt.silent) {
2588
- return '<p>An error occurred:</p><pre>' + escape(e.message + '', true) + '</pre>';
2589
- }
2590
-
2591
- throw e;
2592
- }
2593
- }
2594
- /**
2595
- * Options
2596
- */
2597
-
2598
-
2599
- marked.options = marked.setOptions = function (opt) {
2600
- merge(marked.defaults, opt);
2601
- changeDefaults(marked.defaults);
2602
- return marked;
2603
- };
2604
-
2605
- marked.getDefaults = getDefaults;
2606
- marked.defaults = defaults;
2607
- /**
2608
- * Use Extension
2609
- */
2610
-
2611
- marked.use = function (extension) {
2612
- var opts = merge({}, extension);
2613
-
2614
- if (extension.renderer) {
2615
- (function () {
2616
- var renderer = marked.defaults.renderer || new Renderer();
2617
-
2618
- var _loop = function _loop(prop) {
2619
- var prevRenderer = renderer[prop];
2620
-
2621
- renderer[prop] = function () {
2622
- for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
2623
- args[_key] = arguments[_key];
2624
- }
2625
-
2626
- var ret = extension.renderer[prop].apply(renderer, args);
2627
-
2628
- if (ret === false) {
2629
- ret = prevRenderer.apply(renderer, args);
2630
- }
2631
-
2632
- return ret;
2633
- };
2634
- };
2635
-
2636
- for (var prop in extension.renderer) {
2637
- _loop(prop);
2638
- }
2639
-
2640
- opts.renderer = renderer;
2641
- })();
2642
- }
2643
-
2644
- if (extension.tokenizer) {
2645
- (function () {
2646
- var tokenizer = marked.defaults.tokenizer || new Tokenizer();
2647
-
2648
- var _loop2 = function _loop2(prop) {
2649
- var prevTokenizer = tokenizer[prop];
2650
-
2651
- tokenizer[prop] = function () {
2652
- for (var _len2 = arguments.length, args = new Array(_len2), _key2 = 0; _key2 < _len2; _key2++) {
2653
- args[_key2] = arguments[_key2];
2654
- }
2655
-
2656
- var ret = extension.tokenizer[prop].apply(tokenizer, args);
2657
-
2658
- if (ret === false) {
2659
- ret = prevTokenizer.apply(tokenizer, args);
2660
- }
2661
-
2662
- return ret;
2663
- };
2664
- };
2665
-
2666
- for (var prop in extension.tokenizer) {
2667
- _loop2(prop);
2668
- }
2669
-
2670
- opts.tokenizer = tokenizer;
2671
- })();
2672
- }
2673
-
2674
- if (extension.walkTokens) {
2675
- var walkTokens = marked.defaults.walkTokens;
2676
-
2677
- opts.walkTokens = function (token) {
2678
- extension.walkTokens(token);
2679
-
2680
- if (walkTokens) {
2681
- walkTokens(token);
2682
- }
2683
- };
2684
- }
2685
-
2686
- marked.setOptions(opts);
2687
- };
2688
- /**
2689
- * Run callback for every token
2690
- */
2691
-
2692
-
2693
- marked.walkTokens = function (tokens, callback) {
2694
- for (var _iterator = _createForOfIteratorHelperLoose(tokens), _step; !(_step = _iterator()).done;) {
2695
- var token = _step.value;
2696
- callback(token);
2697
-
2698
- switch (token.type) {
2699
- case 'table':
2700
- {
2701
- for (var _iterator2 = _createForOfIteratorHelperLoose(token.tokens.header), _step2; !(_step2 = _iterator2()).done;) {
2702
- var cell = _step2.value;
2703
- marked.walkTokens(cell, callback);
2704
- }
2705
-
2706
- for (var _iterator3 = _createForOfIteratorHelperLoose(token.tokens.cells), _step3; !(_step3 = _iterator3()).done;) {
2707
- var row = _step3.value;
2708
-
2709
- for (var _iterator4 = _createForOfIteratorHelperLoose(row), _step4; !(_step4 = _iterator4()).done;) {
2710
- var _cell = _step4.value;
2711
- marked.walkTokens(_cell, callback);
2712
- }
2713
- }
2714
-
2715
- break;
2716
- }
2717
-
2718
- case 'list':
2719
- {
2720
- marked.walkTokens(token.items, callback);
2721
- break;
2722
- }
2723
-
2724
- default:
2725
- {
2726
- if (token.tokens) {
2727
- marked.walkTokens(token.tokens, callback);
2728
- }
2729
- }
2730
- }
2731
- }
2732
- };
2733
- /**
2734
- * Parse Inline
2735
- */
2736
-
2737
-
2738
- marked.parseInline = function (src, opt) {
2739
- // throw error in case of non string input
2740
- if (typeof src === 'undefined' || src === null) {
2741
- throw new Error('marked.parseInline(): input parameter is undefined or null');
2742
- }
2743
-
2744
- if (typeof src !== 'string') {
2745
- throw new Error('marked.parseInline(): input parameter is of type ' + Object.prototype.toString.call(src) + ', string expected');
2746
- }
2747
-
2748
- opt = merge({}, marked.defaults, opt || {});
2749
- checkSanitizeDeprecation(opt);
2750
-
2751
- try {
2752
- var tokens = Lexer.lexInline(src, opt);
2753
-
2754
- if (opt.walkTokens) {
2755
- marked.walkTokens(tokens, opt.walkTokens);
2756
- }
2757
-
2758
- return Parser.parseInline(tokens, opt);
2759
- } catch (e) {
2760
- e.message += '\nPlease report this to https://github.com/markedjs/marked.';
2761
-
2762
- if (opt.silent) {
2763
- return '<p>An error occurred:</p><pre>' + escape(e.message + '', true) + '</pre>';
2764
- }
2765
-
2766
- throw e;
2767
- }
2768
- };
2769
- /**
2770
- * Expose
2771
- */
2772
-
2773
-
2774
- marked.Parser = Parser;
2775
- marked.parser = Parser.parse;
2776
- marked.Renderer = Renderer;
2777
- marked.TextRenderer = TextRenderer;
2778
- marked.Lexer = Lexer;
2779
- marked.lexer = Lexer.lex;
2780
- marked.Tokenizer = Tokenizer;
2781
- marked.Slugger = Slugger;
2782
- marked.parse = marked;
2783
- var marked_1 = marked;
2784
-
2785
- return marked_1;
2786
-
2787
- })));