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/lib/marked.d.cts
CHANGED
|
@@ -636,7 +636,7 @@ export declare namespace marked {
|
|
|
636
636
|
var defaults: MarkedOptions;
|
|
637
637
|
var use: (...args: MarkedExtension[]) => typeof marked;
|
|
638
638
|
var walkTokens: (tokens: Token[] | TokensList, callback: (token: Token) => MaybePromise | MaybePromise[]) => MaybePromise[];
|
|
639
|
-
var parseInline: (src: string, options?: MarkedOptions |
|
|
639
|
+
var parseInline: (src: string, options?: MarkedOptions | undefined | null) => string | Promise<string>;
|
|
640
640
|
var Parser: typeof _Parser;
|
|
641
641
|
var parser: typeof _Parser.parse;
|
|
642
642
|
var Renderer: typeof _Renderer;
|
|
@@ -651,7 +651,7 @@ export declare const options: (options: MarkedOptions) => typeof marked;
|
|
|
651
651
|
export declare const setOptions: (options: MarkedOptions) => typeof marked;
|
|
652
652
|
export declare const use: (...args: MarkedExtension[]) => typeof marked;
|
|
653
653
|
export declare const walkTokens: (tokens: Token[] | TokensList, callback: (token: Token) => MaybePromise | MaybePromise[]) => MaybePromise[];
|
|
654
|
-
export declare const parseInline: (src: string, options?: MarkedOptions |
|
|
654
|
+
export declare const parseInline: (src: string, options?: MarkedOptions | undefined | null) => string | Promise<string>;
|
|
655
655
|
export declare const parse: typeof marked;
|
|
656
656
|
export declare const parser: typeof _Parser.parse;
|
|
657
657
|
export declare const lexer: typeof _Lexer.lex;
|
package/lib/marked.d.ts
CHANGED
|
@@ -636,7 +636,7 @@ export declare namespace marked {
|
|
|
636
636
|
var defaults: MarkedOptions;
|
|
637
637
|
var use: (...args: MarkedExtension[]) => typeof marked;
|
|
638
638
|
var walkTokens: (tokens: Token[] | TokensList, callback: (token: Token) => MaybePromise | MaybePromise[]) => MaybePromise[];
|
|
639
|
-
var parseInline: (src: string, options?: MarkedOptions |
|
|
639
|
+
var parseInline: (src: string, options?: MarkedOptions | undefined | null) => string | Promise<string>;
|
|
640
640
|
var Parser: typeof _Parser;
|
|
641
641
|
var parser: typeof _Parser.parse;
|
|
642
642
|
var Renderer: typeof _Renderer;
|
|
@@ -651,7 +651,7 @@ export declare const options: (options: MarkedOptions) => typeof marked;
|
|
|
651
651
|
export declare const setOptions: (options: MarkedOptions) => typeof marked;
|
|
652
652
|
export declare const use: (...args: MarkedExtension[]) => typeof marked;
|
|
653
653
|
export declare const walkTokens: (tokens: Token[] | TokensList, callback: (token: Token) => MaybePromise | MaybePromise[]) => MaybePromise[];
|
|
654
|
-
export declare const parseInline: (src: string, options?: MarkedOptions |
|
|
654
|
+
export declare const parseInline: (src: string, options?: MarkedOptions | undefined | null) => string | Promise<string>;
|
|
655
655
|
export declare const parse: typeof marked;
|
|
656
656
|
export declare const parser: typeof _Parser.parse;
|
|
657
657
|
export declare const lexer: typeof _Lexer.lex;
|
package/lib/marked.esm.js
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
|
*/
|
|
@@ -23,7 +23,7 @@ function _getDefaults() {
|
|
|
23
23
|
renderer: null,
|
|
24
24
|
silent: false,
|
|
25
25
|
tokenizer: null,
|
|
26
|
-
walkTokens: null
|
|
26
|
+
walkTokens: null,
|
|
27
27
|
};
|
|
28
28
|
}
|
|
29
29
|
let _defaults = _getDefaults();
|
|
@@ -43,7 +43,7 @@ const escapeReplacements = {
|
|
|
43
43
|
'<': '<',
|
|
44
44
|
'>': '>',
|
|
45
45
|
'"': '"',
|
|
46
|
-
"'": '''
|
|
46
|
+
"'": ''',
|
|
47
47
|
};
|
|
48
48
|
const getEscapeReplacement = (ch) => escapeReplacements[ch];
|
|
49
49
|
function escape$1(html, encode) {
|
|
@@ -87,7 +87,7 @@ function edit(regex, opt) {
|
|
|
87
87
|
},
|
|
88
88
|
getRegex: () => {
|
|
89
89
|
return new RegExp(source, opt);
|
|
90
|
-
}
|
|
90
|
+
},
|
|
91
91
|
};
|
|
92
92
|
return obj;
|
|
93
93
|
}
|
|
@@ -95,7 +95,7 @@ function cleanUrl(href) {
|
|
|
95
95
|
try {
|
|
96
96
|
href = encodeURI(href).replace(/%25/g, '%');
|
|
97
97
|
}
|
|
98
|
-
catch
|
|
98
|
+
catch {
|
|
99
99
|
return null;
|
|
100
100
|
}
|
|
101
101
|
return href;
|
|
@@ -206,7 +206,7 @@ function outputLink(cap, link, raw, lexer) {
|
|
|
206
206
|
href,
|
|
207
207
|
title,
|
|
208
208
|
text,
|
|
209
|
-
tokens: lexer.inlineTokens(text)
|
|
209
|
+
tokens: lexer.inlineTokens(text),
|
|
210
210
|
};
|
|
211
211
|
lexer.state.inLink = false;
|
|
212
212
|
return token;
|
|
@@ -216,7 +216,7 @@ function outputLink(cap, link, raw, lexer) {
|
|
|
216
216
|
raw,
|
|
217
217
|
href,
|
|
218
218
|
title,
|
|
219
|
-
text: escape$1(text)
|
|
219
|
+
text: escape$1(text),
|
|
220
220
|
};
|
|
221
221
|
}
|
|
222
222
|
function indentCodeCompensation(raw, text) {
|
|
@@ -255,7 +255,7 @@ class _Tokenizer {
|
|
|
255
255
|
if (cap && cap[0].length > 0) {
|
|
256
256
|
return {
|
|
257
257
|
type: 'space',
|
|
258
|
-
raw: cap[0]
|
|
258
|
+
raw: cap[0],
|
|
259
259
|
};
|
|
260
260
|
}
|
|
261
261
|
}
|
|
@@ -269,7 +269,7 @@ class _Tokenizer {
|
|
|
269
269
|
codeBlockStyle: 'indented',
|
|
270
270
|
text: !this.options.pedantic
|
|
271
271
|
? rtrim(text, '\n')
|
|
272
|
-
: text
|
|
272
|
+
: text,
|
|
273
273
|
};
|
|
274
274
|
}
|
|
275
275
|
}
|
|
@@ -282,7 +282,7 @@ class _Tokenizer {
|
|
|
282
282
|
type: 'code',
|
|
283
283
|
raw,
|
|
284
284
|
lang: cap[2] ? cap[2].trim().replace(this.rules.inline.anyPunctuation, '$1') : cap[2],
|
|
285
|
-
text
|
|
285
|
+
text,
|
|
286
286
|
};
|
|
287
287
|
}
|
|
288
288
|
}
|
|
@@ -306,7 +306,7 @@ class _Tokenizer {
|
|
|
306
306
|
raw: cap[0],
|
|
307
307
|
depth: cap[1].length,
|
|
308
308
|
text,
|
|
309
|
-
tokens: this.lexer.inline(text)
|
|
309
|
+
tokens: this.lexer.inline(text),
|
|
310
310
|
};
|
|
311
311
|
}
|
|
312
312
|
}
|
|
@@ -315,7 +315,7 @@ class _Tokenizer {
|
|
|
315
315
|
if (cap) {
|
|
316
316
|
return {
|
|
317
317
|
type: 'hr',
|
|
318
|
-
raw: rtrim(cap[0], '\n')
|
|
318
|
+
raw: rtrim(cap[0], '\n'),
|
|
319
319
|
};
|
|
320
320
|
}
|
|
321
321
|
}
|
|
@@ -392,7 +392,7 @@ class _Tokenizer {
|
|
|
392
392
|
type: 'blockquote',
|
|
393
393
|
raw,
|
|
394
394
|
tokens,
|
|
395
|
-
text
|
|
395
|
+
text,
|
|
396
396
|
};
|
|
397
397
|
}
|
|
398
398
|
}
|
|
@@ -407,7 +407,7 @@ class _Tokenizer {
|
|
|
407
407
|
ordered: isordered,
|
|
408
408
|
start: isordered ? +bull.slice(0, -1) : '',
|
|
409
409
|
loose: false,
|
|
410
|
-
items: []
|
|
410
|
+
items: [],
|
|
411
411
|
};
|
|
412
412
|
bull = isordered ? `\\d{1,9}\\${bull.slice(-1)}` : `\\${bull}`;
|
|
413
413
|
if (this.options.pedantic) {
|
|
@@ -415,12 +415,12 @@ class _Tokenizer {
|
|
|
415
415
|
}
|
|
416
416
|
// Get next list item
|
|
417
417
|
const itemRegex = new RegExp(`^( {0,3}${bull})((?:[\t ][^\\n]*)?(?:\\n|$))`);
|
|
418
|
-
let raw = '';
|
|
419
|
-
let itemContents = '';
|
|
420
418
|
let endsWithBlankLine = false;
|
|
421
419
|
// Check if current bullet point can start a new List Item
|
|
422
420
|
while (src) {
|
|
423
421
|
let endEarly = false;
|
|
422
|
+
let raw = '';
|
|
423
|
+
let itemContents = '';
|
|
424
424
|
if (!(cap = itemRegex.exec(src))) {
|
|
425
425
|
break;
|
|
426
426
|
}
|
|
@@ -431,19 +431,22 @@ class _Tokenizer {
|
|
|
431
431
|
src = src.substring(raw.length);
|
|
432
432
|
let line = cap[2].split('\n', 1)[0].replace(/^\t+/, (t) => ' '.repeat(3 * t.length));
|
|
433
433
|
let nextLine = src.split('\n', 1)[0];
|
|
434
|
+
let blankLine = !line.trim();
|
|
434
435
|
let indent = 0;
|
|
435
436
|
if (this.options.pedantic) {
|
|
436
437
|
indent = 2;
|
|
437
438
|
itemContents = line.trimStart();
|
|
438
439
|
}
|
|
440
|
+
else if (blankLine) {
|
|
441
|
+
indent = cap[1].length + 1;
|
|
442
|
+
}
|
|
439
443
|
else {
|
|
440
444
|
indent = cap[2].search(/[^ ]/); // Find first non-space char
|
|
441
445
|
indent = indent > 4 ? 1 : indent; // Treat indented code blocks (> 4 spaces) as having only 1 indent
|
|
442
446
|
itemContents = line.slice(indent);
|
|
443
447
|
indent += cap[1].length;
|
|
444
448
|
}
|
|
445
|
-
|
|
446
|
-
if (!line && /^ *$/.test(nextLine)) { // Items begin with at most one blank line
|
|
449
|
+
if (blankLine && /^ *$/.test(nextLine)) { // Items begin with at most one blank line
|
|
447
450
|
raw += nextLine + '\n';
|
|
448
451
|
src = src.substring(nextLine.length + 1);
|
|
449
452
|
endEarly = true;
|
|
@@ -534,13 +537,13 @@ class _Tokenizer {
|
|
|
534
537
|
checked: ischecked,
|
|
535
538
|
loose: false,
|
|
536
539
|
text: itemContents,
|
|
537
|
-
tokens: []
|
|
540
|
+
tokens: [],
|
|
538
541
|
});
|
|
539
542
|
list.raw += raw;
|
|
540
543
|
}
|
|
541
544
|
// Do not consume newlines at end of final item. Alternatively, make itemRegex *start* with any newlines to simplify/speed up endsWithBlankLine logic
|
|
542
|
-
list.items[list.items.length - 1].raw = raw.trimEnd();
|
|
543
|
-
|
|
545
|
+
list.items[list.items.length - 1].raw = list.items[list.items.length - 1].raw.trimEnd();
|
|
546
|
+
list.items[list.items.length - 1].text = list.items[list.items.length - 1].text.trimEnd();
|
|
544
547
|
list.raw = list.raw.trimEnd();
|
|
545
548
|
// Item child tokens handled here at end because we needed to have the final item to trim it first
|
|
546
549
|
for (let i = 0; i < list.items.length; i++) {
|
|
@@ -570,7 +573,7 @@ class _Tokenizer {
|
|
|
570
573
|
block: true,
|
|
571
574
|
raw: cap[0],
|
|
572
575
|
pre: cap[1] === 'pre' || cap[1] === 'script' || cap[1] === 'style',
|
|
573
|
-
text: cap[0]
|
|
576
|
+
text: cap[0],
|
|
574
577
|
};
|
|
575
578
|
return token;
|
|
576
579
|
}
|
|
@@ -586,7 +589,7 @@ class _Tokenizer {
|
|
|
586
589
|
tag,
|
|
587
590
|
raw: cap[0],
|
|
588
591
|
href,
|
|
589
|
-
title
|
|
592
|
+
title,
|
|
590
593
|
};
|
|
591
594
|
}
|
|
592
595
|
}
|
|
@@ -607,7 +610,7 @@ class _Tokenizer {
|
|
|
607
610
|
raw: cap[0],
|
|
608
611
|
header: [],
|
|
609
612
|
align: [],
|
|
610
|
-
rows: []
|
|
613
|
+
rows: [],
|
|
611
614
|
};
|
|
612
615
|
if (headers.length !== aligns.length) {
|
|
613
616
|
// header and align columns must be equal, rows can be different.
|
|
@@ -632,7 +635,7 @@ class _Tokenizer {
|
|
|
632
635
|
text: headers[i],
|
|
633
636
|
tokens: this.lexer.inline(headers[i]),
|
|
634
637
|
header: true,
|
|
635
|
-
align: item.align[i]
|
|
638
|
+
align: item.align[i],
|
|
636
639
|
});
|
|
637
640
|
}
|
|
638
641
|
for (const row of rows) {
|
|
@@ -641,7 +644,7 @@ class _Tokenizer {
|
|
|
641
644
|
text: cell,
|
|
642
645
|
tokens: this.lexer.inline(cell),
|
|
643
646
|
header: false,
|
|
644
|
-
align: item.align[i]
|
|
647
|
+
align: item.align[i],
|
|
645
648
|
};
|
|
646
649
|
}));
|
|
647
650
|
}
|
|
@@ -655,7 +658,7 @@ class _Tokenizer {
|
|
|
655
658
|
raw: cap[0],
|
|
656
659
|
depth: cap[2].charAt(0) === '=' ? 1 : 2,
|
|
657
660
|
text: cap[1],
|
|
658
|
-
tokens: this.lexer.inline(cap[1])
|
|
661
|
+
tokens: this.lexer.inline(cap[1]),
|
|
659
662
|
};
|
|
660
663
|
}
|
|
661
664
|
}
|
|
@@ -669,7 +672,7 @@ class _Tokenizer {
|
|
|
669
672
|
type: 'paragraph',
|
|
670
673
|
raw: cap[0],
|
|
671
674
|
text,
|
|
672
|
-
tokens: this.lexer.inline(text)
|
|
675
|
+
tokens: this.lexer.inline(text),
|
|
673
676
|
};
|
|
674
677
|
}
|
|
675
678
|
}
|
|
@@ -680,7 +683,7 @@ class _Tokenizer {
|
|
|
680
683
|
type: 'text',
|
|
681
684
|
raw: cap[0],
|
|
682
685
|
text: cap[0],
|
|
683
|
-
tokens: this.lexer.inline(cap[0])
|
|
686
|
+
tokens: this.lexer.inline(cap[0]),
|
|
684
687
|
};
|
|
685
688
|
}
|
|
686
689
|
}
|
|
@@ -690,7 +693,7 @@ class _Tokenizer {
|
|
|
690
693
|
return {
|
|
691
694
|
type: 'escape',
|
|
692
695
|
raw: cap[0],
|
|
693
|
-
text: escape$1(cap[1])
|
|
696
|
+
text: escape$1(cap[1]),
|
|
694
697
|
};
|
|
695
698
|
}
|
|
696
699
|
}
|
|
@@ -715,7 +718,7 @@ class _Tokenizer {
|
|
|
715
718
|
inLink: this.lexer.state.inLink,
|
|
716
719
|
inRawBlock: this.lexer.state.inRawBlock,
|
|
717
720
|
block: false,
|
|
718
|
-
text: cap[0]
|
|
721
|
+
text: cap[0],
|
|
719
722
|
};
|
|
720
723
|
}
|
|
721
724
|
}
|
|
@@ -770,7 +773,7 @@ class _Tokenizer {
|
|
|
770
773
|
}
|
|
771
774
|
return outputLink(cap, {
|
|
772
775
|
href: href ? href.replace(this.rules.inline.anyPunctuation, '$1') : href,
|
|
773
|
-
title: title ? title.replace(this.rules.inline.anyPunctuation, '$1') : title
|
|
776
|
+
title: title ? title.replace(this.rules.inline.anyPunctuation, '$1') : title,
|
|
774
777
|
}, cap[0], this.lexer);
|
|
775
778
|
}
|
|
776
779
|
}
|
|
@@ -785,7 +788,7 @@ class _Tokenizer {
|
|
|
785
788
|
return {
|
|
786
789
|
type: 'text',
|
|
787
790
|
raw: text,
|
|
788
|
-
text
|
|
791
|
+
text,
|
|
789
792
|
};
|
|
790
793
|
}
|
|
791
794
|
return outputLink(cap, link, cap[0], this.lexer);
|
|
@@ -837,7 +840,7 @@ class _Tokenizer {
|
|
|
837
840
|
type: 'em',
|
|
838
841
|
raw,
|
|
839
842
|
text,
|
|
840
|
-
tokens: this.lexer.inlineTokens(text)
|
|
843
|
+
tokens: this.lexer.inlineTokens(text),
|
|
841
844
|
};
|
|
842
845
|
}
|
|
843
846
|
// Create 'strong' if smallest delimiter has even char count. **a***
|
|
@@ -846,7 +849,7 @@ class _Tokenizer {
|
|
|
846
849
|
type: 'strong',
|
|
847
850
|
raw,
|
|
848
851
|
text,
|
|
849
|
-
tokens: this.lexer.inlineTokens(text)
|
|
852
|
+
tokens: this.lexer.inlineTokens(text),
|
|
850
853
|
};
|
|
851
854
|
}
|
|
852
855
|
}
|
|
@@ -864,7 +867,7 @@ class _Tokenizer {
|
|
|
864
867
|
return {
|
|
865
868
|
type: 'codespan',
|
|
866
869
|
raw: cap[0],
|
|
867
|
-
text
|
|
870
|
+
text,
|
|
868
871
|
};
|
|
869
872
|
}
|
|
870
873
|
}
|
|
@@ -873,7 +876,7 @@ class _Tokenizer {
|
|
|
873
876
|
if (cap) {
|
|
874
877
|
return {
|
|
875
878
|
type: 'br',
|
|
876
|
-
raw: cap[0]
|
|
879
|
+
raw: cap[0],
|
|
877
880
|
};
|
|
878
881
|
}
|
|
879
882
|
}
|
|
@@ -884,7 +887,7 @@ class _Tokenizer {
|
|
|
884
887
|
type: 'del',
|
|
885
888
|
raw: cap[0],
|
|
886
889
|
text: cap[2],
|
|
887
|
-
tokens: this.lexer.inlineTokens(cap[2])
|
|
890
|
+
tokens: this.lexer.inlineTokens(cap[2]),
|
|
888
891
|
};
|
|
889
892
|
}
|
|
890
893
|
}
|
|
@@ -909,9 +912,9 @@ class _Tokenizer {
|
|
|
909
912
|
{
|
|
910
913
|
type: 'text',
|
|
911
914
|
raw: text,
|
|
912
|
-
text
|
|
913
|
-
}
|
|
914
|
-
]
|
|
915
|
+
text,
|
|
916
|
+
},
|
|
917
|
+
],
|
|
915
918
|
};
|
|
916
919
|
}
|
|
917
920
|
}
|
|
@@ -947,9 +950,9 @@ class _Tokenizer {
|
|
|
947
950
|
{
|
|
948
951
|
type: 'text',
|
|
949
952
|
raw: text,
|
|
950
|
-
text
|
|
951
|
-
}
|
|
952
|
-
]
|
|
953
|
+
text,
|
|
954
|
+
},
|
|
955
|
+
],
|
|
953
956
|
};
|
|
954
957
|
}
|
|
955
958
|
}
|
|
@@ -966,7 +969,7 @@ class _Tokenizer {
|
|
|
966
969
|
return {
|
|
967
970
|
type: 'text',
|
|
968
971
|
raw: cap[0],
|
|
969
|
-
text
|
|
972
|
+
text,
|
|
970
973
|
};
|
|
971
974
|
}
|
|
972
975
|
}
|
|
@@ -1050,7 +1053,7 @@ const blockNormal = {
|
|
|
1050
1053
|
newline,
|
|
1051
1054
|
paragraph,
|
|
1052
1055
|
table: noopTest,
|
|
1053
|
-
text: blockText
|
|
1056
|
+
text: blockText,
|
|
1054
1057
|
};
|
|
1055
1058
|
/**
|
|
1056
1059
|
* GFM Block Grammar
|
|
@@ -1080,7 +1083,7 @@ const blockGfm = {
|
|
|
1080
1083
|
.replace('list', ' {0,3}(?:[*+-]|1[.)]) ') // only lists starting from 1 can interrupt
|
|
1081
1084
|
.replace('html', '</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|textarea|!--)')
|
|
1082
1085
|
.replace('tag', _tag) // pars can be interrupted by type (6) html blocks
|
|
1083
|
-
.getRegex()
|
|
1086
|
+
.getRegex(),
|
|
1084
1087
|
};
|
|
1085
1088
|
/**
|
|
1086
1089
|
* Pedantic grammar (original John Gruber's loose markdown specification)
|
|
@@ -1110,7 +1113,7 @@ const blockPedantic = {
|
|
|
1110
1113
|
.replace('|list', '')
|
|
1111
1114
|
.replace('|html', '')
|
|
1112
1115
|
.replace('|tag', '')
|
|
1113
|
-
.getRegex()
|
|
1116
|
+
.getRegex(),
|
|
1114
1117
|
};
|
|
1115
1118
|
/**
|
|
1116
1119
|
* Inline-Level Grammar
|
|
@@ -1204,7 +1207,7 @@ const inlineNormal = {
|
|
|
1204
1207
|
reflinkSearch,
|
|
1205
1208
|
tag,
|
|
1206
1209
|
text: inlineText,
|
|
1207
|
-
url: noopTest
|
|
1210
|
+
url: noopTest,
|
|
1208
1211
|
};
|
|
1209
1212
|
/**
|
|
1210
1213
|
* Pedantic Inline Grammar
|
|
@@ -1216,7 +1219,7 @@ const inlinePedantic = {
|
|
|
1216
1219
|
.getRegex(),
|
|
1217
1220
|
reflink: edit(/^!?\[(label)\]\s*\[([^\]]*)\]/)
|
|
1218
1221
|
.replace('label', _inlineLabel)
|
|
1219
|
-
.getRegex()
|
|
1222
|
+
.getRegex(),
|
|
1220
1223
|
};
|
|
1221
1224
|
/**
|
|
1222
1225
|
* GFM Inline Grammar
|
|
@@ -1229,7 +1232,7 @@ const inlineGfm = {
|
|
|
1229
1232
|
.getRegex(),
|
|
1230
1233
|
_backpedal: /(?:[^?!.,:;*_'"~()&]+|\([^)]*\)|&(?![a-zA-Z0-9]+;$)|[?!.,:;*_'"~)]+(?!$))+/,
|
|
1231
1234
|
del: /^(~~?)(?=[^\s~])([\s\S]*?[^\s~])\1(?=[^~]|$)/,
|
|
1232
|
-
text: /^([`~]+|[^`~])(?:(?= {2,}\n)|(?=[a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-]+@)|[\s\S]*?(?:(?=[\\<!\[`*~_]|\b_|https?:\/\/|ftp:\/\/|www\.|$)|[^ ](?= {2,}\n)|[^a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-](?=[a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-]+@)))
|
|
1235
|
+
text: /^([`~]+|[^`~])(?:(?= {2,}\n)|(?=[a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-]+@)|[\s\S]*?(?:(?=[\\<!\[`*~_]|\b_|https?:\/\/|ftp:\/\/|www\.|$)|[^ ](?= {2,}\n)|[^a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-](?=[a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-]+@)))/,
|
|
1233
1236
|
};
|
|
1234
1237
|
/**
|
|
1235
1238
|
* GFM + Line Breaks Inline Grammar
|
|
@@ -1240,7 +1243,7 @@ const inlineBreaks = {
|
|
|
1240
1243
|
text: edit(inlineGfm.text)
|
|
1241
1244
|
.replace('\\b_', '\\b_| {2,}\\n')
|
|
1242
1245
|
.replace(/\{2,\}/g, '*')
|
|
1243
|
-
.getRegex()
|
|
1246
|
+
.getRegex(),
|
|
1244
1247
|
};
|
|
1245
1248
|
/**
|
|
1246
1249
|
* exports
|
|
@@ -1248,13 +1251,13 @@ const inlineBreaks = {
|
|
|
1248
1251
|
const block = {
|
|
1249
1252
|
normal: blockNormal,
|
|
1250
1253
|
gfm: blockGfm,
|
|
1251
|
-
pedantic: blockPedantic
|
|
1254
|
+
pedantic: blockPedantic,
|
|
1252
1255
|
};
|
|
1253
1256
|
const inline = {
|
|
1254
1257
|
normal: inlineNormal,
|
|
1255
1258
|
gfm: inlineGfm,
|
|
1256
1259
|
breaks: inlineBreaks,
|
|
1257
|
-
pedantic: inlinePedantic
|
|
1260
|
+
pedantic: inlinePedantic,
|
|
1258
1261
|
};
|
|
1259
1262
|
|
|
1260
1263
|
/**
|
|
@@ -1279,11 +1282,11 @@ class _Lexer {
|
|
|
1279
1282
|
this.state = {
|
|
1280
1283
|
inLink: false,
|
|
1281
1284
|
inRawBlock: false,
|
|
1282
|
-
top: true
|
|
1285
|
+
top: true,
|
|
1283
1286
|
};
|
|
1284
1287
|
const rules = {
|
|
1285
1288
|
block: block.normal,
|
|
1286
|
-
inline: inline.normal
|
|
1289
|
+
inline: inline.normal,
|
|
1287
1290
|
};
|
|
1288
1291
|
if (this.options.pedantic) {
|
|
1289
1292
|
rules.block = block.pedantic;
|
|
@@ -1306,7 +1309,7 @@ class _Lexer {
|
|
|
1306
1309
|
static get rules() {
|
|
1307
1310
|
return {
|
|
1308
1311
|
block,
|
|
1309
|
-
inline
|
|
1312
|
+
inline,
|
|
1310
1313
|
};
|
|
1311
1314
|
}
|
|
1312
1315
|
/**
|
|
@@ -1438,7 +1441,7 @@ class _Lexer {
|
|
|
1438
1441
|
else if (!this.tokens.links[token.tag]) {
|
|
1439
1442
|
this.tokens.links[token.tag] = {
|
|
1440
1443
|
href: token.href,
|
|
1441
|
-
title: token.title
|
|
1444
|
+
title: token.title,
|
|
1442
1445
|
};
|
|
1443
1446
|
}
|
|
1444
1447
|
continue;
|
|
@@ -1754,7 +1757,7 @@ class _Renderer {
|
|
|
1754
1757
|
item.tokens.unshift({
|
|
1755
1758
|
type: 'text',
|
|
1756
1759
|
raw: checkbox + ' ',
|
|
1757
|
-
text: checkbox + ' '
|
|
1760
|
+
text: checkbox + ' ',
|
|
1758
1761
|
});
|
|
1759
1762
|
}
|
|
1760
1763
|
}
|
|
@@ -1990,7 +1993,7 @@ class _Parser {
|
|
|
1990
1993
|
type: 'paragraph',
|
|
1991
1994
|
raw: body,
|
|
1992
1995
|
text: body,
|
|
1993
|
-
tokens: [{ type: 'text', raw: body, text: body }]
|
|
1996
|
+
tokens: [{ type: 'text', raw: body, text: body }],
|
|
1994
1997
|
});
|
|
1995
1998
|
}
|
|
1996
1999
|
else {
|
|
@@ -2094,7 +2097,7 @@ class _Hooks {
|
|
|
2094
2097
|
static passThroughHooks = new Set([
|
|
2095
2098
|
'preprocess',
|
|
2096
2099
|
'postprocess',
|
|
2097
|
-
'processAllTokens'
|
|
2100
|
+
'processAllTokens',
|
|
2098
2101
|
]);
|
|
2099
2102
|
/**
|
|
2100
2103
|
* Process markdown before marked
|
|
@@ -2249,13 +2252,13 @@ class Marked {
|
|
|
2249
2252
|
}
|
|
2250
2253
|
const rendererProp = prop;
|
|
2251
2254
|
let rendererFunc = pack.renderer[rendererProp];
|
|
2255
|
+
if (!pack.useNewRenderer) {
|
|
2256
|
+
// TODO: Remove this in next major version
|
|
2257
|
+
rendererFunc = this.#convertRendererFunction(rendererFunc, rendererProp, renderer);
|
|
2258
|
+
}
|
|
2252
2259
|
const prevRenderer = renderer[rendererProp];
|
|
2253
2260
|
// Replace renderer with func to run extension, but fall back if false
|
|
2254
2261
|
renderer[rendererProp] = (...args) => {
|
|
2255
|
-
if (!pack.useNewRenderer) {
|
|
2256
|
-
// TODO: Remove this in next major version
|
|
2257
|
-
rendererFunc = this.#convertRendererFunction(rendererFunc, rendererProp, renderer);
|
|
2258
|
-
}
|
|
2259
2262
|
let ret = rendererFunc.apply(renderer, args);
|
|
2260
2263
|
if (ret === false) {
|
|
2261
2264
|
ret = prevRenderer.apply(renderer, args);
|
|
@@ -2382,7 +2385,7 @@ class Marked {
|
|
|
2382
2385
|
text: token.header[j].text,
|
|
2383
2386
|
tokens: token.header[j].tokens,
|
|
2384
2387
|
header: true,
|
|
2385
|
-
align: token.align[j]
|
|
2388
|
+
align: token.align[j],
|
|
2386
2389
|
});
|
|
2387
2390
|
}
|
|
2388
2391
|
header += this.tablerow({ text: cell });
|
|
@@ -2395,7 +2398,7 @@ class Marked {
|
|
|
2395
2398
|
text: row[k].text,
|
|
2396
2399
|
tokens: row[k].tokens,
|
|
2397
2400
|
header: false,
|
|
2398
|
-
align: token.align[k]
|
|
2401
|
+
align: token.align[k],
|
|
2399
2402
|
});
|
|
2400
2403
|
}
|
|
2401
2404
|
body += this.tablerow({ text: cell });
|
|
@@ -2440,7 +2443,7 @@ class Marked {
|
|
|
2440
2443
|
else {
|
|
2441
2444
|
item.tokens.unshift({
|
|
2442
2445
|
type: 'text',
|
|
2443
|
-
text: checkbox + ' '
|
|
2446
|
+
text: checkbox + ' ',
|
|
2444
2447
|
});
|
|
2445
2448
|
}
|
|
2446
2449
|
}
|
|
@@ -2456,7 +2459,7 @@ class Marked {
|
|
|
2456
2459
|
task,
|
|
2457
2460
|
checked: !!checked,
|
|
2458
2461
|
loose,
|
|
2459
|
-
tokens: item.tokens
|
|
2462
|
+
tokens: item.tokens,
|
|
2460
2463
|
});
|
|
2461
2464
|
}
|
|
2462
2465
|
return func.call(this, body, ordered, start);
|