marked 13.0.1 → 13.0.3
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/bin/main.js +3 -4
- package/lib/marked.cjs +72 -69
- package/lib/marked.cjs.map +1 -1
- package/lib/marked.d.cts +2 -2
- package/lib/marked.d.ts +2 -2
- package/lib/marked.esm.js +72 -69
- package/lib/marked.esm.js.map +1 -1
- package/lib/marked.umd.js +72 -69
- package/lib/marked.umd.js.map +1 -1
- package/man/marked.1 +1 -1
- package/marked.min.js +2 -2
- package/package.json +30 -28
package/bin/main.js
CHANGED
|
@@ -28,13 +28,12 @@ export async function main(nodeProcess) {
|
|
|
28
28
|
const options = {
|
|
29
29
|
cwd: nodeProcess.cwd(),
|
|
30
30
|
env: nodeProcess.env,
|
|
31
|
-
stdio: 'inherit'
|
|
31
|
+
stdio: 'inherit',
|
|
32
32
|
};
|
|
33
33
|
|
|
34
34
|
const __dirname = dirname(fileURLToPath(import.meta.url));
|
|
35
35
|
const helpText = await readFile(resolve(__dirname, '../man/marked.1.md'), 'utf8');
|
|
36
36
|
|
|
37
|
-
// eslint-disable-next-line promise/param-names
|
|
38
37
|
await new Promise(res => {
|
|
39
38
|
spawn('man', [resolve(__dirname, '../man/marked.1')], options)
|
|
40
39
|
.on('error', () => {
|
|
@@ -128,7 +127,7 @@ export async function main(nodeProcess) {
|
|
|
128
127
|
default:
|
|
129
128
|
if (arg.indexOf('--') === 0) {
|
|
130
129
|
opt = camelize(arg.replace(/^--(no-)?/, ''));
|
|
131
|
-
if (!marked.defaults
|
|
130
|
+
if (!(opt in marked.defaults)) {
|
|
132
131
|
continue;
|
|
133
132
|
}
|
|
134
133
|
if (arg.indexOf('--no-') === 0) {
|
|
@@ -205,7 +204,7 @@ export async function main(nodeProcess) {
|
|
|
205
204
|
const defaultConfig = [
|
|
206
205
|
'~/.marked.json',
|
|
207
206
|
'~/.marked.js',
|
|
208
|
-
'~/.marked/index.js'
|
|
207
|
+
'~/.marked/index.js',
|
|
209
208
|
];
|
|
210
209
|
|
|
211
210
|
for (const configFile of defaultConfig) {
|
package/lib/marked.cjs
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* marked v13.0.
|
|
2
|
+
* marked v13.0.3 - a markdown parser
|
|
3
3
|
* Copyright (c) 2011-2024, Christopher Jeffrey. (MIT Licensed)
|
|
4
4
|
* https://github.com/markedjs/marked
|
|
5
5
|
*/
|
|
@@ -25,7 +25,7 @@ function _getDefaults() {
|
|
|
25
25
|
renderer: null,
|
|
26
26
|
silent: false,
|
|
27
27
|
tokenizer: null,
|
|
28
|
-
walkTokens: null
|
|
28
|
+
walkTokens: null,
|
|
29
29
|
};
|
|
30
30
|
}
|
|
31
31
|
exports.defaults = _getDefaults();
|
|
@@ -45,7 +45,7 @@ const escapeReplacements = {
|
|
|
45
45
|
'<': '<',
|
|
46
46
|
'>': '>',
|
|
47
47
|
'"': '"',
|
|
48
|
-
"'": '''
|
|
48
|
+
"'": ''',
|
|
49
49
|
};
|
|
50
50
|
const getEscapeReplacement = (ch) => escapeReplacements[ch];
|
|
51
51
|
function escape$1(html, encode) {
|
|
@@ -89,7 +89,7 @@ function edit(regex, opt) {
|
|
|
89
89
|
},
|
|
90
90
|
getRegex: () => {
|
|
91
91
|
return new RegExp(source, opt);
|
|
92
|
-
}
|
|
92
|
+
},
|
|
93
93
|
};
|
|
94
94
|
return obj;
|
|
95
95
|
}
|
|
@@ -97,7 +97,7 @@ function cleanUrl(href) {
|
|
|
97
97
|
try {
|
|
98
98
|
href = encodeURI(href).replace(/%25/g, '%');
|
|
99
99
|
}
|
|
100
|
-
catch
|
|
100
|
+
catch {
|
|
101
101
|
return null;
|
|
102
102
|
}
|
|
103
103
|
return href;
|
|
@@ -208,7 +208,7 @@ function outputLink(cap, link, raw, lexer) {
|
|
|
208
208
|
href,
|
|
209
209
|
title,
|
|
210
210
|
text,
|
|
211
|
-
tokens: lexer.inlineTokens(text)
|
|
211
|
+
tokens: lexer.inlineTokens(text),
|
|
212
212
|
};
|
|
213
213
|
lexer.state.inLink = false;
|
|
214
214
|
return token;
|
|
@@ -218,7 +218,7 @@ function outputLink(cap, link, raw, lexer) {
|
|
|
218
218
|
raw,
|
|
219
219
|
href,
|
|
220
220
|
title,
|
|
221
|
-
text: escape$1(text)
|
|
221
|
+
text: escape$1(text),
|
|
222
222
|
};
|
|
223
223
|
}
|
|
224
224
|
function indentCodeCompensation(raw, text) {
|
|
@@ -257,7 +257,7 @@ class _Tokenizer {
|
|
|
257
257
|
if (cap && cap[0].length > 0) {
|
|
258
258
|
return {
|
|
259
259
|
type: 'space',
|
|
260
|
-
raw: cap[0]
|
|
260
|
+
raw: cap[0],
|
|
261
261
|
};
|
|
262
262
|
}
|
|
263
263
|
}
|
|
@@ -271,7 +271,7 @@ class _Tokenizer {
|
|
|
271
271
|
codeBlockStyle: 'indented',
|
|
272
272
|
text: !this.options.pedantic
|
|
273
273
|
? rtrim(text, '\n')
|
|
274
|
-
: text
|
|
274
|
+
: text,
|
|
275
275
|
};
|
|
276
276
|
}
|
|
277
277
|
}
|
|
@@ -284,7 +284,7 @@ class _Tokenizer {
|
|
|
284
284
|
type: 'code',
|
|
285
285
|
raw,
|
|
286
286
|
lang: cap[2] ? cap[2].trim().replace(this.rules.inline.anyPunctuation, '$1') : cap[2],
|
|
287
|
-
text
|
|
287
|
+
text,
|
|
288
288
|
};
|
|
289
289
|
}
|
|
290
290
|
}
|
|
@@ -308,7 +308,7 @@ class _Tokenizer {
|
|
|
308
308
|
raw: cap[0],
|
|
309
309
|
depth: cap[1].length,
|
|
310
310
|
text,
|
|
311
|
-
tokens: this.lexer.inline(text)
|
|
311
|
+
tokens: this.lexer.inline(text),
|
|
312
312
|
};
|
|
313
313
|
}
|
|
314
314
|
}
|
|
@@ -317,7 +317,7 @@ class _Tokenizer {
|
|
|
317
317
|
if (cap) {
|
|
318
318
|
return {
|
|
319
319
|
type: 'hr',
|
|
320
|
-
raw: rtrim(cap[0], '\n')
|
|
320
|
+
raw: rtrim(cap[0], '\n'),
|
|
321
321
|
};
|
|
322
322
|
}
|
|
323
323
|
}
|
|
@@ -394,7 +394,7 @@ class _Tokenizer {
|
|
|
394
394
|
type: 'blockquote',
|
|
395
395
|
raw,
|
|
396
396
|
tokens,
|
|
397
|
-
text
|
|
397
|
+
text,
|
|
398
398
|
};
|
|
399
399
|
}
|
|
400
400
|
}
|
|
@@ -409,7 +409,7 @@ class _Tokenizer {
|
|
|
409
409
|
ordered: isordered,
|
|
410
410
|
start: isordered ? +bull.slice(0, -1) : '',
|
|
411
411
|
loose: false,
|
|
412
|
-
items: []
|
|
412
|
+
items: [],
|
|
413
413
|
};
|
|
414
414
|
bull = isordered ? `\\d{1,9}\\${bull.slice(-1)}` : `\\${bull}`;
|
|
415
415
|
if (this.options.pedantic) {
|
|
@@ -417,12 +417,12 @@ class _Tokenizer {
|
|
|
417
417
|
}
|
|
418
418
|
// Get next list item
|
|
419
419
|
const itemRegex = new RegExp(`^( {0,3}${bull})((?:[\t ][^\\n]*)?(?:\\n|$))`);
|
|
420
|
-
let raw = '';
|
|
421
|
-
let itemContents = '';
|
|
422
420
|
let endsWithBlankLine = false;
|
|
423
421
|
// Check if current bullet point can start a new List Item
|
|
424
422
|
while (src) {
|
|
425
423
|
let endEarly = false;
|
|
424
|
+
let raw = '';
|
|
425
|
+
let itemContents = '';
|
|
426
426
|
if (!(cap = itemRegex.exec(src))) {
|
|
427
427
|
break;
|
|
428
428
|
}
|
|
@@ -433,19 +433,22 @@ class _Tokenizer {
|
|
|
433
433
|
src = src.substring(raw.length);
|
|
434
434
|
let line = cap[2].split('\n', 1)[0].replace(/^\t+/, (t) => ' '.repeat(3 * t.length));
|
|
435
435
|
let nextLine = src.split('\n', 1)[0];
|
|
436
|
+
let blankLine = !line.trim();
|
|
436
437
|
let indent = 0;
|
|
437
438
|
if (this.options.pedantic) {
|
|
438
439
|
indent = 2;
|
|
439
440
|
itemContents = line.trimStart();
|
|
440
441
|
}
|
|
442
|
+
else if (blankLine) {
|
|
443
|
+
indent = cap[1].length + 1;
|
|
444
|
+
}
|
|
441
445
|
else {
|
|
442
446
|
indent = cap[2].search(/[^ ]/); // Find first non-space char
|
|
443
447
|
indent = indent > 4 ? 1 : indent; // Treat indented code blocks (> 4 spaces) as having only 1 indent
|
|
444
448
|
itemContents = line.slice(indent);
|
|
445
449
|
indent += cap[1].length;
|
|
446
450
|
}
|
|
447
|
-
|
|
448
|
-
if (!line && /^ *$/.test(nextLine)) { // Items begin with at most one blank line
|
|
451
|
+
if (blankLine && /^ *$/.test(nextLine)) { // Items begin with at most one blank line
|
|
449
452
|
raw += nextLine + '\n';
|
|
450
453
|
src = src.substring(nextLine.length + 1);
|
|
451
454
|
endEarly = true;
|
|
@@ -536,13 +539,13 @@ class _Tokenizer {
|
|
|
536
539
|
checked: ischecked,
|
|
537
540
|
loose: false,
|
|
538
541
|
text: itemContents,
|
|
539
|
-
tokens: []
|
|
542
|
+
tokens: [],
|
|
540
543
|
});
|
|
541
544
|
list.raw += raw;
|
|
542
545
|
}
|
|
543
546
|
// Do not consume newlines at end of final item. Alternatively, make itemRegex *start* with any newlines to simplify/speed up endsWithBlankLine logic
|
|
544
|
-
list.items[list.items.length - 1].raw = raw.trimEnd();
|
|
545
|
-
|
|
547
|
+
list.items[list.items.length - 1].raw = list.items[list.items.length - 1].raw.trimEnd();
|
|
548
|
+
list.items[list.items.length - 1].text = list.items[list.items.length - 1].text.trimEnd();
|
|
546
549
|
list.raw = list.raw.trimEnd();
|
|
547
550
|
// Item child tokens handled here at end because we needed to have the final item to trim it first
|
|
548
551
|
for (let i = 0; i < list.items.length; i++) {
|
|
@@ -572,7 +575,7 @@ class _Tokenizer {
|
|
|
572
575
|
block: true,
|
|
573
576
|
raw: cap[0],
|
|
574
577
|
pre: cap[1] === 'pre' || cap[1] === 'script' || cap[1] === 'style',
|
|
575
|
-
text: cap[0]
|
|
578
|
+
text: cap[0],
|
|
576
579
|
};
|
|
577
580
|
return token;
|
|
578
581
|
}
|
|
@@ -588,7 +591,7 @@ class _Tokenizer {
|
|
|
588
591
|
tag,
|
|
589
592
|
raw: cap[0],
|
|
590
593
|
href,
|
|
591
|
-
title
|
|
594
|
+
title,
|
|
592
595
|
};
|
|
593
596
|
}
|
|
594
597
|
}
|
|
@@ -609,7 +612,7 @@ class _Tokenizer {
|
|
|
609
612
|
raw: cap[0],
|
|
610
613
|
header: [],
|
|
611
614
|
align: [],
|
|
612
|
-
rows: []
|
|
615
|
+
rows: [],
|
|
613
616
|
};
|
|
614
617
|
if (headers.length !== aligns.length) {
|
|
615
618
|
// header and align columns must be equal, rows can be different.
|
|
@@ -634,7 +637,7 @@ class _Tokenizer {
|
|
|
634
637
|
text: headers[i],
|
|
635
638
|
tokens: this.lexer.inline(headers[i]),
|
|
636
639
|
header: true,
|
|
637
|
-
align: item.align[i]
|
|
640
|
+
align: item.align[i],
|
|
638
641
|
});
|
|
639
642
|
}
|
|
640
643
|
for (const row of rows) {
|
|
@@ -643,7 +646,7 @@ class _Tokenizer {
|
|
|
643
646
|
text: cell,
|
|
644
647
|
tokens: this.lexer.inline(cell),
|
|
645
648
|
header: false,
|
|
646
|
-
align: item.align[i]
|
|
649
|
+
align: item.align[i],
|
|
647
650
|
};
|
|
648
651
|
}));
|
|
649
652
|
}
|
|
@@ -657,7 +660,7 @@ class _Tokenizer {
|
|
|
657
660
|
raw: cap[0],
|
|
658
661
|
depth: cap[2].charAt(0) === '=' ? 1 : 2,
|
|
659
662
|
text: cap[1],
|
|
660
|
-
tokens: this.lexer.inline(cap[1])
|
|
663
|
+
tokens: this.lexer.inline(cap[1]),
|
|
661
664
|
};
|
|
662
665
|
}
|
|
663
666
|
}
|
|
@@ -671,7 +674,7 @@ class _Tokenizer {
|
|
|
671
674
|
type: 'paragraph',
|
|
672
675
|
raw: cap[0],
|
|
673
676
|
text,
|
|
674
|
-
tokens: this.lexer.inline(text)
|
|
677
|
+
tokens: this.lexer.inline(text),
|
|
675
678
|
};
|
|
676
679
|
}
|
|
677
680
|
}
|
|
@@ -682,7 +685,7 @@ class _Tokenizer {
|
|
|
682
685
|
type: 'text',
|
|
683
686
|
raw: cap[0],
|
|
684
687
|
text: cap[0],
|
|
685
|
-
tokens: this.lexer.inline(cap[0])
|
|
688
|
+
tokens: this.lexer.inline(cap[0]),
|
|
686
689
|
};
|
|
687
690
|
}
|
|
688
691
|
}
|
|
@@ -692,7 +695,7 @@ class _Tokenizer {
|
|
|
692
695
|
return {
|
|
693
696
|
type: 'escape',
|
|
694
697
|
raw: cap[0],
|
|
695
|
-
text: escape$1(cap[1])
|
|
698
|
+
text: escape$1(cap[1]),
|
|
696
699
|
};
|
|
697
700
|
}
|
|
698
701
|
}
|
|
@@ -717,7 +720,7 @@ class _Tokenizer {
|
|
|
717
720
|
inLink: this.lexer.state.inLink,
|
|
718
721
|
inRawBlock: this.lexer.state.inRawBlock,
|
|
719
722
|
block: false,
|
|
720
|
-
text: cap[0]
|
|
723
|
+
text: cap[0],
|
|
721
724
|
};
|
|
722
725
|
}
|
|
723
726
|
}
|
|
@@ -772,7 +775,7 @@ class _Tokenizer {
|
|
|
772
775
|
}
|
|
773
776
|
return outputLink(cap, {
|
|
774
777
|
href: href ? href.replace(this.rules.inline.anyPunctuation, '$1') : href,
|
|
775
|
-
title: title ? title.replace(this.rules.inline.anyPunctuation, '$1') : title
|
|
778
|
+
title: title ? title.replace(this.rules.inline.anyPunctuation, '$1') : title,
|
|
776
779
|
}, cap[0], this.lexer);
|
|
777
780
|
}
|
|
778
781
|
}
|
|
@@ -787,7 +790,7 @@ class _Tokenizer {
|
|
|
787
790
|
return {
|
|
788
791
|
type: 'text',
|
|
789
792
|
raw: text,
|
|
790
|
-
text
|
|
793
|
+
text,
|
|
791
794
|
};
|
|
792
795
|
}
|
|
793
796
|
return outputLink(cap, link, cap[0], this.lexer);
|
|
@@ -839,7 +842,7 @@ class _Tokenizer {
|
|
|
839
842
|
type: 'em',
|
|
840
843
|
raw,
|
|
841
844
|
text,
|
|
842
|
-
tokens: this.lexer.inlineTokens(text)
|
|
845
|
+
tokens: this.lexer.inlineTokens(text),
|
|
843
846
|
};
|
|
844
847
|
}
|
|
845
848
|
// Create 'strong' if smallest delimiter has even char count. **a***
|
|
@@ -848,7 +851,7 @@ class _Tokenizer {
|
|
|
848
851
|
type: 'strong',
|
|
849
852
|
raw,
|
|
850
853
|
text,
|
|
851
|
-
tokens: this.lexer.inlineTokens(text)
|
|
854
|
+
tokens: this.lexer.inlineTokens(text),
|
|
852
855
|
};
|
|
853
856
|
}
|
|
854
857
|
}
|
|
@@ -866,7 +869,7 @@ class _Tokenizer {
|
|
|
866
869
|
return {
|
|
867
870
|
type: 'codespan',
|
|
868
871
|
raw: cap[0],
|
|
869
|
-
text
|
|
872
|
+
text,
|
|
870
873
|
};
|
|
871
874
|
}
|
|
872
875
|
}
|
|
@@ -875,7 +878,7 @@ class _Tokenizer {
|
|
|
875
878
|
if (cap) {
|
|
876
879
|
return {
|
|
877
880
|
type: 'br',
|
|
878
|
-
raw: cap[0]
|
|
881
|
+
raw: cap[0],
|
|
879
882
|
};
|
|
880
883
|
}
|
|
881
884
|
}
|
|
@@ -886,7 +889,7 @@ class _Tokenizer {
|
|
|
886
889
|
type: 'del',
|
|
887
890
|
raw: cap[0],
|
|
888
891
|
text: cap[2],
|
|
889
|
-
tokens: this.lexer.inlineTokens(cap[2])
|
|
892
|
+
tokens: this.lexer.inlineTokens(cap[2]),
|
|
890
893
|
};
|
|
891
894
|
}
|
|
892
895
|
}
|
|
@@ -911,9 +914,9 @@ class _Tokenizer {
|
|
|
911
914
|
{
|
|
912
915
|
type: 'text',
|
|
913
916
|
raw: text,
|
|
914
|
-
text
|
|
915
|
-
}
|
|
916
|
-
]
|
|
917
|
+
text,
|
|
918
|
+
},
|
|
919
|
+
],
|
|
917
920
|
};
|
|
918
921
|
}
|
|
919
922
|
}
|
|
@@ -949,9 +952,9 @@ class _Tokenizer {
|
|
|
949
952
|
{
|
|
950
953
|
type: 'text',
|
|
951
954
|
raw: text,
|
|
952
|
-
text
|
|
953
|
-
}
|
|
954
|
-
]
|
|
955
|
+
text,
|
|
956
|
+
},
|
|
957
|
+
],
|
|
955
958
|
};
|
|
956
959
|
}
|
|
957
960
|
}
|
|
@@ -968,7 +971,7 @@ class _Tokenizer {
|
|
|
968
971
|
return {
|
|
969
972
|
type: 'text',
|
|
970
973
|
raw: cap[0],
|
|
971
|
-
text
|
|
974
|
+
text,
|
|
972
975
|
};
|
|
973
976
|
}
|
|
974
977
|
}
|
|
@@ -1052,7 +1055,7 @@ const blockNormal = {
|
|
|
1052
1055
|
newline,
|
|
1053
1056
|
paragraph,
|
|
1054
1057
|
table: noopTest,
|
|
1055
|
-
text: blockText
|
|
1058
|
+
text: blockText,
|
|
1056
1059
|
};
|
|
1057
1060
|
/**
|
|
1058
1061
|
* GFM Block Grammar
|
|
@@ -1082,7 +1085,7 @@ const blockGfm = {
|
|
|
1082
1085
|
.replace('list', ' {0,3}(?:[*+-]|1[.)]) ') // only lists starting from 1 can interrupt
|
|
1083
1086
|
.replace('html', '</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|textarea|!--)')
|
|
1084
1087
|
.replace('tag', _tag) // pars can be interrupted by type (6) html blocks
|
|
1085
|
-
.getRegex()
|
|
1088
|
+
.getRegex(),
|
|
1086
1089
|
};
|
|
1087
1090
|
/**
|
|
1088
1091
|
* Pedantic grammar (original John Gruber's loose markdown specification)
|
|
@@ -1112,7 +1115,7 @@ const blockPedantic = {
|
|
|
1112
1115
|
.replace('|list', '')
|
|
1113
1116
|
.replace('|html', '')
|
|
1114
1117
|
.replace('|tag', '')
|
|
1115
|
-
.getRegex()
|
|
1118
|
+
.getRegex(),
|
|
1116
1119
|
};
|
|
1117
1120
|
/**
|
|
1118
1121
|
* Inline-Level Grammar
|
|
@@ -1206,7 +1209,7 @@ const inlineNormal = {
|
|
|
1206
1209
|
reflinkSearch,
|
|
1207
1210
|
tag,
|
|
1208
1211
|
text: inlineText,
|
|
1209
|
-
url: noopTest
|
|
1212
|
+
url: noopTest,
|
|
1210
1213
|
};
|
|
1211
1214
|
/**
|
|
1212
1215
|
* Pedantic Inline Grammar
|
|
@@ -1218,7 +1221,7 @@ const inlinePedantic = {
|
|
|
1218
1221
|
.getRegex(),
|
|
1219
1222
|
reflink: edit(/^!?\[(label)\]\s*\[([^\]]*)\]/)
|
|
1220
1223
|
.replace('label', _inlineLabel)
|
|
1221
|
-
.getRegex()
|
|
1224
|
+
.getRegex(),
|
|
1222
1225
|
};
|
|
1223
1226
|
/**
|
|
1224
1227
|
* GFM Inline Grammar
|
|
@@ -1231,7 +1234,7 @@ const inlineGfm = {
|
|
|
1231
1234
|
.getRegex(),
|
|
1232
1235
|
_backpedal: /(?:[^?!.,:;*_'"~()&]+|\([^)]*\)|&(?![a-zA-Z0-9]+;$)|[?!.,:;*_'"~)]+(?!$))+/,
|
|
1233
1236
|
del: /^(~~?)(?=[^\s~])([\s\S]*?[^\s~])\1(?=[^~]|$)/,
|
|
1234
|
-
text: /^([`~]+|[^`~])(?:(?= {2,}\n)|(?=[a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-]+@)|[\s\S]*?(?:(?=[\\<!\[`*~_]|\b_|https?:\/\/|ftp:\/\/|www\.|$)|[^ ](?= {2,}\n)|[^a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-](?=[a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-]+@)))
|
|
1237
|
+
text: /^([`~]+|[^`~])(?:(?= {2,}\n)|(?=[a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-]+@)|[\s\S]*?(?:(?=[\\<!\[`*~_]|\b_|https?:\/\/|ftp:\/\/|www\.|$)|[^ ](?= {2,}\n)|[^a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-](?=[a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-]+@)))/,
|
|
1235
1238
|
};
|
|
1236
1239
|
/**
|
|
1237
1240
|
* GFM + Line Breaks Inline Grammar
|
|
@@ -1242,7 +1245,7 @@ const inlineBreaks = {
|
|
|
1242
1245
|
text: edit(inlineGfm.text)
|
|
1243
1246
|
.replace('\\b_', '\\b_| {2,}\\n')
|
|
1244
1247
|
.replace(/\{2,\}/g, '*')
|
|
1245
|
-
.getRegex()
|
|
1248
|
+
.getRegex(),
|
|
1246
1249
|
};
|
|
1247
1250
|
/**
|
|
1248
1251
|
* exports
|
|
@@ -1250,13 +1253,13 @@ const inlineBreaks = {
|
|
|
1250
1253
|
const block = {
|
|
1251
1254
|
normal: blockNormal,
|
|
1252
1255
|
gfm: blockGfm,
|
|
1253
|
-
pedantic: blockPedantic
|
|
1256
|
+
pedantic: blockPedantic,
|
|
1254
1257
|
};
|
|
1255
1258
|
const inline = {
|
|
1256
1259
|
normal: inlineNormal,
|
|
1257
1260
|
gfm: inlineGfm,
|
|
1258
1261
|
breaks: inlineBreaks,
|
|
1259
|
-
pedantic: inlinePedantic
|
|
1262
|
+
pedantic: inlinePedantic,
|
|
1260
1263
|
};
|
|
1261
1264
|
|
|
1262
1265
|
/**
|
|
@@ -1281,11 +1284,11 @@ class _Lexer {
|
|
|
1281
1284
|
this.state = {
|
|
1282
1285
|
inLink: false,
|
|
1283
1286
|
inRawBlock: false,
|
|
1284
|
-
top: true
|
|
1287
|
+
top: true,
|
|
1285
1288
|
};
|
|
1286
1289
|
const rules = {
|
|
1287
1290
|
block: block.normal,
|
|
1288
|
-
inline: inline.normal
|
|
1291
|
+
inline: inline.normal,
|
|
1289
1292
|
};
|
|
1290
1293
|
if (this.options.pedantic) {
|
|
1291
1294
|
rules.block = block.pedantic;
|
|
@@ -1308,7 +1311,7 @@ class _Lexer {
|
|
|
1308
1311
|
static get rules() {
|
|
1309
1312
|
return {
|
|
1310
1313
|
block,
|
|
1311
|
-
inline
|
|
1314
|
+
inline,
|
|
1312
1315
|
};
|
|
1313
1316
|
}
|
|
1314
1317
|
/**
|
|
@@ -1440,7 +1443,7 @@ class _Lexer {
|
|
|
1440
1443
|
else if (!this.tokens.links[token.tag]) {
|
|
1441
1444
|
this.tokens.links[token.tag] = {
|
|
1442
1445
|
href: token.href,
|
|
1443
|
-
title: token.title
|
|
1446
|
+
title: token.title,
|
|
1444
1447
|
};
|
|
1445
1448
|
}
|
|
1446
1449
|
continue;
|
|
@@ -1756,7 +1759,7 @@ class _Renderer {
|
|
|
1756
1759
|
item.tokens.unshift({
|
|
1757
1760
|
type: 'text',
|
|
1758
1761
|
raw: checkbox + ' ',
|
|
1759
|
-
text: checkbox + ' '
|
|
1762
|
+
text: checkbox + ' ',
|
|
1760
1763
|
});
|
|
1761
1764
|
}
|
|
1762
1765
|
}
|
|
@@ -1992,7 +1995,7 @@ class _Parser {
|
|
|
1992
1995
|
type: 'paragraph',
|
|
1993
1996
|
raw: body,
|
|
1994
1997
|
text: body,
|
|
1995
|
-
tokens: [{ type: 'text', raw: body, text: body }]
|
|
1998
|
+
tokens: [{ type: 'text', raw: body, text: body }],
|
|
1996
1999
|
});
|
|
1997
2000
|
}
|
|
1998
2001
|
else {
|
|
@@ -2096,7 +2099,7 @@ class _Hooks {
|
|
|
2096
2099
|
static passThroughHooks = new Set([
|
|
2097
2100
|
'preprocess',
|
|
2098
2101
|
'postprocess',
|
|
2099
|
-
'processAllTokens'
|
|
2102
|
+
'processAllTokens',
|
|
2100
2103
|
]);
|
|
2101
2104
|
/**
|
|
2102
2105
|
* Process markdown before marked
|
|
@@ -2251,13 +2254,13 @@ class Marked {
|
|
|
2251
2254
|
}
|
|
2252
2255
|
const rendererProp = prop;
|
|
2253
2256
|
let rendererFunc = pack.renderer[rendererProp];
|
|
2257
|
+
if (!pack.useNewRenderer) {
|
|
2258
|
+
// TODO: Remove this in next major version
|
|
2259
|
+
rendererFunc = this.#convertRendererFunction(rendererFunc, rendererProp, renderer);
|
|
2260
|
+
}
|
|
2254
2261
|
const prevRenderer = renderer[rendererProp];
|
|
2255
2262
|
// Replace renderer with func to run extension, but fall back if false
|
|
2256
2263
|
renderer[rendererProp] = (...args) => {
|
|
2257
|
-
if (!pack.useNewRenderer) {
|
|
2258
|
-
// TODO: Remove this in next major version
|
|
2259
|
-
rendererFunc = this.#convertRendererFunction(rendererFunc, rendererProp, renderer);
|
|
2260
|
-
}
|
|
2261
2264
|
let ret = rendererFunc.apply(renderer, args);
|
|
2262
2265
|
if (ret === false) {
|
|
2263
2266
|
ret = prevRenderer.apply(renderer, args);
|
|
@@ -2384,7 +2387,7 @@ class Marked {
|
|
|
2384
2387
|
text: token.header[j].text,
|
|
2385
2388
|
tokens: token.header[j].tokens,
|
|
2386
2389
|
header: true,
|
|
2387
|
-
align: token.align[j]
|
|
2390
|
+
align: token.align[j],
|
|
2388
2391
|
});
|
|
2389
2392
|
}
|
|
2390
2393
|
header += this.tablerow({ text: cell });
|
|
@@ -2397,7 +2400,7 @@ class Marked {
|
|
|
2397
2400
|
text: row[k].text,
|
|
2398
2401
|
tokens: row[k].tokens,
|
|
2399
2402
|
header: false,
|
|
2400
|
-
align: token.align[k]
|
|
2403
|
+
align: token.align[k],
|
|
2401
2404
|
});
|
|
2402
2405
|
}
|
|
2403
2406
|
body += this.tablerow({ text: cell });
|
|
@@ -2442,7 +2445,7 @@ class Marked {
|
|
|
2442
2445
|
else {
|
|
2443
2446
|
item.tokens.unshift({
|
|
2444
2447
|
type: 'text',
|
|
2445
|
-
text: checkbox + ' '
|
|
2448
|
+
text: checkbox + ' ',
|
|
2446
2449
|
});
|
|
2447
2450
|
}
|
|
2448
2451
|
}
|
|
@@ -2458,7 +2461,7 @@ class Marked {
|
|
|
2458
2461
|
task,
|
|
2459
2462
|
checked: !!checked,
|
|
2460
2463
|
loose,
|
|
2461
|
-
tokens: item.tokens
|
|
2464
|
+
tokens: item.tokens,
|
|
2462
2465
|
});
|
|
2463
2466
|
}
|
|
2464
2467
|
return func.call(this, body, ordered, start);
|