marked 2.0.0 → 2.0.4
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.
- package/lib/marked.esm.js +268 -241
- package/lib/marked.js +259 -235
- package/marked.min.js +1 -1
- package/package.json +19 -19
- package/src/Tokenizer.js +36 -17
- package/src/rules.js +4 -4
package/lib/marked.esm.js
CHANGED
|
@@ -9,13 +9,9 @@
|
|
|
9
9
|
* The code in this file is generated from files in ./src/
|
|
10
10
|
*/
|
|
11
11
|
|
|
12
|
-
|
|
13
|
-
var module = { exports: {} };
|
|
14
|
-
return fn(module, module.exports), module.exports;
|
|
15
|
-
}
|
|
12
|
+
var defaults$5 = {exports: {}};
|
|
16
13
|
|
|
17
|
-
|
|
18
|
-
function getDefaults() {
|
|
14
|
+
function getDefaults$1() {
|
|
19
15
|
return {
|
|
20
16
|
baseUrl: null,
|
|
21
17
|
breaks: false,
|
|
@@ -38,20 +34,20 @@ function getDefaults() {
|
|
|
38
34
|
};
|
|
39
35
|
}
|
|
40
36
|
|
|
41
|
-
function changeDefaults(newDefaults) {
|
|
42
|
-
|
|
37
|
+
function changeDefaults$1(newDefaults) {
|
|
38
|
+
defaults$5.exports.defaults = newDefaults;
|
|
43
39
|
}
|
|
44
40
|
|
|
45
|
-
|
|
46
|
-
defaults: getDefaults(),
|
|
47
|
-
getDefaults,
|
|
48
|
-
changeDefaults
|
|
41
|
+
defaults$5.exports = {
|
|
42
|
+
defaults: getDefaults$1(),
|
|
43
|
+
getDefaults: getDefaults$1,
|
|
44
|
+
changeDefaults: changeDefaults$1
|
|
49
45
|
};
|
|
50
|
-
});
|
|
51
46
|
|
|
52
47
|
/**
|
|
53
48
|
* Helpers
|
|
54
49
|
*/
|
|
50
|
+
|
|
55
51
|
const escapeTest = /[&<>"']/;
|
|
56
52
|
const escapeReplace = /[&<>"']/g;
|
|
57
53
|
const escapeTestNoEncode = /[<>"']|&(?!#?\w+;)/;
|
|
@@ -64,7 +60,7 @@ const escapeReplacements = {
|
|
|
64
60
|
"'": '''
|
|
65
61
|
};
|
|
66
62
|
const getEscapeReplacement = (ch) => escapeReplacements[ch];
|
|
67
|
-
function escape(html, encode) {
|
|
63
|
+
function escape$3(html, encode) {
|
|
68
64
|
if (encode) {
|
|
69
65
|
if (escapeTest.test(html)) {
|
|
70
66
|
return html.replace(escapeReplace, getEscapeReplacement);
|
|
@@ -80,7 +76,7 @@ function escape(html, encode) {
|
|
|
80
76
|
|
|
81
77
|
const unescapeTest = /&(#(?:\d+)|(?:#x[0-9A-Fa-f]+)|(?:\w+));?/ig;
|
|
82
78
|
|
|
83
|
-
function unescape(html) {
|
|
79
|
+
function unescape$1(html) {
|
|
84
80
|
// explicitly match decimal, hex, and named HTML entities
|
|
85
81
|
return html.replace(unescapeTest, (_, n) => {
|
|
86
82
|
n = n.toLowerCase();
|
|
@@ -95,7 +91,7 @@ function unescape(html) {
|
|
|
95
91
|
}
|
|
96
92
|
|
|
97
93
|
const caret = /(^|[^\[])\^/g;
|
|
98
|
-
function edit(regex, opt) {
|
|
94
|
+
function edit$1(regex, opt) {
|
|
99
95
|
regex = regex.source || regex;
|
|
100
96
|
opt = opt || '';
|
|
101
97
|
const obj = {
|
|
@@ -114,11 +110,11 @@ function edit(regex, opt) {
|
|
|
114
110
|
|
|
115
111
|
const nonWordAndColonTest = /[^\w:]/g;
|
|
116
112
|
const originIndependentUrl = /^$|^[a-z][a-z0-9+.-]*:|^[?#]/i;
|
|
117
|
-
function cleanUrl(sanitize, base, href) {
|
|
113
|
+
function cleanUrl$1(sanitize, base, href) {
|
|
118
114
|
if (sanitize) {
|
|
119
115
|
let prot;
|
|
120
116
|
try {
|
|
121
|
-
prot = decodeURIComponent(unescape(href))
|
|
117
|
+
prot = decodeURIComponent(unescape$1(href))
|
|
122
118
|
.replace(nonWordAndColonTest, '')
|
|
123
119
|
.toLowerCase();
|
|
124
120
|
} catch (e) {
|
|
@@ -152,7 +148,7 @@ function resolveUrl(base, href) {
|
|
|
152
148
|
if (justDomain.test(base)) {
|
|
153
149
|
baseUrls[' ' + base] = base + '/';
|
|
154
150
|
} else {
|
|
155
|
-
baseUrls[' ' + base] = rtrim(base, '/', true);
|
|
151
|
+
baseUrls[' ' + base] = rtrim$1(base, '/', true);
|
|
156
152
|
}
|
|
157
153
|
}
|
|
158
154
|
base = baseUrls[' ' + base];
|
|
@@ -173,9 +169,9 @@ function resolveUrl(base, href) {
|
|
|
173
169
|
}
|
|
174
170
|
}
|
|
175
171
|
|
|
176
|
-
const noopTest = { exec: function noopTest() {} };
|
|
172
|
+
const noopTest$1 = { exec: function noopTest() {} };
|
|
177
173
|
|
|
178
|
-
function merge(obj) {
|
|
174
|
+
function merge$2(obj) {
|
|
179
175
|
let i = 1,
|
|
180
176
|
target,
|
|
181
177
|
key;
|
|
@@ -192,7 +188,7 @@ function merge(obj) {
|
|
|
192
188
|
return obj;
|
|
193
189
|
}
|
|
194
190
|
|
|
195
|
-
function splitCells(tableRow, count) {
|
|
191
|
+
function splitCells$1(tableRow, count) {
|
|
196
192
|
// ensure that every cell-delimiting pipe has a space
|
|
197
193
|
// before it to distinguish it from an escaped pipe
|
|
198
194
|
const row = tableRow.replace(/\|/g, (match, offset, str) => {
|
|
@@ -227,7 +223,7 @@ function splitCells(tableRow, count) {
|
|
|
227
223
|
// Remove trailing 'c's. Equivalent to str.replace(/c*$/, '').
|
|
228
224
|
// /c*$/ is vulnerable to REDOS.
|
|
229
225
|
// invert: Remove suffix of non-c chars instead. Default falsey.
|
|
230
|
-
function rtrim(str, c, invert) {
|
|
226
|
+
function rtrim$1(str, c, invert) {
|
|
231
227
|
const l = str.length;
|
|
232
228
|
if (l === 0) {
|
|
233
229
|
return '';
|
|
@@ -251,7 +247,7 @@ function rtrim(str, c, invert) {
|
|
|
251
247
|
return str.substr(0, l - suffLen);
|
|
252
248
|
}
|
|
253
249
|
|
|
254
|
-
function findClosingBracket(str, b) {
|
|
250
|
+
function findClosingBracket$1(str, b) {
|
|
255
251
|
if (str.indexOf(b[1]) === -1) {
|
|
256
252
|
return -1;
|
|
257
253
|
}
|
|
@@ -273,14 +269,14 @@ function findClosingBracket(str, b) {
|
|
|
273
269
|
return -1;
|
|
274
270
|
}
|
|
275
271
|
|
|
276
|
-
function checkSanitizeDeprecation(opt) {
|
|
272
|
+
function checkSanitizeDeprecation$1(opt) {
|
|
277
273
|
if (opt && opt.sanitize && !opt.silent) {
|
|
278
274
|
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');
|
|
279
275
|
}
|
|
280
276
|
}
|
|
281
277
|
|
|
282
278
|
// copied from https://stackoverflow.com/a/5450113/806777
|
|
283
|
-
function repeatString(pattern, count) {
|
|
279
|
+
function repeatString$1(pattern, count) {
|
|
284
280
|
if (count < 1) {
|
|
285
281
|
return '';
|
|
286
282
|
}
|
|
@@ -296,31 +292,31 @@ function repeatString(pattern, count) {
|
|
|
296
292
|
}
|
|
297
293
|
|
|
298
294
|
var helpers = {
|
|
299
|
-
escape,
|
|
300
|
-
unescape,
|
|
301
|
-
edit,
|
|
302
|
-
cleanUrl,
|
|
295
|
+
escape: escape$3,
|
|
296
|
+
unescape: unescape$1,
|
|
297
|
+
edit: edit$1,
|
|
298
|
+
cleanUrl: cleanUrl$1,
|
|
303
299
|
resolveUrl,
|
|
304
|
-
noopTest,
|
|
305
|
-
merge,
|
|
306
|
-
splitCells,
|
|
307
|
-
rtrim,
|
|
308
|
-
findClosingBracket,
|
|
309
|
-
checkSanitizeDeprecation,
|
|
310
|
-
repeatString
|
|
300
|
+
noopTest: noopTest$1,
|
|
301
|
+
merge: merge$2,
|
|
302
|
+
splitCells: splitCells$1,
|
|
303
|
+
rtrim: rtrim$1,
|
|
304
|
+
findClosingBracket: findClosingBracket$1,
|
|
305
|
+
checkSanitizeDeprecation: checkSanitizeDeprecation$1,
|
|
306
|
+
repeatString: repeatString$1
|
|
311
307
|
};
|
|
312
308
|
|
|
313
|
-
const { defaults: defaults$
|
|
309
|
+
const { defaults: defaults$4 } = defaults$5.exports;
|
|
314
310
|
const {
|
|
315
|
-
rtrim
|
|
316
|
-
splitCells
|
|
317
|
-
escape: escape$
|
|
318
|
-
findClosingBracket
|
|
311
|
+
rtrim,
|
|
312
|
+
splitCells,
|
|
313
|
+
escape: escape$2,
|
|
314
|
+
findClosingBracket
|
|
319
315
|
} = helpers;
|
|
320
316
|
|
|
321
317
|
function outputLink(cap, link, raw) {
|
|
322
318
|
const href = link.href;
|
|
323
|
-
const title = link.title ? escape$
|
|
319
|
+
const title = link.title ? escape$2(link.title) : null;
|
|
324
320
|
const text = cap[1].replace(/\\([\[\]])/g, '$1');
|
|
325
321
|
|
|
326
322
|
if (cap[0].charAt(0) !== '!') {
|
|
@@ -337,7 +333,7 @@ function outputLink(cap, link, raw) {
|
|
|
337
333
|
raw,
|
|
338
334
|
href,
|
|
339
335
|
title,
|
|
340
|
-
text: escape$
|
|
336
|
+
text: escape$2(text)
|
|
341
337
|
};
|
|
342
338
|
}
|
|
343
339
|
}
|
|
@@ -375,7 +371,7 @@ function indentCodeCompensation(raw, text) {
|
|
|
375
371
|
*/
|
|
376
372
|
var Tokenizer_1 = class Tokenizer {
|
|
377
373
|
constructor(options) {
|
|
378
|
-
this.options = options || defaults$
|
|
374
|
+
this.options = options || defaults$4;
|
|
379
375
|
}
|
|
380
376
|
|
|
381
377
|
space(src) {
|
|
@@ -400,7 +396,7 @@ var Tokenizer_1 = class Tokenizer {
|
|
|
400
396
|
raw: cap[0],
|
|
401
397
|
codeBlockStyle: 'indented',
|
|
402
398
|
text: !this.options.pedantic
|
|
403
|
-
? rtrim
|
|
399
|
+
? rtrim(text, '\n')
|
|
404
400
|
: text
|
|
405
401
|
};
|
|
406
402
|
}
|
|
@@ -428,7 +424,7 @@ var Tokenizer_1 = class Tokenizer {
|
|
|
428
424
|
|
|
429
425
|
// remove trailing #s
|
|
430
426
|
if (/#$/.test(text)) {
|
|
431
|
-
const trimmed = rtrim
|
|
427
|
+
const trimmed = rtrim(text, '#');
|
|
432
428
|
if (this.options.pedantic) {
|
|
433
429
|
text = trimmed.trim();
|
|
434
430
|
} else if (!trimmed || / $/.test(trimmed)) {
|
|
@@ -451,7 +447,7 @@ var Tokenizer_1 = class Tokenizer {
|
|
|
451
447
|
if (cap) {
|
|
452
448
|
const item = {
|
|
453
449
|
type: 'table',
|
|
454
|
-
header: splitCells
|
|
450
|
+
header: splitCells(cap[1].replace(/^ *| *\| *$/g, '')),
|
|
455
451
|
align: cap[2].replace(/^ *|\| *$/g, '').split(/ *\| */),
|
|
456
452
|
cells: cap[3] ? cap[3].replace(/\n$/, '').split('\n') : [],
|
|
457
453
|
raw: cap[0]
|
|
@@ -474,7 +470,7 @@ var Tokenizer_1 = class Tokenizer {
|
|
|
474
470
|
|
|
475
471
|
l = item.cells.length;
|
|
476
472
|
for (i = 0; i < l; i++) {
|
|
477
|
-
item.cells[i] = splitCells
|
|
473
|
+
item.cells[i] = splitCells(item.cells[i], item.header.length);
|
|
478
474
|
}
|
|
479
475
|
|
|
480
476
|
return item;
|
|
@@ -532,7 +528,8 @@ var Tokenizer_1 = class Tokenizer {
|
|
|
532
528
|
addBack,
|
|
533
529
|
loose,
|
|
534
530
|
istask,
|
|
535
|
-
ischecked
|
|
531
|
+
ischecked,
|
|
532
|
+
endMatch;
|
|
536
533
|
|
|
537
534
|
let l = itemMatch.length;
|
|
538
535
|
bcurr = this.rules.block.listItemStart.exec(itemMatch[0]);
|
|
@@ -540,31 +537,42 @@ var Tokenizer_1 = class Tokenizer {
|
|
|
540
537
|
item = itemMatch[i];
|
|
541
538
|
raw = item;
|
|
542
539
|
|
|
540
|
+
if (!this.options.pedantic) {
|
|
541
|
+
// Determine if current item contains the end of the list
|
|
542
|
+
endMatch = item.match(new RegExp('\\n\\s*\\n {0,' + (bcurr[0].length - 1) + '}\\S'));
|
|
543
|
+
if (endMatch) {
|
|
544
|
+
addBack = item.length - endMatch.index + itemMatch.slice(i + 1).join('\n').length;
|
|
545
|
+
list.raw = list.raw.substring(0, list.raw.length - addBack);
|
|
546
|
+
|
|
547
|
+
item = item.substring(0, endMatch.index);
|
|
548
|
+
raw = item;
|
|
549
|
+
l = i + 1;
|
|
550
|
+
}
|
|
551
|
+
}
|
|
552
|
+
|
|
543
553
|
// Determine whether the next list item belongs here.
|
|
544
554
|
// Backpedal if it does not belong in this list.
|
|
545
555
|
if (i !== l - 1) {
|
|
546
556
|
bnext = this.rules.block.listItemStart.exec(itemMatch[i + 1]);
|
|
547
557
|
if (
|
|
548
558
|
!this.options.pedantic
|
|
549
|
-
? bnext[1].length
|
|
559
|
+
? bnext[1].length >= bcurr[0].length || bnext[1].length > 3
|
|
550
560
|
: bnext[1].length > bcurr[1].length
|
|
551
561
|
) {
|
|
552
|
-
// nested list
|
|
553
|
-
itemMatch.splice(i, 2, itemMatch[i] + '\n' + itemMatch[i + 1]);
|
|
562
|
+
// nested list or continuation
|
|
563
|
+
itemMatch.splice(i, 2, itemMatch[i] + (!this.options.pedantic && bnext[1].length < bcurr[0].length && !itemMatch[i].match(/\n$/) ? '' : '\n') + itemMatch[i + 1]);
|
|
554
564
|
i--;
|
|
555
565
|
l--;
|
|
556
566
|
continue;
|
|
557
|
-
} else
|
|
558
|
-
|
|
559
|
-
|
|
560
|
-
|
|
561
|
-
|
|
562
|
-
|
|
563
|
-
)
|
|
564
|
-
|
|
565
|
-
|
|
566
|
-
i = l - 1;
|
|
567
|
-
}
|
|
567
|
+
} else if (
|
|
568
|
+
// different bullet style
|
|
569
|
+
!this.options.pedantic || this.options.smartLists
|
|
570
|
+
? bnext[2][bnext[2].length - 1] !== bull[bull.length - 1]
|
|
571
|
+
: isordered === (bnext[2].length === 1)
|
|
572
|
+
) {
|
|
573
|
+
addBack = itemMatch.slice(i + 1).join('\n').length;
|
|
574
|
+
list.raw = list.raw.substring(0, list.raw.length - addBack);
|
|
575
|
+
i = l - 1;
|
|
568
576
|
}
|
|
569
577
|
bcurr = bnext;
|
|
570
578
|
}
|
|
@@ -583,12 +591,18 @@ var Tokenizer_1 = class Tokenizer {
|
|
|
583
591
|
: item.replace(/^ {1,4}/gm, '');
|
|
584
592
|
}
|
|
585
593
|
|
|
594
|
+
// trim item newlines at end
|
|
595
|
+
item = rtrim(item, '\n');
|
|
596
|
+
if (i !== l - 1) {
|
|
597
|
+
raw = raw + '\n';
|
|
598
|
+
}
|
|
599
|
+
|
|
586
600
|
// Determine whether item is loose or not.
|
|
587
601
|
// Use: /(^|\n)(?! )[^\n]+\n\n(?!\s*$)/
|
|
588
602
|
// for discount behavior.
|
|
589
|
-
loose = next || /\n\n(?!\s*$)/.test(
|
|
603
|
+
loose = next || /\n\n(?!\s*$)/.test(raw);
|
|
590
604
|
if (i !== l - 1) {
|
|
591
|
-
next =
|
|
605
|
+
next = raw.slice(-2) === '\n\n';
|
|
592
606
|
if (!loose) loose = next;
|
|
593
607
|
}
|
|
594
608
|
|
|
@@ -630,7 +644,7 @@ var Tokenizer_1 = class Tokenizer {
|
|
|
630
644
|
raw: cap[0],
|
|
631
645
|
pre: !this.options.sanitizer
|
|
632
646
|
&& (cap[1] === 'pre' || cap[1] === 'script' || cap[1] === 'style'),
|
|
633
|
-
text: this.options.sanitize ? (this.options.sanitizer ? this.options.sanitizer(cap[0]) : escape$
|
|
647
|
+
text: this.options.sanitize ? (this.options.sanitizer ? this.options.sanitizer(cap[0]) : escape$2(cap[0])) : cap[0]
|
|
634
648
|
};
|
|
635
649
|
}
|
|
636
650
|
}
|
|
@@ -641,6 +655,7 @@ var Tokenizer_1 = class Tokenizer {
|
|
|
641
655
|
if (cap[3]) cap[3] = cap[3].substring(1, cap[3].length - 1);
|
|
642
656
|
const tag = cap[1].toLowerCase().replace(/\s+/g, ' ');
|
|
643
657
|
return {
|
|
658
|
+
type: 'def',
|
|
644
659
|
tag,
|
|
645
660
|
raw: cap[0],
|
|
646
661
|
href: cap[2],
|
|
@@ -654,7 +669,7 @@ var Tokenizer_1 = class Tokenizer {
|
|
|
654
669
|
if (cap) {
|
|
655
670
|
const item = {
|
|
656
671
|
type: 'table',
|
|
657
|
-
header: splitCells
|
|
672
|
+
header: splitCells(cap[1].replace(/^ *| *\| *$/g, '')),
|
|
658
673
|
align: cap[2].replace(/^ *|\| *$/g, '').split(/ *\| */),
|
|
659
674
|
cells: cap[3] ? cap[3].replace(/\n$/, '').split('\n') : []
|
|
660
675
|
};
|
|
@@ -678,7 +693,7 @@ var Tokenizer_1 = class Tokenizer {
|
|
|
678
693
|
|
|
679
694
|
l = item.cells.length;
|
|
680
695
|
for (i = 0; i < l; i++) {
|
|
681
|
-
item.cells[i] = splitCells
|
|
696
|
+
item.cells[i] = splitCells(
|
|
682
697
|
item.cells[i].replace(/^ *\| *| *\| *$/g, ''),
|
|
683
698
|
item.header.length);
|
|
684
699
|
}
|
|
@@ -730,7 +745,7 @@ var Tokenizer_1 = class Tokenizer {
|
|
|
730
745
|
return {
|
|
731
746
|
type: 'escape',
|
|
732
747
|
raw: cap[0],
|
|
733
|
-
text: escape$
|
|
748
|
+
text: escape$2(cap[1])
|
|
734
749
|
};
|
|
735
750
|
}
|
|
736
751
|
}
|
|
@@ -759,7 +774,7 @@ var Tokenizer_1 = class Tokenizer {
|
|
|
759
774
|
text: this.options.sanitize
|
|
760
775
|
? (this.options.sanitizer
|
|
761
776
|
? this.options.sanitizer(cap[0])
|
|
762
|
-
: escape$
|
|
777
|
+
: escape$2(cap[0]))
|
|
763
778
|
: cap[0]
|
|
764
779
|
};
|
|
765
780
|
}
|
|
@@ -776,13 +791,13 @@ var Tokenizer_1 = class Tokenizer {
|
|
|
776
791
|
}
|
|
777
792
|
|
|
778
793
|
// ending angle bracket cannot be escaped
|
|
779
|
-
const rtrimSlash = rtrim
|
|
794
|
+
const rtrimSlash = rtrim(trimmedUrl.slice(0, -1), '\\');
|
|
780
795
|
if ((trimmedUrl.length - rtrimSlash.length) % 2 === 0) {
|
|
781
796
|
return;
|
|
782
797
|
}
|
|
783
798
|
} else {
|
|
784
799
|
// find closing parenthesis
|
|
785
|
-
const lastParenIndex = findClosingBracket
|
|
800
|
+
const lastParenIndex = findClosingBracket(cap[2], '()');
|
|
786
801
|
if (lastParenIndex > -1) {
|
|
787
802
|
const start = cap[0].indexOf('!') === 0 ? 5 : 4;
|
|
788
803
|
const linkLen = start + cap[1].length + lastParenIndex;
|
|
@@ -909,7 +924,7 @@ var Tokenizer_1 = class Tokenizer {
|
|
|
909
924
|
if (hasNonSpaceChars && hasSpaceCharsOnBothEnds) {
|
|
910
925
|
text = text.substring(1, text.length - 1);
|
|
911
926
|
}
|
|
912
|
-
text = escape$
|
|
927
|
+
text = escape$2(text, true);
|
|
913
928
|
return {
|
|
914
929
|
type: 'codespan',
|
|
915
930
|
raw: cap[0],
|
|
@@ -944,10 +959,10 @@ var Tokenizer_1 = class Tokenizer {
|
|
|
944
959
|
if (cap) {
|
|
945
960
|
let text, href;
|
|
946
961
|
if (cap[2] === '@') {
|
|
947
|
-
text = escape$
|
|
962
|
+
text = escape$2(this.options.mangle ? mangle(cap[1]) : cap[1]);
|
|
948
963
|
href = 'mailto:' + text;
|
|
949
964
|
} else {
|
|
950
|
-
text = escape$
|
|
965
|
+
text = escape$2(cap[1]);
|
|
951
966
|
href = text;
|
|
952
967
|
}
|
|
953
968
|
|
|
@@ -972,7 +987,7 @@ var Tokenizer_1 = class Tokenizer {
|
|
|
972
987
|
if (cap = this.rules.inline.url.exec(src)) {
|
|
973
988
|
let text, href;
|
|
974
989
|
if (cap[2] === '@') {
|
|
975
|
-
text = escape$
|
|
990
|
+
text = escape$2(this.options.mangle ? mangle(cap[0]) : cap[0]);
|
|
976
991
|
href = 'mailto:' + text;
|
|
977
992
|
} else {
|
|
978
993
|
// do extended autolink path validation
|
|
@@ -981,7 +996,7 @@ var Tokenizer_1 = class Tokenizer {
|
|
|
981
996
|
prevCapZero = cap[0];
|
|
982
997
|
cap[0] = this.rules.inline._backpedal.exec(cap[0])[0];
|
|
983
998
|
} while (prevCapZero !== cap[0]);
|
|
984
|
-
text = escape$
|
|
999
|
+
text = escape$2(cap[0]);
|
|
985
1000
|
if (cap[1] === 'www.') {
|
|
986
1001
|
href = 'http://' + text;
|
|
987
1002
|
} else {
|
|
@@ -1009,9 +1024,9 @@ var Tokenizer_1 = class Tokenizer {
|
|
|
1009
1024
|
if (cap) {
|
|
1010
1025
|
let text;
|
|
1011
1026
|
if (inRawBlock) {
|
|
1012
|
-
text = this.options.sanitize ? (this.options.sanitizer ? this.options.sanitizer(cap[0]) : escape$
|
|
1027
|
+
text = this.options.sanitize ? (this.options.sanitizer ? this.options.sanitizer(cap[0]) : escape$2(cap[0])) : cap[0];
|
|
1013
1028
|
} else {
|
|
1014
|
-
text = escape$
|
|
1029
|
+
text = escape$2(this.options.smartypants ? smartypants(cap[0]) : cap[0]);
|
|
1015
1030
|
}
|
|
1016
1031
|
return {
|
|
1017
1032
|
type: 'text',
|
|
@@ -1023,15 +1038,15 @@ var Tokenizer_1 = class Tokenizer {
|
|
|
1023
1038
|
};
|
|
1024
1039
|
|
|
1025
1040
|
const {
|
|
1026
|
-
noopTest
|
|
1027
|
-
edit
|
|
1041
|
+
noopTest,
|
|
1042
|
+
edit,
|
|
1028
1043
|
merge: merge$1
|
|
1029
1044
|
} = helpers;
|
|
1030
1045
|
|
|
1031
1046
|
/**
|
|
1032
1047
|
* Block-Level Grammar
|
|
1033
1048
|
*/
|
|
1034
|
-
const block = {
|
|
1049
|
+
const block$1 = {
|
|
1035
1050
|
newline: /^(?: *(?:\n|$))+/,
|
|
1036
1051
|
code: /^( {4}[^\n]+(?:\n(?: *(?:\n|$))*)?)+/,
|
|
1037
1052
|
fences: /^ {0,3}(`{3,}(?=[^`\n]*\n)|~{3,})([^\n]*)\n(?:|([\s\S]*?)\n)(?: {0,3}\1[~`]* *(?:\n+|$)|$)/,
|
|
@@ -1045,13 +1060,13 @@ const block = {
|
|
|
1045
1060
|
+ '|<\\?[\\s\\S]*?(?:\\?>\\n*|$)' // (3)
|
|
1046
1061
|
+ '|<![A-Z][\\s\\S]*?(?:>\\n*|$)' // (4)
|
|
1047
1062
|
+ '|<!\\[CDATA\\[[\\s\\S]*?(?:\\]\\]>\\n*|$)' // (5)
|
|
1048
|
-
+ '|</?(tag)(?: +|\\n|/?>)[\\s\\S]*?(?:\\n
|
|
1049
|
-
+ '|<(?!script|pre|style)([a-z][\\w-]*)(?:attribute)*? */?>(?=[ \\t]*(?:\\n|$))[\\s\\S]*?(?:\\n
|
|
1050
|
-
+ '|</(?!script|pre|style)[a-z][\\w-]*\\s*>(?=[ \\t]*(?:\\n|$))[\\s\\S]*?(?:\\n
|
|
1063
|
+
+ '|</?(tag)(?: +|\\n|/?>)[\\s\\S]*?(?:(?:\\n *)+\\n|$)' // (6)
|
|
1064
|
+
+ '|<(?!script|pre|style)([a-z][\\w-]*)(?:attribute)*? */?>(?=[ \\t]*(?:\\n|$))[\\s\\S]*?(?:(?:\\n *)+\\n|$)' // (7) open tag
|
|
1065
|
+
+ '|</(?!script|pre|style)[a-z][\\w-]*\\s*>(?=[ \\t]*(?:\\n|$))[\\s\\S]*?(?:(?:\\n *)+\\n|$)' // (7) closing tag
|
|
1051
1066
|
+ ')',
|
|
1052
1067
|
def: /^ {0,3}\[(label)\]: *\n? *<?([^\s>]+)>?(?:(?: +\n? *| *\n *)(title))? *(?:\n+|$)/,
|
|
1053
|
-
nptable: noopTest
|
|
1054
|
-
table: noopTest
|
|
1068
|
+
nptable: noopTest,
|
|
1069
|
+
table: noopTest,
|
|
1055
1070
|
lheading: /^([^\n]+)\n {0,3}(=+|-+) *(?:\n+|$)/,
|
|
1056
1071
|
// regex template, placeholders will be replaced according to different paragraph
|
|
1057
1072
|
// interruption rules of commonmark and the original markdown spec:
|
|
@@ -1059,68 +1074,68 @@ const block = {
|
|
|
1059
1074
|
text: /^[^\n]+/
|
|
1060
1075
|
};
|
|
1061
1076
|
|
|
1062
|
-
block._label = /(?!\s*\])(?:\\[\[\]]|[^\[\]])+/;
|
|
1063
|
-
block._title = /(?:"(?:\\"?|[^"\\])*"|'[^'\n]*(?:\n[^'\n]+)*\n?'|\([^()]*\))/;
|
|
1064
|
-
block.def = edit$1
|
|
1065
|
-
.replace('label', block._label)
|
|
1066
|
-
.replace('title', block._title)
|
|
1077
|
+
block$1._label = /(?!\s*\])(?:\\[\[\]]|[^\[\]])+/;
|
|
1078
|
+
block$1._title = /(?:"(?:\\"?|[^"\\])*"|'[^'\n]*(?:\n[^'\n]+)*\n?'|\([^()]*\))/;
|
|
1079
|
+
block$1.def = edit(block$1.def)
|
|
1080
|
+
.replace('label', block$1._label)
|
|
1081
|
+
.replace('title', block$1._title)
|
|
1067
1082
|
.getRegex();
|
|
1068
1083
|
|
|
1069
|
-
block.bullet = /(?:[*+-]|\d{1,9}[.)])/;
|
|
1070
|
-
block.item = /^( *)(bull) ?[^\n]*(?:\n(?! *bull ?)[^\n]*)*/;
|
|
1071
|
-
block.item = edit$1
|
|
1072
|
-
.replace(/bull/g, block.bullet)
|
|
1084
|
+
block$1.bullet = /(?:[*+-]|\d{1,9}[.)])/;
|
|
1085
|
+
block$1.item = /^( *)(bull) ?[^\n]*(?:\n(?! *bull ?)[^\n]*)*/;
|
|
1086
|
+
block$1.item = edit(block$1.item, 'gm')
|
|
1087
|
+
.replace(/bull/g, block$1.bullet)
|
|
1073
1088
|
.getRegex();
|
|
1074
1089
|
|
|
1075
|
-
block.listItemStart = edit
|
|
1076
|
-
.replace('bull', block.bullet)
|
|
1090
|
+
block$1.listItemStart = edit(/^( *)(bull) */)
|
|
1091
|
+
.replace('bull', block$1.bullet)
|
|
1077
1092
|
.getRegex();
|
|
1078
1093
|
|
|
1079
|
-
block.list = edit$1
|
|
1080
|
-
.replace(/bull/g, block.bullet)
|
|
1094
|
+
block$1.list = edit(block$1.list)
|
|
1095
|
+
.replace(/bull/g, block$1.bullet)
|
|
1081
1096
|
.replace('hr', '\\n+(?=\\1?(?:(?:- *){3,}|(?:_ *){3,}|(?:\\* *){3,})(?:\\n+|$))')
|
|
1082
|
-
.replace('def', '\\n+(?=' + block.def.source + ')')
|
|
1097
|
+
.replace('def', '\\n+(?=' + block$1.def.source + ')')
|
|
1083
1098
|
.getRegex();
|
|
1084
1099
|
|
|
1085
|
-
block._tag = 'address|article|aside|base|basefont|blockquote|body|caption'
|
|
1100
|
+
block$1._tag = 'address|article|aside|base|basefont|blockquote|body|caption'
|
|
1086
1101
|
+ '|center|col|colgroup|dd|details|dialog|dir|div|dl|dt|fieldset|figcaption'
|
|
1087
1102
|
+ '|figure|footer|form|frame|frameset|h[1-6]|head|header|hr|html|iframe'
|
|
1088
1103
|
+ '|legend|li|link|main|menu|menuitem|meta|nav|noframes|ol|optgroup|option'
|
|
1089
1104
|
+ '|p|param|section|source|summary|table|tbody|td|tfoot|th|thead|title|tr'
|
|
1090
1105
|
+ '|track|ul';
|
|
1091
|
-
block._comment = /<!--(?!-?>)[\s\S]*?(?:-->|$)/;
|
|
1092
|
-
block.html = edit$1
|
|
1093
|
-
.replace('comment', block._comment)
|
|
1094
|
-
.replace('tag', block._tag)
|
|
1106
|
+
block$1._comment = /<!--(?!-?>)[\s\S]*?(?:-->|$)/;
|
|
1107
|
+
block$1.html = edit(block$1.html, 'i')
|
|
1108
|
+
.replace('comment', block$1._comment)
|
|
1109
|
+
.replace('tag', block$1._tag)
|
|
1095
1110
|
.replace('attribute', / +[a-zA-Z:_][\w.:-]*(?: *= *"[^"\n]*"| *= *'[^'\n]*'| *= *[^\s"'=<>`]+)?/)
|
|
1096
1111
|
.getRegex();
|
|
1097
1112
|
|
|
1098
|
-
block.paragraph = edit$1
|
|
1099
|
-
.replace('hr', block.hr)
|
|
1113
|
+
block$1.paragraph = edit(block$1._paragraph)
|
|
1114
|
+
.replace('hr', block$1.hr)
|
|
1100
1115
|
.replace('heading', ' {0,3}#{1,6} ')
|
|
1101
1116
|
.replace('|lheading', '') // setex headings don't interrupt commonmark paragraphs
|
|
1102
1117
|
.replace('blockquote', ' {0,3}>')
|
|
1103
1118
|
.replace('fences', ' {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n')
|
|
1104
1119
|
.replace('list', ' {0,3}(?:[*+-]|1[.)]) ') // only lists starting from 1 can interrupt
|
|
1105
1120
|
.replace('html', '</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|!--)')
|
|
1106
|
-
.replace('tag', block._tag) // pars can be interrupted by type (6) html blocks
|
|
1121
|
+
.replace('tag', block$1._tag) // pars can be interrupted by type (6) html blocks
|
|
1107
1122
|
.getRegex();
|
|
1108
1123
|
|
|
1109
|
-
block.blockquote = edit$1
|
|
1110
|
-
.replace('paragraph', block.paragraph)
|
|
1124
|
+
block$1.blockquote = edit(block$1.blockquote)
|
|
1125
|
+
.replace('paragraph', block$1.paragraph)
|
|
1111
1126
|
.getRegex();
|
|
1112
1127
|
|
|
1113
1128
|
/**
|
|
1114
1129
|
* Normal Block Grammar
|
|
1115
1130
|
*/
|
|
1116
1131
|
|
|
1117
|
-
block.normal = merge$1({}, block);
|
|
1132
|
+
block$1.normal = merge$1({}, block$1);
|
|
1118
1133
|
|
|
1119
1134
|
/**
|
|
1120
1135
|
* GFM Block Grammar
|
|
1121
1136
|
*/
|
|
1122
1137
|
|
|
1123
|
-
block.gfm = merge$1({}, block.normal, {
|
|
1138
|
+
block$1.gfm = merge$1({}, block$1.normal, {
|
|
1124
1139
|
nptable: '^ *([^|\\n ].*\\|.*)\\n' // Header
|
|
1125
1140
|
+ ' {0,3}([-:]+ *\\|[-| :]*)' // Align
|
|
1126
1141
|
+ '(?:\\n((?:(?!\\n|hr|heading|blockquote|code|fences|list|html).*(?:\\n|$))*)\\n*|$)', // Cells
|
|
@@ -1129,38 +1144,38 @@ block.gfm = merge$1({}, block.normal, {
|
|
|
1129
1144
|
+ '(?:\\n *((?:(?!\\n|hr|heading|blockquote|code|fences|list|html).*(?:\\n|$))*)\\n*|$)' // Cells
|
|
1130
1145
|
});
|
|
1131
1146
|
|
|
1132
|
-
block.gfm.nptable = edit$1
|
|
1133
|
-
.replace('hr', block.hr)
|
|
1147
|
+
block$1.gfm.nptable = edit(block$1.gfm.nptable)
|
|
1148
|
+
.replace('hr', block$1.hr)
|
|
1134
1149
|
.replace('heading', ' {0,3}#{1,6} ')
|
|
1135
1150
|
.replace('blockquote', ' {0,3}>')
|
|
1136
1151
|
.replace('code', ' {4}[^\\n]')
|
|
1137
1152
|
.replace('fences', ' {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n')
|
|
1138
1153
|
.replace('list', ' {0,3}(?:[*+-]|1[.)]) ') // only lists starting from 1 can interrupt
|
|
1139
1154
|
.replace('html', '</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|!--)')
|
|
1140
|
-
.replace('tag', block._tag) // tables can be interrupted by type (6) html blocks
|
|
1155
|
+
.replace('tag', block$1._tag) // tables can be interrupted by type (6) html blocks
|
|
1141
1156
|
.getRegex();
|
|
1142
1157
|
|
|
1143
|
-
block.gfm.table = edit$1
|
|
1144
|
-
.replace('hr', block.hr)
|
|
1158
|
+
block$1.gfm.table = edit(block$1.gfm.table)
|
|
1159
|
+
.replace('hr', block$1.hr)
|
|
1145
1160
|
.replace('heading', ' {0,3}#{1,6} ')
|
|
1146
1161
|
.replace('blockquote', ' {0,3}>')
|
|
1147
1162
|
.replace('code', ' {4}[^\\n]')
|
|
1148
1163
|
.replace('fences', ' {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n')
|
|
1149
1164
|
.replace('list', ' {0,3}(?:[*+-]|1[.)]) ') // only lists starting from 1 can interrupt
|
|
1150
1165
|
.replace('html', '</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|!--)')
|
|
1151
|
-
.replace('tag', block._tag) // tables can be interrupted by type (6) html blocks
|
|
1166
|
+
.replace('tag', block$1._tag) // tables can be interrupted by type (6) html blocks
|
|
1152
1167
|
.getRegex();
|
|
1153
1168
|
|
|
1154
1169
|
/**
|
|
1155
1170
|
* Pedantic grammar (original John Gruber's loose markdown specification)
|
|
1156
1171
|
*/
|
|
1157
1172
|
|
|
1158
|
-
block.pedantic = merge$1({}, block.normal, {
|
|
1159
|
-
html: edit
|
|
1173
|
+
block$1.pedantic = merge$1({}, block$1.normal, {
|
|
1174
|
+
html: edit(
|
|
1160
1175
|
'^ *(?:comment *(?:\\n|\\s*$)'
|
|
1161
1176
|
+ '|<(tag)[\\s\\S]+?</\\1> *(?:\\n{2,}|\\s*$)' // closed tag
|
|
1162
1177
|
+ '|<tag(?:"[^"]*"|\'[^\']*\'|\\s[^\'"/>\\s]*)*?/?> *(?:\\n{2,}|\\s*$))')
|
|
1163
|
-
.replace('comment', block._comment)
|
|
1178
|
+
.replace('comment', block$1._comment)
|
|
1164
1179
|
.replace(/tag/g, '(?!(?:'
|
|
1165
1180
|
+ 'a|em|strong|small|s|cite|q|dfn|abbr|data|time|code|var|samp|kbd|sub'
|
|
1166
1181
|
+ '|sup|i|b|u|mark|ruby|rt|rp|bdi|bdo|span|br|wbr|ins|del|img)'
|
|
@@ -1168,11 +1183,11 @@ block.pedantic = merge$1({}, block.normal, {
|
|
|
1168
1183
|
.getRegex(),
|
|
1169
1184
|
def: /^ *\[([^\]]+)\]: *<?([^\s>]+)>?(?: +(["(][^\n]+[")]))? *(?:\n+|$)/,
|
|
1170
1185
|
heading: /^(#{1,6})(.*)(?:\n+|$)/,
|
|
1171
|
-
fences: noopTest
|
|
1172
|
-
paragraph: edit$1
|
|
1173
|
-
.replace('hr', block.hr)
|
|
1186
|
+
fences: noopTest, // fences not supported
|
|
1187
|
+
paragraph: edit(block$1.normal._paragraph)
|
|
1188
|
+
.replace('hr', block$1.hr)
|
|
1174
1189
|
.replace('heading', ' *#{1,6} *[^\n]')
|
|
1175
|
-
.replace('lheading', block.lheading)
|
|
1190
|
+
.replace('lheading', block$1.lheading)
|
|
1176
1191
|
.replace('blockquote', ' {0,3}>')
|
|
1177
1192
|
.replace('|fences', '')
|
|
1178
1193
|
.replace('|list', '')
|
|
@@ -1183,10 +1198,10 @@ block.pedantic = merge$1({}, block.normal, {
|
|
|
1183
1198
|
/**
|
|
1184
1199
|
* Inline-Level Grammar
|
|
1185
1200
|
*/
|
|
1186
|
-
const inline = {
|
|
1201
|
+
const inline$1 = {
|
|
1187
1202
|
escape: /^\\([!"#$%&'()*+,\-./:;<=>?@\[\]\\^_`{|}~])/,
|
|
1188
1203
|
autolink: /^<(scheme:[^\s\x00-\x1f<>]*|email)>/,
|
|
1189
|
-
url: noopTest
|
|
1204
|
+
url: noopTest,
|
|
1190
1205
|
tag: '^comment'
|
|
1191
1206
|
+ '|^</[a-zA-Z][\\w:-]*\\s*>' // self-closing tag
|
|
1192
1207
|
+ '|^<[a-zA-Z][\\w-]*(?:attribute)*?\\s*/?>' // open tag
|
|
@@ -1206,80 +1221,80 @@ const inline = {
|
|
|
1206
1221
|
},
|
|
1207
1222
|
code: /^(`+)([^`]|[^`][\s\S]*?[^`])\1(?!`)/,
|
|
1208
1223
|
br: /^( {2,}|\\)\n(?!\s*$)/,
|
|
1209
|
-
del: noopTest
|
|
1224
|
+
del: noopTest,
|
|
1210
1225
|
text: /^(`+|[^`])(?:(?= {2,}\n)|[\s\S]*?(?:(?=[\\<!\[`*_]|\b_|$)|[^ ](?= {2,}\n)))/,
|
|
1211
1226
|
punctuation: /^([\spunctuation])/
|
|
1212
1227
|
};
|
|
1213
1228
|
|
|
1214
1229
|
// list of punctuation marks from CommonMark spec
|
|
1215
1230
|
// without * and _ to handle the different emphasis markers * and _
|
|
1216
|
-
inline._punctuation = '!"#$%&\'()+\\-.,/:;<=>?@\\[\\]`^{|}~';
|
|
1217
|
-
inline.punctuation = edit$1
|
|
1231
|
+
inline$1._punctuation = '!"#$%&\'()+\\-.,/:;<=>?@\\[\\]`^{|}~';
|
|
1232
|
+
inline$1.punctuation = edit(inline$1.punctuation).replace(/punctuation/g, inline$1._punctuation).getRegex();
|
|
1218
1233
|
|
|
1219
1234
|
// sequences em should skip over [title](link), `code`, <html>
|
|
1220
|
-
inline.blockSkip = /\[[^\]]*?\]\([^\)]*?\)|`[^`]*?`|<[^>]*?>/g;
|
|
1221
|
-
inline.escapedEmSt = /\\\*|\\_/g;
|
|
1235
|
+
inline$1.blockSkip = /\[[^\]]*?\]\([^\)]*?\)|`[^`]*?`|<[^>]*?>/g;
|
|
1236
|
+
inline$1.escapedEmSt = /\\\*|\\_/g;
|
|
1222
1237
|
|
|
1223
|
-
inline._comment = edit$1
|
|
1238
|
+
inline$1._comment = edit(block$1._comment).replace('(?:-->|$)', '-->').getRegex();
|
|
1224
1239
|
|
|
1225
|
-
inline.emStrong.lDelim = edit$1
|
|
1226
|
-
.replace(/punct/g, inline._punctuation)
|
|
1240
|
+
inline$1.emStrong.lDelim = edit(inline$1.emStrong.lDelim)
|
|
1241
|
+
.replace(/punct/g, inline$1._punctuation)
|
|
1227
1242
|
.getRegex();
|
|
1228
1243
|
|
|
1229
|
-
inline.emStrong.rDelimAst = edit$1
|
|
1230
|
-
.replace(/punct/g, inline._punctuation)
|
|
1244
|
+
inline$1.emStrong.rDelimAst = edit(inline$1.emStrong.rDelimAst, 'g')
|
|
1245
|
+
.replace(/punct/g, inline$1._punctuation)
|
|
1231
1246
|
.getRegex();
|
|
1232
1247
|
|
|
1233
|
-
inline.emStrong.rDelimUnd = edit$1
|
|
1234
|
-
.replace(/punct/g, inline._punctuation)
|
|
1248
|
+
inline$1.emStrong.rDelimUnd = edit(inline$1.emStrong.rDelimUnd, 'g')
|
|
1249
|
+
.replace(/punct/g, inline$1._punctuation)
|
|
1235
1250
|
.getRegex();
|
|
1236
1251
|
|
|
1237
|
-
inline._escapes = /\\([!"#$%&'()*+,\-./:;<=>?@\[\]\\^_`{|}~])/g;
|
|
1252
|
+
inline$1._escapes = /\\([!"#$%&'()*+,\-./:;<=>?@\[\]\\^_`{|}~])/g;
|
|
1238
1253
|
|
|
1239
|
-
inline._scheme = /[a-zA-Z][a-zA-Z0-9+.-]{1,31}/;
|
|
1240
|
-
inline._email = /[a-zA-Z0-9.!#$%&'*+/=?^_`{|}~-]+(@)[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)+(?![-_])/;
|
|
1241
|
-
inline.autolink = edit$1
|
|
1242
|
-
.replace('scheme', inline._scheme)
|
|
1243
|
-
.replace('email', inline._email)
|
|
1254
|
+
inline$1._scheme = /[a-zA-Z][a-zA-Z0-9+.-]{1,31}/;
|
|
1255
|
+
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])?)+(?![-_])/;
|
|
1256
|
+
inline$1.autolink = edit(inline$1.autolink)
|
|
1257
|
+
.replace('scheme', inline$1._scheme)
|
|
1258
|
+
.replace('email', inline$1._email)
|
|
1244
1259
|
.getRegex();
|
|
1245
1260
|
|
|
1246
|
-
inline._attribute = /\s+[a-zA-Z:_][\w.:-]*(?:\s*=\s*"[^"]*"|\s*=\s*'[^']*'|\s*=\s*[^\s"'=<>`]+)?/;
|
|
1261
|
+
inline$1._attribute = /\s+[a-zA-Z:_][\w.:-]*(?:\s*=\s*"[^"]*"|\s*=\s*'[^']*'|\s*=\s*[^\s"'=<>`]+)?/;
|
|
1247
1262
|
|
|
1248
|
-
inline.tag = edit$1
|
|
1249
|
-
.replace('comment', inline._comment)
|
|
1250
|
-
.replace('attribute', inline._attribute)
|
|
1263
|
+
inline$1.tag = edit(inline$1.tag)
|
|
1264
|
+
.replace('comment', inline$1._comment)
|
|
1265
|
+
.replace('attribute', inline$1._attribute)
|
|
1251
1266
|
.getRegex();
|
|
1252
1267
|
|
|
1253
|
-
inline._label = /(?:\[(?:\\.|[^\[\]\\])*\]|\\.|`[^`]*`|[^\[\]\\`])*?/;
|
|
1254
|
-
inline._href = /<(?:\\.|[^\n<>\\])+>|[^\s\x00-\x1f]*/;
|
|
1255
|
-
inline._title = /"(?:\\"?|[^"\\])*"|'(?:\\'?|[^'\\])*'|\((?:\\\)?|[^)\\])*\)/;
|
|
1268
|
+
inline$1._label = /(?:\[(?:\\.|[^\[\]\\])*\]|\\.|`[^`]*`|[^\[\]\\`])*?/;
|
|
1269
|
+
inline$1._href = /<(?:\\.|[^\n<>\\])+>|[^\s\x00-\x1f]*/;
|
|
1270
|
+
inline$1._title = /"(?:\\"?|[^"\\])*"|'(?:\\'?|[^'\\])*'|\((?:\\\)?|[^)\\])*\)/;
|
|
1256
1271
|
|
|
1257
|
-
inline.link = edit$1
|
|
1258
|
-
.replace('label', inline._label)
|
|
1259
|
-
.replace('href', inline._href)
|
|
1260
|
-
.replace('title', inline._title)
|
|
1272
|
+
inline$1.link = edit(inline$1.link)
|
|
1273
|
+
.replace('label', inline$1._label)
|
|
1274
|
+
.replace('href', inline$1._href)
|
|
1275
|
+
.replace('title', inline$1._title)
|
|
1261
1276
|
.getRegex();
|
|
1262
1277
|
|
|
1263
|
-
inline.reflink = edit$1
|
|
1264
|
-
.replace('label', inline._label)
|
|
1278
|
+
inline$1.reflink = edit(inline$1.reflink)
|
|
1279
|
+
.replace('label', inline$1._label)
|
|
1265
1280
|
.getRegex();
|
|
1266
1281
|
|
|
1267
|
-
inline.reflinkSearch = edit$1
|
|
1268
|
-
.replace('reflink', inline.reflink)
|
|
1269
|
-
.replace('nolink', inline.nolink)
|
|
1282
|
+
inline$1.reflinkSearch = edit(inline$1.reflinkSearch, 'g')
|
|
1283
|
+
.replace('reflink', inline$1.reflink)
|
|
1284
|
+
.replace('nolink', inline$1.nolink)
|
|
1270
1285
|
.getRegex();
|
|
1271
1286
|
|
|
1272
1287
|
/**
|
|
1273
1288
|
* Normal Inline Grammar
|
|
1274
1289
|
*/
|
|
1275
1290
|
|
|
1276
|
-
inline.normal = merge$1({}, inline);
|
|
1291
|
+
inline$1.normal = merge$1({}, inline$1);
|
|
1277
1292
|
|
|
1278
1293
|
/**
|
|
1279
1294
|
* Pedantic Inline Grammar
|
|
1280
1295
|
*/
|
|
1281
1296
|
|
|
1282
|
-
inline.pedantic = merge$1({}, inline.normal, {
|
|
1297
|
+
inline$1.pedantic = merge$1({}, inline$1.normal, {
|
|
1283
1298
|
strong: {
|
|
1284
1299
|
start: /^__|\*\*/,
|
|
1285
1300
|
middle: /^__(?=\S)([\s\S]*?\S)__(?!_)|^\*\*(?=\S)([\s\S]*?\S)\*\*(?!\*)/,
|
|
@@ -1292,11 +1307,11 @@ inline.pedantic = merge$1({}, inline.normal, {
|
|
|
1292
1307
|
endAst: /\*(?!\*)/g,
|
|
1293
1308
|
endUnd: /_(?!_)/g
|
|
1294
1309
|
},
|
|
1295
|
-
link: edit
|
|
1296
|
-
.replace('label', inline._label)
|
|
1310
|
+
link: edit(/^!?\[(label)\]\((.*?)\)/)
|
|
1311
|
+
.replace('label', inline$1._label)
|
|
1297
1312
|
.getRegex(),
|
|
1298
|
-
reflink: edit
|
|
1299
|
-
.replace('label', inline._label)
|
|
1313
|
+
reflink: edit(/^!?\[(label)\]\s*\[([^\]]*)\]/)
|
|
1314
|
+
.replace('label', inline$1._label)
|
|
1300
1315
|
.getRegex()
|
|
1301
1316
|
});
|
|
1302
1317
|
|
|
@@ -1304,8 +1319,8 @@ inline.pedantic = merge$1({}, inline.normal, {
|
|
|
1304
1319
|
* GFM Inline Grammar
|
|
1305
1320
|
*/
|
|
1306
1321
|
|
|
1307
|
-
inline.gfm = merge$1({}, inline.normal, {
|
|
1308
|
-
escape: edit$1
|
|
1322
|
+
inline$1.gfm = merge$1({}, inline$1.normal, {
|
|
1323
|
+
escape: edit(inline$1.escape).replace('])', '~|])').getRegex(),
|
|
1309
1324
|
_extended_email: /[A-Za-z0-9._+-]+(@)[a-zA-Z0-9-_]+(?:\.[a-zA-Z0-9-_]*[a-zA-Z0-9])+(?![-_])/,
|
|
1310
1325
|
url: /^((?:ftp|https?):\/\/|www\.)(?:[a-zA-Z0-9\-]+\.?)+[^\s<]*|^email/,
|
|
1311
1326
|
_backpedal: /(?:[^?!.,:;*_~()&]+|\([^)]*\)|&(?![a-zA-Z0-9]+;$)|[?!.,:;*_~)]+(?!$))+/,
|
|
@@ -1313,29 +1328,30 @@ inline.gfm = merge$1({}, inline.normal, {
|
|
|
1313
1328
|
text: /^([`~]+|[^`~])(?:(?= {2,}\n)|[\s\S]*?(?:(?=[\\<!\[`*~_]|\b_|https?:\/\/|ftp:\/\/|www\.|$)|[^ ](?= {2,}\n)|[^a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-](?=[a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-]+@))|(?=[a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-]+@))/
|
|
1314
1329
|
});
|
|
1315
1330
|
|
|
1316
|
-
inline.gfm.url = edit$1
|
|
1317
|
-
.replace('email', inline.gfm._extended_email)
|
|
1331
|
+
inline$1.gfm.url = edit(inline$1.gfm.url, 'i')
|
|
1332
|
+
.replace('email', inline$1.gfm._extended_email)
|
|
1318
1333
|
.getRegex();
|
|
1319
1334
|
/**
|
|
1320
1335
|
* GFM + Line Breaks Inline Grammar
|
|
1321
1336
|
*/
|
|
1322
1337
|
|
|
1323
|
-
inline.breaks = merge$1({}, inline.gfm, {
|
|
1324
|
-
br: edit$1
|
|
1325
|
-
text: edit$1
|
|
1338
|
+
inline$1.breaks = merge$1({}, inline$1.gfm, {
|
|
1339
|
+
br: edit(inline$1.br).replace('{2,}', '*').getRegex(),
|
|
1340
|
+
text: edit(inline$1.gfm.text)
|
|
1326
1341
|
.replace('\\b_', '\\b_| {2,}\\n')
|
|
1327
1342
|
.replace(/\{2,\}/g, '*')
|
|
1328
1343
|
.getRegex()
|
|
1329
1344
|
});
|
|
1330
1345
|
|
|
1331
1346
|
var rules = {
|
|
1332
|
-
block,
|
|
1333
|
-
inline
|
|
1347
|
+
block: block$1,
|
|
1348
|
+
inline: inline$1
|
|
1334
1349
|
};
|
|
1335
1350
|
|
|
1336
|
-
const
|
|
1337
|
-
const {
|
|
1338
|
-
const {
|
|
1351
|
+
const Tokenizer$1 = Tokenizer_1;
|
|
1352
|
+
const { defaults: defaults$3 } = defaults$5.exports;
|
|
1353
|
+
const { block, inline } = rules;
|
|
1354
|
+
const { repeatString } = helpers;
|
|
1339
1355
|
|
|
1340
1356
|
/**
|
|
1341
1357
|
* smartypants text replacement
|
|
@@ -1385,25 +1401,25 @@ var Lexer_1 = class Lexer {
|
|
|
1385
1401
|
constructor(options) {
|
|
1386
1402
|
this.tokens = [];
|
|
1387
1403
|
this.tokens.links = Object.create(null);
|
|
1388
|
-
this.options = options || defaults$
|
|
1389
|
-
this.options.tokenizer = this.options.tokenizer || new
|
|
1404
|
+
this.options = options || defaults$3;
|
|
1405
|
+
this.options.tokenizer = this.options.tokenizer || new Tokenizer$1();
|
|
1390
1406
|
this.tokenizer = this.options.tokenizer;
|
|
1391
1407
|
this.tokenizer.options = this.options;
|
|
1392
1408
|
|
|
1393
1409
|
const rules = {
|
|
1394
|
-
block: block
|
|
1395
|
-
inline: inline
|
|
1410
|
+
block: block.normal,
|
|
1411
|
+
inline: inline.normal
|
|
1396
1412
|
};
|
|
1397
1413
|
|
|
1398
1414
|
if (this.options.pedantic) {
|
|
1399
|
-
rules.block = block
|
|
1400
|
-
rules.inline = inline
|
|
1415
|
+
rules.block = block.pedantic;
|
|
1416
|
+
rules.inline = inline.pedantic;
|
|
1401
1417
|
} else if (this.options.gfm) {
|
|
1402
|
-
rules.block = block
|
|
1418
|
+
rules.block = block.gfm;
|
|
1403
1419
|
if (this.options.breaks) {
|
|
1404
|
-
rules.inline = inline
|
|
1420
|
+
rules.inline = inline.breaks;
|
|
1405
1421
|
} else {
|
|
1406
|
-
rules.inline = inline
|
|
1422
|
+
rules.inline = inline.gfm;
|
|
1407
1423
|
}
|
|
1408
1424
|
}
|
|
1409
1425
|
this.tokenizer.rules = rules;
|
|
@@ -1414,8 +1430,8 @@ var Lexer_1 = class Lexer {
|
|
|
1414
1430
|
*/
|
|
1415
1431
|
static get rules() {
|
|
1416
1432
|
return {
|
|
1417
|
-
block
|
|
1418
|
-
inline
|
|
1433
|
+
block,
|
|
1434
|
+
inline
|
|
1419
1435
|
};
|
|
1420
1436
|
}
|
|
1421
1437
|
|
|
@@ -1676,14 +1692,14 @@ var Lexer_1 = class Lexer {
|
|
|
1676
1692
|
if (links.length > 0) {
|
|
1677
1693
|
while ((match = this.tokenizer.rules.inline.reflinkSearch.exec(maskedSrc)) != null) {
|
|
1678
1694
|
if (links.includes(match[0].slice(match[0].lastIndexOf('[') + 1, -1))) {
|
|
1679
|
-
maskedSrc = maskedSrc.slice(0, match.index) + '[' + repeatString
|
|
1695
|
+
maskedSrc = maskedSrc.slice(0, match.index) + '[' + repeatString('a', match[0].length - 2) + ']' + maskedSrc.slice(this.tokenizer.rules.inline.reflinkSearch.lastIndex);
|
|
1680
1696
|
}
|
|
1681
1697
|
}
|
|
1682
1698
|
}
|
|
1683
1699
|
}
|
|
1684
1700
|
// Mask out other blocks
|
|
1685
1701
|
while ((match = this.tokenizer.rules.inline.blockSkip.exec(maskedSrc)) != null) {
|
|
1686
|
-
maskedSrc = maskedSrc.slice(0, match.index) + '[' + repeatString
|
|
1702
|
+
maskedSrc = maskedSrc.slice(0, match.index) + '[' + repeatString('a', match[0].length - 2) + ']' + maskedSrc.slice(this.tokenizer.rules.inline.blockSkip.lastIndex);
|
|
1687
1703
|
}
|
|
1688
1704
|
|
|
1689
1705
|
// Mask out escaped em & strong delimiters
|
|
@@ -1821,10 +1837,10 @@ var Lexer_1 = class Lexer {
|
|
|
1821
1837
|
}
|
|
1822
1838
|
};
|
|
1823
1839
|
|
|
1824
|
-
const { defaults: defaults$
|
|
1840
|
+
const { defaults: defaults$2 } = defaults$5.exports;
|
|
1825
1841
|
const {
|
|
1826
|
-
cleanUrl
|
|
1827
|
-
escape: escape$
|
|
1842
|
+
cleanUrl,
|
|
1843
|
+
escape: escape$1
|
|
1828
1844
|
} = helpers;
|
|
1829
1845
|
|
|
1830
1846
|
/**
|
|
@@ -1832,7 +1848,7 @@ const {
|
|
|
1832
1848
|
*/
|
|
1833
1849
|
var Renderer_1 = class Renderer {
|
|
1834
1850
|
constructor(options) {
|
|
1835
|
-
this.options = options || defaults$
|
|
1851
|
+
this.options = options || defaults$2;
|
|
1836
1852
|
}
|
|
1837
1853
|
|
|
1838
1854
|
code(code, infostring, escaped) {
|
|
@@ -1849,15 +1865,15 @@ var Renderer_1 = class Renderer {
|
|
|
1849
1865
|
|
|
1850
1866
|
if (!lang) {
|
|
1851
1867
|
return '<pre><code>'
|
|
1852
|
-
+ (escaped ? code : escape$
|
|
1868
|
+
+ (escaped ? code : escape$1(code, true))
|
|
1853
1869
|
+ '</code></pre>\n';
|
|
1854
1870
|
}
|
|
1855
1871
|
|
|
1856
1872
|
return '<pre><code class="'
|
|
1857
1873
|
+ this.options.langPrefix
|
|
1858
|
-
+ escape$
|
|
1874
|
+
+ escape$1(lang, true)
|
|
1859
1875
|
+ '">'
|
|
1860
|
-
+ (escaped ? code : escape$
|
|
1876
|
+
+ (escaped ? code : escape$1(code, true))
|
|
1861
1877
|
+ '</code></pre>\n';
|
|
1862
1878
|
}
|
|
1863
1879
|
|
|
@@ -1957,11 +1973,11 @@ var Renderer_1 = class Renderer {
|
|
|
1957
1973
|
}
|
|
1958
1974
|
|
|
1959
1975
|
link(href, title, text) {
|
|
1960
|
-
href = cleanUrl
|
|
1976
|
+
href = cleanUrl(this.options.sanitize, this.options.baseUrl, href);
|
|
1961
1977
|
if (href === null) {
|
|
1962
1978
|
return text;
|
|
1963
1979
|
}
|
|
1964
|
-
let out = '<a href="' + escape$
|
|
1980
|
+
let out = '<a href="' + escape$1(href) + '"';
|
|
1965
1981
|
if (title) {
|
|
1966
1982
|
out += ' title="' + title + '"';
|
|
1967
1983
|
}
|
|
@@ -1970,7 +1986,7 @@ var Renderer_1 = class Renderer {
|
|
|
1970
1986
|
}
|
|
1971
1987
|
|
|
1972
1988
|
image(href, title, text) {
|
|
1973
|
-
href = cleanUrl
|
|
1989
|
+
href = cleanUrl(this.options.sanitize, this.options.baseUrl, href);
|
|
1974
1990
|
if (href === null) {
|
|
1975
1991
|
return text;
|
|
1976
1992
|
}
|
|
@@ -1992,6 +2008,7 @@ var Renderer_1 = class Renderer {
|
|
|
1992
2008
|
* TextRenderer
|
|
1993
2009
|
* returns only the textual part of the token
|
|
1994
2010
|
*/
|
|
2011
|
+
|
|
1995
2012
|
var TextRenderer_1 = class TextRenderer {
|
|
1996
2013
|
// no need for block level renderers
|
|
1997
2014
|
strong(text) {
|
|
@@ -2034,6 +2051,7 @@ var TextRenderer_1 = class TextRenderer {
|
|
|
2034
2051
|
/**
|
|
2035
2052
|
* Slugger generates header id
|
|
2036
2053
|
*/
|
|
2054
|
+
|
|
2037
2055
|
var Slugger_1 = class Slugger {
|
|
2038
2056
|
constructor() {
|
|
2039
2057
|
this.seen = {};
|
|
@@ -2081,9 +2099,12 @@ var Slugger_1 = class Slugger {
|
|
|
2081
2099
|
}
|
|
2082
2100
|
};
|
|
2083
2101
|
|
|
2084
|
-
const
|
|
2102
|
+
const Renderer$1 = Renderer_1;
|
|
2103
|
+
const TextRenderer$1 = TextRenderer_1;
|
|
2104
|
+
const Slugger$1 = Slugger_1;
|
|
2105
|
+
const { defaults: defaults$1 } = defaults$5.exports;
|
|
2085
2106
|
const {
|
|
2086
|
-
unescape
|
|
2107
|
+
unescape
|
|
2087
2108
|
} = helpers;
|
|
2088
2109
|
|
|
2089
2110
|
/**
|
|
@@ -2091,12 +2112,12 @@ const {
|
|
|
2091
2112
|
*/
|
|
2092
2113
|
var Parser_1 = class Parser {
|
|
2093
2114
|
constructor(options) {
|
|
2094
|
-
this.options = options || defaults$
|
|
2095
|
-
this.options.renderer = this.options.renderer || new
|
|
2115
|
+
this.options = options || defaults$1;
|
|
2116
|
+
this.options.renderer = this.options.renderer || new Renderer$1();
|
|
2096
2117
|
this.renderer = this.options.renderer;
|
|
2097
2118
|
this.renderer.options = this.options;
|
|
2098
|
-
this.textRenderer = new
|
|
2099
|
-
this.slugger = new
|
|
2119
|
+
this.textRenderer = new TextRenderer$1();
|
|
2120
|
+
this.slugger = new Slugger$1();
|
|
2100
2121
|
}
|
|
2101
2122
|
|
|
2102
2123
|
/**
|
|
@@ -2154,7 +2175,7 @@ var Parser_1 = class Parser {
|
|
|
2154
2175
|
out += this.renderer.heading(
|
|
2155
2176
|
this.parseInline(token.tokens),
|
|
2156
2177
|
token.depth,
|
|
2157
|
-
unescape
|
|
2178
|
+
unescape(this.parseInline(token.tokens, this.textRenderer)),
|
|
2158
2179
|
this.slugger);
|
|
2159
2180
|
continue;
|
|
2160
2181
|
}
|
|
@@ -2342,16 +2363,22 @@ var Parser_1 = class Parser {
|
|
|
2342
2363
|
}
|
|
2343
2364
|
};
|
|
2344
2365
|
|
|
2366
|
+
const Lexer = Lexer_1;
|
|
2367
|
+
const Parser = Parser_1;
|
|
2368
|
+
const Tokenizer = Tokenizer_1;
|
|
2369
|
+
const Renderer = Renderer_1;
|
|
2370
|
+
const TextRenderer = TextRenderer_1;
|
|
2371
|
+
const Slugger = Slugger_1;
|
|
2345
2372
|
const {
|
|
2346
|
-
merge
|
|
2347
|
-
checkSanitizeDeprecation
|
|
2348
|
-
escape
|
|
2373
|
+
merge,
|
|
2374
|
+
checkSanitizeDeprecation,
|
|
2375
|
+
escape
|
|
2349
2376
|
} = helpers;
|
|
2350
2377
|
const {
|
|
2351
2378
|
getDefaults,
|
|
2352
2379
|
changeDefaults,
|
|
2353
|
-
defaults
|
|
2354
|
-
} = defaults;
|
|
2380
|
+
defaults
|
|
2381
|
+
} = defaults$5.exports;
|
|
2355
2382
|
|
|
2356
2383
|
/**
|
|
2357
2384
|
* Marked
|
|
@@ -2371,15 +2398,15 @@ function marked(src, opt, callback) {
|
|
|
2371
2398
|
opt = null;
|
|
2372
2399
|
}
|
|
2373
2400
|
|
|
2374
|
-
opt = merge
|
|
2375
|
-
checkSanitizeDeprecation
|
|
2401
|
+
opt = merge({}, marked.defaults, opt || {});
|
|
2402
|
+
checkSanitizeDeprecation(opt);
|
|
2376
2403
|
|
|
2377
2404
|
if (callback) {
|
|
2378
2405
|
const highlight = opt.highlight;
|
|
2379
2406
|
let tokens;
|
|
2380
2407
|
|
|
2381
2408
|
try {
|
|
2382
|
-
tokens =
|
|
2409
|
+
tokens = Lexer.lex(src, opt);
|
|
2383
2410
|
} catch (e) {
|
|
2384
2411
|
return callback(e);
|
|
2385
2412
|
}
|
|
@@ -2389,7 +2416,7 @@ function marked(src, opt, callback) {
|
|
|
2389
2416
|
|
|
2390
2417
|
if (!err) {
|
|
2391
2418
|
try {
|
|
2392
|
-
out =
|
|
2419
|
+
out = Parser.parse(tokens, opt);
|
|
2393
2420
|
} catch (e) {
|
|
2394
2421
|
err = e;
|
|
2395
2422
|
}
|
|
@@ -2441,16 +2468,16 @@ function marked(src, opt, callback) {
|
|
|
2441
2468
|
}
|
|
2442
2469
|
|
|
2443
2470
|
try {
|
|
2444
|
-
const tokens =
|
|
2471
|
+
const tokens = Lexer.lex(src, opt);
|
|
2445
2472
|
if (opt.walkTokens) {
|
|
2446
2473
|
marked.walkTokens(tokens, opt.walkTokens);
|
|
2447
2474
|
}
|
|
2448
|
-
return
|
|
2475
|
+
return Parser.parse(tokens, opt);
|
|
2449
2476
|
} catch (e) {
|
|
2450
2477
|
e.message += '\nPlease report this to https://github.com/markedjs/marked.';
|
|
2451
2478
|
if (opt.silent) {
|
|
2452
2479
|
return '<p>An error occurred:</p><pre>'
|
|
2453
|
-
+ escape
|
|
2480
|
+
+ escape(e.message + '', true)
|
|
2454
2481
|
+ '</pre>';
|
|
2455
2482
|
}
|
|
2456
2483
|
throw e;
|
|
@@ -2463,23 +2490,23 @@ function marked(src, opt, callback) {
|
|
|
2463
2490
|
|
|
2464
2491
|
marked.options =
|
|
2465
2492
|
marked.setOptions = function(opt) {
|
|
2466
|
-
merge
|
|
2493
|
+
merge(marked.defaults, opt);
|
|
2467
2494
|
changeDefaults(marked.defaults);
|
|
2468
2495
|
return marked;
|
|
2469
2496
|
};
|
|
2470
2497
|
|
|
2471
2498
|
marked.getDefaults = getDefaults;
|
|
2472
2499
|
|
|
2473
|
-
marked.defaults = defaults
|
|
2500
|
+
marked.defaults = defaults;
|
|
2474
2501
|
|
|
2475
2502
|
/**
|
|
2476
2503
|
* Use Extension
|
|
2477
2504
|
*/
|
|
2478
2505
|
|
|
2479
2506
|
marked.use = function(extension) {
|
|
2480
|
-
const opts = merge
|
|
2507
|
+
const opts = merge({}, extension);
|
|
2481
2508
|
if (extension.renderer) {
|
|
2482
|
-
const renderer = marked.defaults.renderer || new
|
|
2509
|
+
const renderer = marked.defaults.renderer || new Renderer();
|
|
2483
2510
|
for (const prop in extension.renderer) {
|
|
2484
2511
|
const prevRenderer = renderer[prop];
|
|
2485
2512
|
renderer[prop] = (...args) => {
|
|
@@ -2493,7 +2520,7 @@ marked.use = function(extension) {
|
|
|
2493
2520
|
opts.renderer = renderer;
|
|
2494
2521
|
}
|
|
2495
2522
|
if (extension.tokenizer) {
|
|
2496
|
-
const tokenizer = marked.defaults.tokenizer || new
|
|
2523
|
+
const tokenizer = marked.defaults.tokenizer || new Tokenizer();
|
|
2497
2524
|
for (const prop in extension.tokenizer) {
|
|
2498
2525
|
const prevTokenizer = tokenizer[prop];
|
|
2499
2526
|
tokenizer[prop] = (...args) => {
|
|
@@ -2563,20 +2590,20 @@ marked.parseInline = function(src, opt) {
|
|
|
2563
2590
|
+ Object.prototype.toString.call(src) + ', string expected');
|
|
2564
2591
|
}
|
|
2565
2592
|
|
|
2566
|
-
opt = merge
|
|
2567
|
-
checkSanitizeDeprecation
|
|
2593
|
+
opt = merge({}, marked.defaults, opt || {});
|
|
2594
|
+
checkSanitizeDeprecation(opt);
|
|
2568
2595
|
|
|
2569
2596
|
try {
|
|
2570
|
-
const tokens =
|
|
2597
|
+
const tokens = Lexer.lexInline(src, opt);
|
|
2571
2598
|
if (opt.walkTokens) {
|
|
2572
2599
|
marked.walkTokens(tokens, opt.walkTokens);
|
|
2573
2600
|
}
|
|
2574
|
-
return
|
|
2601
|
+
return Parser.parseInline(tokens, opt);
|
|
2575
2602
|
} catch (e) {
|
|
2576
2603
|
e.message += '\nPlease report this to https://github.com/markedjs/marked.';
|
|
2577
2604
|
if (opt.silent) {
|
|
2578
2605
|
return '<p>An error occurred:</p><pre>'
|
|
2579
|
-
+ escape
|
|
2606
|
+
+ escape(e.message + '', true)
|
|
2580
2607
|
+ '</pre>';
|
|
2581
2608
|
}
|
|
2582
2609
|
throw e;
|
|
@@ -2587,18 +2614,18 @@ marked.parseInline = function(src, opt) {
|
|
|
2587
2614
|
* Expose
|
|
2588
2615
|
*/
|
|
2589
2616
|
|
|
2590
|
-
marked.Parser =
|
|
2591
|
-
marked.parser =
|
|
2617
|
+
marked.Parser = Parser;
|
|
2618
|
+
marked.parser = Parser.parse;
|
|
2592
2619
|
|
|
2593
|
-
marked.Renderer =
|
|
2594
|
-
marked.TextRenderer =
|
|
2620
|
+
marked.Renderer = Renderer;
|
|
2621
|
+
marked.TextRenderer = TextRenderer;
|
|
2595
2622
|
|
|
2596
|
-
marked.Lexer =
|
|
2597
|
-
marked.lexer =
|
|
2623
|
+
marked.Lexer = Lexer;
|
|
2624
|
+
marked.lexer = Lexer.lex;
|
|
2598
2625
|
|
|
2599
|
-
marked.Tokenizer =
|
|
2626
|
+
marked.Tokenizer = Tokenizer;
|
|
2600
2627
|
|
|
2601
|
-
marked.Slugger =
|
|
2628
|
+
marked.Slugger = Slugger;
|
|
2602
2629
|
|
|
2603
2630
|
marked.parse = marked;
|
|
2604
2631
|
|