marked 2.0.1 → 2.0.5
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 +237 -225
- package/lib/marked.js +230 -222
- package/marked.min.js +1 -1
- package/package.json +17 -17
- package/src/Tokenizer.js +1 -0
- package/src/marked.js +3 -0
- package/src/rules.js +3 -3
package/lib/marked.js
CHANGED
|
@@ -49,69 +49,60 @@
|
|
|
49
49
|
}
|
|
50
50
|
|
|
51
51
|
function _createForOfIteratorHelperLoose(o, allowArrayLike) {
|
|
52
|
-
var it;
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
};
|
|
62
|
-
return {
|
|
63
|
-
done: false,
|
|
64
|
-
value: o[i++]
|
|
65
|
-
};
|
|
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
|
|
66
61
|
};
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
62
|
+
return {
|
|
63
|
+
done: false,
|
|
64
|
+
value: o[i++]
|
|
65
|
+
};
|
|
66
|
+
};
|
|
70
67
|
}
|
|
71
68
|
|
|
72
|
-
|
|
73
|
-
return it.next.bind(it);
|
|
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.");
|
|
74
70
|
}
|
|
75
71
|
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
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
|
+
};
|
|
79
95
|
}
|
|
80
96
|
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
baseUrl: null,
|
|
85
|
-
breaks: false,
|
|
86
|
-
gfm: true,
|
|
87
|
-
headerIds: true,
|
|
88
|
-
headerPrefix: '',
|
|
89
|
-
highlight: null,
|
|
90
|
-
langPrefix: 'language-',
|
|
91
|
-
mangle: true,
|
|
92
|
-
pedantic: false,
|
|
93
|
-
renderer: null,
|
|
94
|
-
sanitize: false,
|
|
95
|
-
sanitizer: null,
|
|
96
|
-
silent: false,
|
|
97
|
-
smartLists: false,
|
|
98
|
-
smartypants: false,
|
|
99
|
-
tokenizer: null,
|
|
100
|
-
walkTokens: null,
|
|
101
|
-
xhtml: false
|
|
102
|
-
};
|
|
103
|
-
}
|
|
104
|
-
|
|
105
|
-
function changeDefaults(newDefaults) {
|
|
106
|
-
module.exports.defaults = newDefaults;
|
|
107
|
-
}
|
|
97
|
+
function changeDefaults$1(newDefaults) {
|
|
98
|
+
defaults$5.exports.defaults = newDefaults;
|
|
99
|
+
}
|
|
108
100
|
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
});
|
|
101
|
+
defaults$5.exports = {
|
|
102
|
+
defaults: getDefaults$1(),
|
|
103
|
+
getDefaults: getDefaults$1,
|
|
104
|
+
changeDefaults: changeDefaults$1
|
|
105
|
+
};
|
|
115
106
|
|
|
116
107
|
/**
|
|
117
108
|
* Helpers
|
|
@@ -132,7 +123,7 @@
|
|
|
132
123
|
return escapeReplacements[ch];
|
|
133
124
|
};
|
|
134
125
|
|
|
135
|
-
function escape(html, encode) {
|
|
126
|
+
function escape$2(html, encode) {
|
|
136
127
|
if (encode) {
|
|
137
128
|
if (escapeTest.test(html)) {
|
|
138
129
|
return html.replace(escapeReplace, getEscapeReplacement);
|
|
@@ -148,7 +139,7 @@
|
|
|
148
139
|
|
|
149
140
|
var unescapeTest = /&(#(?:\d+)|(?:#x[0-9A-Fa-f]+)|(?:\w+));?/ig;
|
|
150
141
|
|
|
151
|
-
function unescape(html) {
|
|
142
|
+
function unescape$1(html) {
|
|
152
143
|
// explicitly match decimal, hex, and named HTML entities
|
|
153
144
|
return html.replace(unescapeTest, function (_, n) {
|
|
154
145
|
n = n.toLowerCase();
|
|
@@ -164,7 +155,7 @@
|
|
|
164
155
|
|
|
165
156
|
var caret = /(^|[^\[])\^/g;
|
|
166
157
|
|
|
167
|
-
function edit(regex, opt) {
|
|
158
|
+
function edit$1(regex, opt) {
|
|
168
159
|
regex = regex.source || regex;
|
|
169
160
|
opt = opt || '';
|
|
170
161
|
var obj = {
|
|
@@ -184,12 +175,12 @@
|
|
|
184
175
|
var nonWordAndColonTest = /[^\w:]/g;
|
|
185
176
|
var originIndependentUrl = /^$|^[a-z][a-z0-9+.-]*:|^[?#]/i;
|
|
186
177
|
|
|
187
|
-
function cleanUrl(sanitize, base, href) {
|
|
178
|
+
function cleanUrl$1(sanitize, base, href) {
|
|
188
179
|
if (sanitize) {
|
|
189
180
|
var prot;
|
|
190
181
|
|
|
191
182
|
try {
|
|
192
|
-
prot = decodeURIComponent(unescape(href)).replace(nonWordAndColonTest, '').toLowerCase();
|
|
183
|
+
prot = decodeURIComponent(unescape$1(href)).replace(nonWordAndColonTest, '').toLowerCase();
|
|
193
184
|
} catch (e) {
|
|
194
185
|
return null;
|
|
195
186
|
}
|
|
@@ -225,7 +216,7 @@
|
|
|
225
216
|
if (justDomain.test(base)) {
|
|
226
217
|
baseUrls[' ' + base] = base + '/';
|
|
227
218
|
} else {
|
|
228
|
-
baseUrls[' ' + base] = rtrim(base, '/', true);
|
|
219
|
+
baseUrls[' ' + base] = rtrim$1(base, '/', true);
|
|
229
220
|
}
|
|
230
221
|
}
|
|
231
222
|
|
|
@@ -249,11 +240,11 @@
|
|
|
249
240
|
}
|
|
250
241
|
}
|
|
251
242
|
|
|
252
|
-
var noopTest = {
|
|
243
|
+
var noopTest$1 = {
|
|
253
244
|
exec: function noopTest() {}
|
|
254
245
|
};
|
|
255
246
|
|
|
256
|
-
function merge(obj) {
|
|
247
|
+
function merge$2(obj) {
|
|
257
248
|
var i = 1,
|
|
258
249
|
target,
|
|
259
250
|
key;
|
|
@@ -271,7 +262,7 @@
|
|
|
271
262
|
return obj;
|
|
272
263
|
}
|
|
273
264
|
|
|
274
|
-
function splitCells(tableRow, count) {
|
|
265
|
+
function splitCells$1(tableRow, count) {
|
|
275
266
|
// ensure that every cell-delimiting pipe has a space
|
|
276
267
|
// before it to distinguish it from an escaped pipe
|
|
277
268
|
var row = tableRow.replace(/\|/g, function (match, offset, str) {
|
|
@@ -313,7 +304,7 @@
|
|
|
313
304
|
// invert: Remove suffix of non-c chars instead. Default falsey.
|
|
314
305
|
|
|
315
306
|
|
|
316
|
-
function rtrim(str, c, invert) {
|
|
307
|
+
function rtrim$1(str, c, invert) {
|
|
317
308
|
var l = str.length;
|
|
318
309
|
|
|
319
310
|
if (l === 0) {
|
|
@@ -338,7 +329,7 @@
|
|
|
338
329
|
return str.substr(0, l - suffLen);
|
|
339
330
|
}
|
|
340
331
|
|
|
341
|
-
function findClosingBracket(str, b) {
|
|
332
|
+
function findClosingBracket$1(str, b) {
|
|
342
333
|
if (str.indexOf(b[1]) === -1) {
|
|
343
334
|
return -1;
|
|
344
335
|
}
|
|
@@ -364,14 +355,14 @@
|
|
|
364
355
|
return -1;
|
|
365
356
|
}
|
|
366
357
|
|
|
367
|
-
function checkSanitizeDeprecation(opt) {
|
|
358
|
+
function checkSanitizeDeprecation$1(opt) {
|
|
368
359
|
if (opt && opt.sanitize && !opt.silent) {
|
|
369
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');
|
|
370
361
|
}
|
|
371
362
|
} // copied from https://stackoverflow.com/a/5450113/806777
|
|
372
363
|
|
|
373
364
|
|
|
374
|
-
function repeatString(pattern, count) {
|
|
365
|
+
function repeatString$1(pattern, count) {
|
|
375
366
|
if (count < 1) {
|
|
376
367
|
return '';
|
|
377
368
|
}
|
|
@@ -391,25 +382,25 @@
|
|
|
391
382
|
}
|
|
392
383
|
|
|
393
384
|
var helpers = {
|
|
394
|
-
escape: escape,
|
|
395
|
-
unescape: unescape,
|
|
396
|
-
edit: edit,
|
|
397
|
-
cleanUrl: cleanUrl,
|
|
385
|
+
escape: escape$2,
|
|
386
|
+
unescape: unescape$1,
|
|
387
|
+
edit: edit$1,
|
|
388
|
+
cleanUrl: cleanUrl$1,
|
|
398
389
|
resolveUrl: resolveUrl,
|
|
399
|
-
noopTest: noopTest,
|
|
400
|
-
merge: merge,
|
|
401
|
-
splitCells: splitCells,
|
|
402
|
-
rtrim: rtrim,
|
|
403
|
-
findClosingBracket: findClosingBracket,
|
|
404
|
-
checkSanitizeDeprecation: checkSanitizeDeprecation,
|
|
405
|
-
repeatString: repeatString
|
|
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
|
|
406
397
|
};
|
|
407
398
|
|
|
408
|
-
var defaults$
|
|
409
|
-
var rtrim
|
|
410
|
-
splitCells
|
|
399
|
+
var defaults$4 = defaults$5.exports.defaults;
|
|
400
|
+
var rtrim = helpers.rtrim,
|
|
401
|
+
splitCells = helpers.splitCells,
|
|
411
402
|
_escape = helpers.escape,
|
|
412
|
-
findClosingBracket
|
|
403
|
+
findClosingBracket = helpers.findClosingBracket;
|
|
413
404
|
|
|
414
405
|
function outputLink(cap, link, raw) {
|
|
415
406
|
var href = link.href;
|
|
@@ -466,7 +457,7 @@
|
|
|
466
457
|
|
|
467
458
|
var Tokenizer_1 = /*#__PURE__*/function () {
|
|
468
459
|
function Tokenizer(options) {
|
|
469
|
-
this.options = options || defaults$
|
|
460
|
+
this.options = options || defaults$4;
|
|
470
461
|
}
|
|
471
462
|
|
|
472
463
|
var _proto = Tokenizer.prototype;
|
|
@@ -497,7 +488,7 @@
|
|
|
497
488
|
type: 'code',
|
|
498
489
|
raw: cap[0],
|
|
499
490
|
codeBlockStyle: 'indented',
|
|
500
|
-
text: !this.options.pedantic ? rtrim
|
|
491
|
+
text: !this.options.pedantic ? rtrim(text, '\n') : text
|
|
501
492
|
};
|
|
502
493
|
}
|
|
503
494
|
};
|
|
@@ -524,7 +515,7 @@
|
|
|
524
515
|
var text = cap[2].trim(); // remove trailing #s
|
|
525
516
|
|
|
526
517
|
if (/#$/.test(text)) {
|
|
527
|
-
var trimmed = rtrim
|
|
518
|
+
var trimmed = rtrim(text, '#');
|
|
528
519
|
|
|
529
520
|
if (this.options.pedantic) {
|
|
530
521
|
text = trimmed.trim();
|
|
@@ -549,7 +540,7 @@
|
|
|
549
540
|
if (cap) {
|
|
550
541
|
var item = {
|
|
551
542
|
type: 'table',
|
|
552
|
-
header: splitCells
|
|
543
|
+
header: splitCells(cap[1].replace(/^ *| *\| *$/g, '')),
|
|
553
544
|
align: cap[2].replace(/^ *|\| *$/g, '').split(/ *\| */),
|
|
554
545
|
cells: cap[3] ? cap[3].replace(/\n$/, '').split('\n') : [],
|
|
555
546
|
raw: cap[0]
|
|
@@ -574,7 +565,7 @@
|
|
|
574
565
|
l = item.cells.length;
|
|
575
566
|
|
|
576
567
|
for (i = 0; i < l; i++) {
|
|
577
|
-
item.cells[i] = splitCells
|
|
568
|
+
item.cells[i] = splitCells(item.cells[i], item.header.length);
|
|
578
569
|
}
|
|
579
570
|
|
|
580
571
|
return item;
|
|
@@ -686,7 +677,7 @@
|
|
|
686
677
|
} // trim item newlines at end
|
|
687
678
|
|
|
688
679
|
|
|
689
|
-
item = rtrim
|
|
680
|
+
item = rtrim(item, '\n');
|
|
690
681
|
|
|
691
682
|
if (i !== l - 1) {
|
|
692
683
|
raw = raw + '\n';
|
|
@@ -751,6 +742,7 @@
|
|
|
751
742
|
if (cap[3]) cap[3] = cap[3].substring(1, cap[3].length - 1);
|
|
752
743
|
var tag = cap[1].toLowerCase().replace(/\s+/g, ' ');
|
|
753
744
|
return {
|
|
745
|
+
type: 'def',
|
|
754
746
|
tag: tag,
|
|
755
747
|
raw: cap[0],
|
|
756
748
|
href: cap[2],
|
|
@@ -765,7 +757,7 @@
|
|
|
765
757
|
if (cap) {
|
|
766
758
|
var item = {
|
|
767
759
|
type: 'table',
|
|
768
|
-
header: splitCells
|
|
760
|
+
header: splitCells(cap[1].replace(/^ *| *\| *$/g, '')),
|
|
769
761
|
align: cap[2].replace(/^ *|\| *$/g, '').split(/ *\| */),
|
|
770
762
|
cells: cap[3] ? cap[3].replace(/\n$/, '').split('\n') : []
|
|
771
763
|
};
|
|
@@ -790,7 +782,7 @@
|
|
|
790
782
|
l = item.cells.length;
|
|
791
783
|
|
|
792
784
|
for (i = 0; i < l; i++) {
|
|
793
|
-
item.cells[i] = splitCells
|
|
785
|
+
item.cells[i] = splitCells(item.cells[i].replace(/^ *\| *| *\| *$/g, ''), item.header.length);
|
|
794
786
|
}
|
|
795
787
|
|
|
796
788
|
return item;
|
|
@@ -886,14 +878,14 @@
|
|
|
886
878
|
} // ending angle bracket cannot be escaped
|
|
887
879
|
|
|
888
880
|
|
|
889
|
-
var rtrimSlash = rtrim
|
|
881
|
+
var rtrimSlash = rtrim(trimmedUrl.slice(0, -1), '\\');
|
|
890
882
|
|
|
891
883
|
if ((trimmedUrl.length - rtrimSlash.length) % 2 === 0) {
|
|
892
884
|
return;
|
|
893
885
|
}
|
|
894
886
|
} else {
|
|
895
887
|
// find closing parenthesis
|
|
896
|
-
var lastParenIndex = findClosingBracket
|
|
888
|
+
var lastParenIndex = findClosingBracket(cap[2], '()');
|
|
897
889
|
|
|
898
890
|
if (lastParenIndex > -1) {
|
|
899
891
|
var start = cap[0].indexOf('!') === 0 ? 5 : 4;
|
|
@@ -1159,14 +1151,14 @@
|
|
|
1159
1151
|
return Tokenizer;
|
|
1160
1152
|
}();
|
|
1161
1153
|
|
|
1162
|
-
var noopTest
|
|
1163
|
-
edit
|
|
1154
|
+
var noopTest = helpers.noopTest,
|
|
1155
|
+
edit = helpers.edit,
|
|
1164
1156
|
merge$1 = helpers.merge;
|
|
1165
1157
|
/**
|
|
1166
1158
|
* Block-Level Grammar
|
|
1167
1159
|
*/
|
|
1168
1160
|
|
|
1169
|
-
var block = {
|
|
1161
|
+
var block$1 = {
|
|
1170
1162
|
newline: /^(?: *(?:\n|$))+/,
|
|
1171
1163
|
code: /^( {4}[^\n]+(?:\n(?: *(?:\n|$))*)?)+/,
|
|
1172
1164
|
fences: /^ {0,3}(`{3,}(?=[^`\n]*\n)|~{3,})([^\n]*)\n(?:|([\s\S]*?)\n)(?: {0,3}\1[~`]* *(?:\n+|$)|$)/,
|
|
@@ -1180,45 +1172,45 @@
|
|
|
1180
1172
|
+ '|<\\?[\\s\\S]*?(?:\\?>\\n*|$)' // (3)
|
|
1181
1173
|
+ '|<![A-Z][\\s\\S]*?(?:>\\n*|$)' // (4)
|
|
1182
1174
|
+ '|<!\\[CDATA\\[[\\s\\S]*?(?:\\]\\]>\\n*|$)' // (5)
|
|
1183
|
-
+ '|</?(tag)(?: +|\\n|/?>)[\\s\\S]*?(?:\\n
|
|
1184
|
-
+ '|<(?!script|pre|style)([a-z][\\w-]*)(?:attribute)*? */?>(?=[ \\t]*(?:\\n|$))[\\s\\S]*?(?:\\n
|
|
1185
|
-
+ '|</(?!script|pre|style)[a-z][\\w-]*\\s*>(?=[ \\t]*(?:\\n|$))[\\s\\S]*?(?:\\n
|
|
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
|
|
1186
1178
|
+ ')',
|
|
1187
1179
|
def: /^ {0,3}\[(label)\]: *\n? *<?([^\s>]+)>?(?:(?: +\n? *| *\n *)(title))? *(?:\n+|$)/,
|
|
1188
|
-
nptable: noopTest
|
|
1189
|
-
table: noopTest
|
|
1180
|
+
nptable: noopTest,
|
|
1181
|
+
table: noopTest,
|
|
1190
1182
|
lheading: /^([^\n]+)\n {0,3}(=+|-+) *(?:\n+|$)/,
|
|
1191
1183
|
// regex template, placeholders will be replaced according to different paragraph
|
|
1192
1184
|
// interruption rules of commonmark and the original markdown spec:
|
|
1193
1185
|
_paragraph: /^([^\n]+(?:\n(?!hr|heading|lheading|blockquote|fences|list|html| +\n)[^\n]+)*)/,
|
|
1194
1186
|
text: /^[^\n]+/
|
|
1195
1187
|
};
|
|
1196
|
-
block._label = /(?!\s*\])(?:\\[\[\]]|[^\[\]])+/;
|
|
1197
|
-
block._title = /(?:"(?:\\"?|[^"\\])*"|'[^'\n]*(?:\n[^'\n]+)*\n?'|\([^()]*\))/;
|
|
1198
|
-
block.def = edit$1
|
|
1199
|
-
block.bullet = /(?:[*+-]|\d{1,9}[.)])/;
|
|
1200
|
-
block.item = /^( *)(bull) ?[^\n]*(?:\n(?! *bull ?)[^\n]*)*/;
|
|
1201
|
-
block.item = edit$1
|
|
1202
|
-
block.listItemStart = edit
|
|
1203
|
-
block.list = edit$1
|
|
1204
|
-
block._tag = 'address|article|aside|base|basefont|blockquote|body|caption' + '|center|col|colgroup|dd|details|dialog|dir|div|dl|dt|fieldset|figcaption' + '|figure|footer|form|frame|frameset|h[1-6]|head|header|hr|html|iframe' + '|legend|li|link|main|menu|menuitem|meta|nav|noframes|ol|optgroup|option' + '|p|param|section|source|summary|table|tbody|td|tfoot|th|thead|title|tr' + '|track|ul';
|
|
1205
|
-
block._comment = /<!--(?!-?>)[\s\S]*?(?:-->|$)/;
|
|
1206
|
-
block.html = edit$1
|
|
1207
|
-
block.paragraph = edit$1
|
|
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
|
|
1208
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
|
|
1209
|
-
.replace('html', '</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|!--)').replace('tag', block._tag) // pars can be interrupted by type (6) html blocks
|
|
1201
|
+
.replace('html', '</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|!--)').replace('tag', block$1._tag) // pars can be interrupted by type (6) html blocks
|
|
1210
1202
|
.getRegex();
|
|
1211
|
-
block.blockquote = edit$1
|
|
1203
|
+
block$1.blockquote = edit(block$1.blockquote).replace('paragraph', block$1.paragraph).getRegex();
|
|
1212
1204
|
/**
|
|
1213
1205
|
* Normal Block Grammar
|
|
1214
1206
|
*/
|
|
1215
1207
|
|
|
1216
|
-
block.normal = merge$1({}, block);
|
|
1208
|
+
block$1.normal = merge$1({}, block$1);
|
|
1217
1209
|
/**
|
|
1218
1210
|
* GFM Block Grammar
|
|
1219
1211
|
*/
|
|
1220
1212
|
|
|
1221
|
-
block.gfm = merge$1({}, block.normal, {
|
|
1213
|
+
block$1.gfm = merge$1({}, block$1.normal, {
|
|
1222
1214
|
nptable: '^ *([^|\\n ].*\\|.*)\\n' // Header
|
|
1223
1215
|
+ ' {0,3}([-:]+ *\\|[-| :]*)' // Align
|
|
1224
1216
|
+ '(?:\\n((?:(?!\\n|hr|heading|blockquote|code|fences|list|html).*(?:\\n|$))*)\\n*|$)',
|
|
@@ -1228,33 +1220,33 @@
|
|
|
1228
1220
|
+ '(?:\\n *((?:(?!\\n|hr|heading|blockquote|code|fences|list|html).*(?:\\n|$))*)\\n*|$)' // Cells
|
|
1229
1221
|
|
|
1230
1222
|
});
|
|
1231
|
-
block.gfm.nptable = edit$1
|
|
1232
|
-
.replace('html', '</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|!--)').replace('tag', block._tag) // tables can be interrupted by type (6) html blocks
|
|
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
|
|
1233
1225
|
.getRegex();
|
|
1234
|
-
block.gfm.table = edit$1
|
|
1235
|
-
.replace('html', '</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|!--)').replace('tag', block._tag) // tables can be interrupted by type (6) html blocks
|
|
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
|
|
1236
1228
|
.getRegex();
|
|
1237
1229
|
/**
|
|
1238
1230
|
* Pedantic grammar (original John Gruber's loose markdown specification)
|
|
1239
1231
|
*/
|
|
1240
1232
|
|
|
1241
|
-
block.pedantic = merge$1({}, block.normal, {
|
|
1242
|
-
html: edit
|
|
1243
|
-
+ '|<tag(?:"[^"]*"|\'[^\']*\'|\\s[^\'"/>\\s]*)*?/?> *(?:\\n{2,}|\\s*$))').replace('comment', block._comment).replace(/tag/g, '(?!(?:' + 'a|em|strong|small|s|cite|q|dfn|abbr|data|time|code|var|samp|kbd|sub' + '|sup|i|b|u|mark|ruby|rt|rp|bdi|bdo|span|br|wbr|ins|del|img)' + '\\b)\\w+(?!:|[^\\w\\s@]*@)\\b').getRegex(),
|
|
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(),
|
|
1244
1236
|
def: /^ *\[([^\]]+)\]: *<?([^\s>]+)>?(?: +(["(][^\n]+[")]))? *(?:\n+|$)/,
|
|
1245
1237
|
heading: /^(#{1,6})(.*)(?:\n+|$)/,
|
|
1246
|
-
fences: noopTest
|
|
1238
|
+
fences: noopTest,
|
|
1247
1239
|
// fences not supported
|
|
1248
|
-
paragraph: edit$1
|
|
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()
|
|
1249
1241
|
});
|
|
1250
1242
|
/**
|
|
1251
1243
|
* Inline-Level Grammar
|
|
1252
1244
|
*/
|
|
1253
1245
|
|
|
1254
|
-
var inline = {
|
|
1246
|
+
var inline$1 = {
|
|
1255
1247
|
escape: /^\\([!"#$%&'()*+,\-./:;<=>?@\[\]\\^_`{|}~])/,
|
|
1256
1248
|
autolink: /^<(scheme:[^\s\x00-\x1f<>]*|email)>/,
|
|
1257
|
-
url: noopTest
|
|
1249
|
+
url: noopTest,
|
|
1258
1250
|
tag: '^comment' + '|^</[a-zA-Z][\\w:-]*\\s*>' // self-closing tag
|
|
1259
1251
|
+ '|^<[a-zA-Z][\\w-]*(?:attribute)*?\\s*/?>' // open tag
|
|
1260
1252
|
+ '|^<\\?[\\s\\S]*?\\?>' // processing instruction, e.g. <?php ?>
|
|
@@ -1275,43 +1267,43 @@
|
|
|
1275
1267
|
},
|
|
1276
1268
|
code: /^(`+)([^`]|[^`][\s\S]*?[^`])\1(?!`)/,
|
|
1277
1269
|
br: /^( {2,}|\\)\n(?!\s*$)/,
|
|
1278
|
-
del: noopTest
|
|
1270
|
+
del: noopTest,
|
|
1279
1271
|
text: /^(`+|[^`])(?:(?= {2,}\n)|[\s\S]*?(?:(?=[\\<!\[`*_]|\b_|$)|[^ ](?= {2,}\n)))/,
|
|
1280
1272
|
punctuation: /^([\spunctuation])/
|
|
1281
1273
|
}; // list of punctuation marks from CommonMark spec
|
|
1282
1274
|
// without * and _ to handle the different emphasis markers * and _
|
|
1283
1275
|
|
|
1284
|
-
inline._punctuation = '!"#$%&\'()+\\-.,/:;<=>?@\\[\\]`^{|}~';
|
|
1285
|
-
inline.punctuation = edit$1
|
|
1286
|
-
|
|
1287
|
-
inline.blockSkip = /\[[^\]]*?\]\([^\)]*?\)|`[^`]*?`|<[^>]*?>/g;
|
|
1288
|
-
inline.escapedEmSt = /\\\*|\\_/g;
|
|
1289
|
-
inline._comment = edit$1
|
|
1290
|
-
inline.emStrong.lDelim = edit$1
|
|
1291
|
-
inline.emStrong.rDelimAst = edit$1
|
|
1292
|
-
inline.emStrong.rDelimUnd = edit$1
|
|
1293
|
-
inline._escapes = /\\([!"#$%&'()*+,\-./:;<=>?@\[\]\\^_`{|}~])/g;
|
|
1294
|
-
inline._scheme = /[a-zA-Z][a-zA-Z0-9+.-]{1,31}/;
|
|
1295
|
-
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])?)+(?![-_])/;
|
|
1296
|
-
inline.autolink = edit$1
|
|
1297
|
-
inline._attribute = /\s+[a-zA-Z:_][\w.:-]*(?:\s*=\s*"[^"]*"|\s*=\s*'[^']*'|\s*=\s*[^\s"'=<>`]+)?/;
|
|
1298
|
-
inline.tag = edit$1
|
|
1299
|
-
inline._label = /(?:\[(?:\\.|[^\[\]\\])*\]|\\.|`[^`]*`|[^\[\]\\`])*?/;
|
|
1300
|
-
inline._href = /<(?:\\.|[^\n<>\\])+>|[^\s\x00-\x1f]*/;
|
|
1301
|
-
inline._title = /"(?:\\"?|[^"\\])*"|'(?:\\'?|[^'\\])*'|\((?:\\\)?|[^)\\])*\)/;
|
|
1302
|
-
inline.link = edit$1
|
|
1303
|
-
inline.reflink = edit$1
|
|
1304
|
-
inline.reflinkSearch = edit$1
|
|
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();
|
|
1305
1297
|
/**
|
|
1306
1298
|
* Normal Inline Grammar
|
|
1307
1299
|
*/
|
|
1308
1300
|
|
|
1309
|
-
inline.normal = merge$1({}, inline);
|
|
1301
|
+
inline$1.normal = merge$1({}, inline$1);
|
|
1310
1302
|
/**
|
|
1311
1303
|
* Pedantic Inline Grammar
|
|
1312
1304
|
*/
|
|
1313
1305
|
|
|
1314
|
-
inline.pedantic = merge$1({}, inline.normal, {
|
|
1306
|
+
inline$1.pedantic = merge$1({}, inline$1.normal, {
|
|
1315
1307
|
strong: {
|
|
1316
1308
|
start: /^__|\*\*/,
|
|
1317
1309
|
middle: /^__(?=\S)([\s\S]*?\S)__(?!_)|^\*\*(?=\S)([\s\S]*?\S)\*\*(?!\*)/,
|
|
@@ -1324,39 +1316,40 @@
|
|
|
1324
1316
|
endAst: /\*(?!\*)/g,
|
|
1325
1317
|
endUnd: /_(?!_)/g
|
|
1326
1318
|
},
|
|
1327
|
-
link: edit
|
|
1328
|
-
reflink: edit
|
|
1319
|
+
link: edit(/^!?\[(label)\]\((.*?)\)/).replace('label', inline$1._label).getRegex(),
|
|
1320
|
+
reflink: edit(/^!?\[(label)\]\s*\[([^\]]*)\]/).replace('label', inline$1._label).getRegex()
|
|
1329
1321
|
});
|
|
1330
1322
|
/**
|
|
1331
1323
|
* GFM Inline Grammar
|
|
1332
1324
|
*/
|
|
1333
1325
|
|
|
1334
|
-
inline.gfm = merge$1({}, inline.normal, {
|
|
1335
|
-
escape: edit$1
|
|
1326
|
+
inline$1.gfm = merge$1({}, inline$1.normal, {
|
|
1327
|
+
escape: edit(inline$1.escape).replace('])', '~|])').getRegex(),
|
|
1336
1328
|
_extended_email: /[A-Za-z0-9._+-]+(@)[a-zA-Z0-9-_]+(?:\.[a-zA-Z0-9-_]*[a-zA-Z0-9])+(?![-_])/,
|
|
1337
1329
|
url: /^((?:ftp|https?):\/\/|www\.)(?:[a-zA-Z0-9\-]+\.?)+[^\s<]*|^email/,
|
|
1338
1330
|
_backpedal: /(?:[^?!.,:;*_~()&]+|\([^)]*\)|&(?![a-zA-Z0-9]+;$)|[?!.,:;*_~)]+(?!$))+/,
|
|
1339
1331
|
del: /^(~~?)(?=[^\s~])([\s\S]*?[^\s~])\1(?=[^~]|$)/,
|
|
1340
1332
|
text: /^([`~]+|[^`~])(?:(?= {2,}\n)|[\s\S]*?(?:(?=[\\<!\[`*~_]|\b_|https?:\/\/|ftp:\/\/|www\.|$)|[^ ](?= {2,}\n)|[^a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-](?=[a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-]+@))|(?=[a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-]+@))/
|
|
1341
1333
|
});
|
|
1342
|
-
inline.gfm.url = edit$1
|
|
1334
|
+
inline$1.gfm.url = edit(inline$1.gfm.url, 'i').replace('email', inline$1.gfm._extended_email).getRegex();
|
|
1343
1335
|
/**
|
|
1344
1336
|
* GFM + Line Breaks Inline Grammar
|
|
1345
1337
|
*/
|
|
1346
1338
|
|
|
1347
|
-
inline.breaks = merge$1({}, inline.gfm, {
|
|
1348
|
-
br: edit$1
|
|
1349
|
-
text: edit$1
|
|
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()
|
|
1350
1342
|
});
|
|
1351
1343
|
var rules = {
|
|
1352
|
-
block: block,
|
|
1353
|
-
inline: inline
|
|
1344
|
+
block: block$1,
|
|
1345
|
+
inline: inline$1
|
|
1354
1346
|
};
|
|
1355
1347
|
|
|
1356
|
-
var
|
|
1357
|
-
var
|
|
1358
|
-
|
|
1359
|
-
|
|
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;
|
|
1360
1353
|
/**
|
|
1361
1354
|
* smartypants text replacement
|
|
1362
1355
|
*/
|
|
@@ -1403,25 +1396,25 @@
|
|
|
1403
1396
|
function Lexer(options) {
|
|
1404
1397
|
this.tokens = [];
|
|
1405
1398
|
this.tokens.links = Object.create(null);
|
|
1406
|
-
this.options = options || defaults$
|
|
1407
|
-
this.options.tokenizer = this.options.tokenizer || new
|
|
1399
|
+
this.options = options || defaults$3;
|
|
1400
|
+
this.options.tokenizer = this.options.tokenizer || new Tokenizer$1();
|
|
1408
1401
|
this.tokenizer = this.options.tokenizer;
|
|
1409
1402
|
this.tokenizer.options = this.options;
|
|
1410
1403
|
var rules = {
|
|
1411
|
-
block: block
|
|
1412
|
-
inline: inline
|
|
1404
|
+
block: block.normal,
|
|
1405
|
+
inline: inline.normal
|
|
1413
1406
|
};
|
|
1414
1407
|
|
|
1415
1408
|
if (this.options.pedantic) {
|
|
1416
|
-
rules.block = block
|
|
1417
|
-
rules.inline = inline
|
|
1409
|
+
rules.block = block.pedantic;
|
|
1410
|
+
rules.inline = inline.pedantic;
|
|
1418
1411
|
} else if (this.options.gfm) {
|
|
1419
|
-
rules.block = block
|
|
1412
|
+
rules.block = block.gfm;
|
|
1420
1413
|
|
|
1421
1414
|
if (this.options.breaks) {
|
|
1422
|
-
rules.inline = inline
|
|
1415
|
+
rules.inline = inline.breaks;
|
|
1423
1416
|
} else {
|
|
1424
|
-
rules.inline = inline
|
|
1417
|
+
rules.inline = inline.gfm;
|
|
1425
1418
|
}
|
|
1426
1419
|
}
|
|
1427
1420
|
|
|
@@ -1727,7 +1720,7 @@
|
|
|
1727
1720
|
if (links.length > 0) {
|
|
1728
1721
|
while ((match = this.tokenizer.rules.inline.reflinkSearch.exec(maskedSrc)) != null) {
|
|
1729
1722
|
if (links.includes(match[0].slice(match[0].lastIndexOf('[') + 1, -1))) {
|
|
1730
|
-
maskedSrc = maskedSrc.slice(0, match.index) + '[' + repeatString
|
|
1723
|
+
maskedSrc = maskedSrc.slice(0, match.index) + '[' + repeatString('a', match[0].length - 2) + ']' + maskedSrc.slice(this.tokenizer.rules.inline.reflinkSearch.lastIndex);
|
|
1731
1724
|
}
|
|
1732
1725
|
}
|
|
1733
1726
|
}
|
|
@@ -1735,7 +1728,7 @@
|
|
|
1735
1728
|
|
|
1736
1729
|
|
|
1737
1730
|
while ((match = this.tokenizer.rules.inline.blockSkip.exec(maskedSrc)) != null) {
|
|
1738
|
-
maskedSrc = maskedSrc.slice(0, match.index) + '[' + repeatString
|
|
1731
|
+
maskedSrc = maskedSrc.slice(0, match.index) + '[' + repeatString('a', match[0].length - 2) + ']' + maskedSrc.slice(this.tokenizer.rules.inline.blockSkip.lastIndex);
|
|
1739
1732
|
} // Mask out escaped em & strong delimiters
|
|
1740
1733
|
|
|
1741
1734
|
|
|
@@ -1888,8 +1881,8 @@
|
|
|
1888
1881
|
key: "rules",
|
|
1889
1882
|
get: function get() {
|
|
1890
1883
|
return {
|
|
1891
|
-
block: block
|
|
1892
|
-
inline: inline
|
|
1884
|
+
block: block,
|
|
1885
|
+
inline: inline
|
|
1893
1886
|
};
|
|
1894
1887
|
}
|
|
1895
1888
|
}]);
|
|
@@ -1897,8 +1890,8 @@
|
|
|
1897
1890
|
return Lexer;
|
|
1898
1891
|
}();
|
|
1899
1892
|
|
|
1900
|
-
var defaults$
|
|
1901
|
-
var cleanUrl
|
|
1893
|
+
var defaults$2 = defaults$5.exports.defaults;
|
|
1894
|
+
var cleanUrl = helpers.cleanUrl,
|
|
1902
1895
|
escape$1 = helpers.escape;
|
|
1903
1896
|
/**
|
|
1904
1897
|
* Renderer
|
|
@@ -1906,7 +1899,7 @@
|
|
|
1906
1899
|
|
|
1907
1900
|
var Renderer_1 = /*#__PURE__*/function () {
|
|
1908
1901
|
function Renderer(options) {
|
|
1909
|
-
this.options = options || defaults$
|
|
1902
|
+
this.options = options || defaults$2;
|
|
1910
1903
|
}
|
|
1911
1904
|
|
|
1912
1905
|
var _proto = Renderer.prototype;
|
|
@@ -2008,7 +2001,7 @@
|
|
|
2008
2001
|
};
|
|
2009
2002
|
|
|
2010
2003
|
_proto.link = function link(href, title, text) {
|
|
2011
|
-
href = cleanUrl
|
|
2004
|
+
href = cleanUrl(this.options.sanitize, this.options.baseUrl, href);
|
|
2012
2005
|
|
|
2013
2006
|
if (href === null) {
|
|
2014
2007
|
return text;
|
|
@@ -2025,7 +2018,7 @@
|
|
|
2025
2018
|
};
|
|
2026
2019
|
|
|
2027
2020
|
_proto.image = function image(href, title, text) {
|
|
2028
|
-
href = cleanUrl
|
|
2021
|
+
href = cleanUrl(this.options.sanitize, this.options.baseUrl, href);
|
|
2029
2022
|
|
|
2030
2023
|
if (href === null) {
|
|
2031
2024
|
return text;
|
|
@@ -2052,6 +2045,7 @@
|
|
|
2052
2045
|
* TextRenderer
|
|
2053
2046
|
* returns only the textual part of the token
|
|
2054
2047
|
*/
|
|
2048
|
+
|
|
2055
2049
|
var TextRenderer_1 = /*#__PURE__*/function () {
|
|
2056
2050
|
function TextRenderer() {}
|
|
2057
2051
|
|
|
@@ -2100,6 +2094,7 @@
|
|
|
2100
2094
|
/**
|
|
2101
2095
|
* Slugger generates header id
|
|
2102
2096
|
*/
|
|
2097
|
+
|
|
2103
2098
|
var Slugger_1 = /*#__PURE__*/function () {
|
|
2104
2099
|
function Slugger() {
|
|
2105
2100
|
this.seen = {};
|
|
@@ -2156,20 +2151,23 @@
|
|
|
2156
2151
|
return Slugger;
|
|
2157
2152
|
}();
|
|
2158
2153
|
|
|
2159
|
-
var
|
|
2160
|
-
var
|
|
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;
|
|
2161
2159
|
/**
|
|
2162
2160
|
* Parsing & Compiling
|
|
2163
2161
|
*/
|
|
2164
2162
|
|
|
2165
2163
|
var Parser_1 = /*#__PURE__*/function () {
|
|
2166
2164
|
function Parser(options) {
|
|
2167
|
-
this.options = options || defaults$
|
|
2168
|
-
this.options.renderer = this.options.renderer || new
|
|
2165
|
+
this.options = options || defaults$1;
|
|
2166
|
+
this.options.renderer = this.options.renderer || new Renderer$1();
|
|
2169
2167
|
this.renderer = this.options.renderer;
|
|
2170
2168
|
this.renderer.options = this.options;
|
|
2171
|
-
this.textRenderer = new
|
|
2172
|
-
this.slugger = new
|
|
2169
|
+
this.textRenderer = new TextRenderer$1();
|
|
2170
|
+
this.slugger = new Slugger$1();
|
|
2173
2171
|
}
|
|
2174
2172
|
/**
|
|
2175
2173
|
* Static Parse Method
|
|
@@ -2239,7 +2237,7 @@
|
|
|
2239
2237
|
|
|
2240
2238
|
case 'heading':
|
|
2241
2239
|
{
|
|
2242
|
-
out += this.renderer.heading(this.parseInline(token.tokens), token.depth, unescape
|
|
2240
|
+
out += this.renderer.heading(this.parseInline(token.tokens), token.depth, unescape(this.parseInline(token.tokens, this.textRenderer)), this.slugger);
|
|
2243
2241
|
continue;
|
|
2244
2242
|
}
|
|
2245
2243
|
|
|
@@ -2474,12 +2472,18 @@
|
|
|
2474
2472
|
return Parser;
|
|
2475
2473
|
}();
|
|
2476
2474
|
|
|
2477
|
-
var
|
|
2478
|
-
|
|
2479
|
-
|
|
2480
|
-
var
|
|
2481
|
-
|
|
2482
|
-
|
|
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;
|
|
2483
2487
|
/**
|
|
2484
2488
|
* Marked
|
|
2485
2489
|
*/
|
|
@@ -2499,15 +2503,15 @@
|
|
|
2499
2503
|
opt = null;
|
|
2500
2504
|
}
|
|
2501
2505
|
|
|
2502
|
-
opt = merge
|
|
2503
|
-
checkSanitizeDeprecation
|
|
2506
|
+
opt = merge({}, marked.defaults, opt || {});
|
|
2507
|
+
checkSanitizeDeprecation(opt);
|
|
2504
2508
|
|
|
2505
2509
|
if (callback) {
|
|
2506
2510
|
var highlight = opt.highlight;
|
|
2507
2511
|
var tokens;
|
|
2508
2512
|
|
|
2509
2513
|
try {
|
|
2510
|
-
tokens =
|
|
2514
|
+
tokens = Lexer.lex(src, opt);
|
|
2511
2515
|
} catch (e) {
|
|
2512
2516
|
return callback(e);
|
|
2513
2517
|
}
|
|
@@ -2517,7 +2521,11 @@
|
|
|
2517
2521
|
|
|
2518
2522
|
if (!err) {
|
|
2519
2523
|
try {
|
|
2520
|
-
|
|
2524
|
+
if (opt.walkTokens) {
|
|
2525
|
+
marked.walkTokens(tokens, opt.walkTokens);
|
|
2526
|
+
}
|
|
2527
|
+
|
|
2528
|
+
out = Parser.parse(tokens, opt);
|
|
2521
2529
|
} catch (e) {
|
|
2522
2530
|
err = e;
|
|
2523
2531
|
}
|
|
@@ -2566,18 +2574,18 @@
|
|
|
2566
2574
|
}
|
|
2567
2575
|
|
|
2568
2576
|
try {
|
|
2569
|
-
var _tokens =
|
|
2577
|
+
var _tokens = Lexer.lex(src, opt);
|
|
2570
2578
|
|
|
2571
2579
|
if (opt.walkTokens) {
|
|
2572
2580
|
marked.walkTokens(_tokens, opt.walkTokens);
|
|
2573
2581
|
}
|
|
2574
2582
|
|
|
2575
|
-
return
|
|
2583
|
+
return Parser.parse(_tokens, opt);
|
|
2576
2584
|
} catch (e) {
|
|
2577
2585
|
e.message += '\nPlease report this to https://github.com/markedjs/marked.';
|
|
2578
2586
|
|
|
2579
2587
|
if (opt.silent) {
|
|
2580
|
-
return '<p>An error occurred:</p><pre>' + escape
|
|
2588
|
+
return '<p>An error occurred:</p><pre>' + escape(e.message + '', true) + '</pre>';
|
|
2581
2589
|
}
|
|
2582
2590
|
|
|
2583
2591
|
throw e;
|
|
@@ -2589,23 +2597,23 @@
|
|
|
2589
2597
|
|
|
2590
2598
|
|
|
2591
2599
|
marked.options = marked.setOptions = function (opt) {
|
|
2592
|
-
merge
|
|
2600
|
+
merge(marked.defaults, opt);
|
|
2593
2601
|
changeDefaults(marked.defaults);
|
|
2594
2602
|
return marked;
|
|
2595
2603
|
};
|
|
2596
2604
|
|
|
2597
2605
|
marked.getDefaults = getDefaults;
|
|
2598
|
-
marked.defaults = defaults
|
|
2606
|
+
marked.defaults = defaults;
|
|
2599
2607
|
/**
|
|
2600
2608
|
* Use Extension
|
|
2601
2609
|
*/
|
|
2602
2610
|
|
|
2603
2611
|
marked.use = function (extension) {
|
|
2604
|
-
var opts = merge
|
|
2612
|
+
var opts = merge({}, extension);
|
|
2605
2613
|
|
|
2606
2614
|
if (extension.renderer) {
|
|
2607
2615
|
(function () {
|
|
2608
|
-
var renderer = marked.defaults.renderer || new
|
|
2616
|
+
var renderer = marked.defaults.renderer || new Renderer();
|
|
2609
2617
|
|
|
2610
2618
|
var _loop = function _loop(prop) {
|
|
2611
2619
|
var prevRenderer = renderer[prop];
|
|
@@ -2635,7 +2643,7 @@
|
|
|
2635
2643
|
|
|
2636
2644
|
if (extension.tokenizer) {
|
|
2637
2645
|
(function () {
|
|
2638
|
-
var tokenizer = marked.defaults.tokenizer || new
|
|
2646
|
+
var tokenizer = marked.defaults.tokenizer || new Tokenizer();
|
|
2639
2647
|
|
|
2640
2648
|
var _loop2 = function _loop2(prop) {
|
|
2641
2649
|
var prevTokenizer = tokenizer[prop];
|
|
@@ -2737,22 +2745,22 @@
|
|
|
2737
2745
|
throw new Error('marked.parseInline(): input parameter is of type ' + Object.prototype.toString.call(src) + ', string expected');
|
|
2738
2746
|
}
|
|
2739
2747
|
|
|
2740
|
-
opt = merge
|
|
2741
|
-
checkSanitizeDeprecation
|
|
2748
|
+
opt = merge({}, marked.defaults, opt || {});
|
|
2749
|
+
checkSanitizeDeprecation(opt);
|
|
2742
2750
|
|
|
2743
2751
|
try {
|
|
2744
|
-
var tokens =
|
|
2752
|
+
var tokens = Lexer.lexInline(src, opt);
|
|
2745
2753
|
|
|
2746
2754
|
if (opt.walkTokens) {
|
|
2747
2755
|
marked.walkTokens(tokens, opt.walkTokens);
|
|
2748
2756
|
}
|
|
2749
2757
|
|
|
2750
|
-
return
|
|
2758
|
+
return Parser.parseInline(tokens, opt);
|
|
2751
2759
|
} catch (e) {
|
|
2752
2760
|
e.message += '\nPlease report this to https://github.com/markedjs/marked.';
|
|
2753
2761
|
|
|
2754
2762
|
if (opt.silent) {
|
|
2755
|
-
return '<p>An error occurred:</p><pre>' + escape
|
|
2763
|
+
return '<p>An error occurred:</p><pre>' + escape(e.message + '', true) + '</pre>';
|
|
2756
2764
|
}
|
|
2757
2765
|
|
|
2758
2766
|
throw e;
|
|
@@ -2763,14 +2771,14 @@
|
|
|
2763
2771
|
*/
|
|
2764
2772
|
|
|
2765
2773
|
|
|
2766
|
-
marked.Parser =
|
|
2767
|
-
marked.parser =
|
|
2768
|
-
marked.Renderer =
|
|
2769
|
-
marked.TextRenderer =
|
|
2770
|
-
marked.Lexer =
|
|
2771
|
-
marked.lexer =
|
|
2772
|
-
marked.Tokenizer =
|
|
2773
|
-
marked.Slugger =
|
|
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;
|
|
2774
2782
|
marked.parse = marked;
|
|
2775
2783
|
var marked_1 = marked;
|
|
2776
2784
|
|