marked 13.0.0 → 13.0.2
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.cjs +25 -22
- package/lib/marked.cjs.map +1 -1
- package/lib/marked.d.cts +5 -5
- package/lib/marked.d.ts +5 -5
- package/lib/marked.esm.js +25 -22
- package/lib/marked.esm.js.map +1 -1
- package/lib/marked.umd.js +25 -22
- package/lib/marked.umd.js.map +1 -1
- package/man/marked.1 +1 -1
- package/marked.min.js +2 -2
- package/package.json +11 -8
package/lib/marked.umd.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* marked v13.0.
|
|
2
|
+
* marked v13.0.2 - a markdown parser
|
|
3
3
|
* Copyright (c) 2011-2024, Christopher Jeffrey. (MIT Licensed)
|
|
4
4
|
* https://github.com/markedjs/marked
|
|
5
5
|
*/
|
|
@@ -421,12 +421,12 @@
|
|
|
421
421
|
}
|
|
422
422
|
// Get next list item
|
|
423
423
|
const itemRegex = new RegExp(`^( {0,3}${bull})((?:[\t ][^\\n]*)?(?:\\n|$))`);
|
|
424
|
-
let raw = '';
|
|
425
|
-
let itemContents = '';
|
|
426
424
|
let endsWithBlankLine = false;
|
|
427
425
|
// Check if current bullet point can start a new List Item
|
|
428
426
|
while (src) {
|
|
429
427
|
let endEarly = false;
|
|
428
|
+
let raw = '';
|
|
429
|
+
let itemContents = '';
|
|
430
430
|
if (!(cap = itemRegex.exec(src))) {
|
|
431
431
|
break;
|
|
432
432
|
}
|
|
@@ -437,19 +437,22 @@
|
|
|
437
437
|
src = src.substring(raw.length);
|
|
438
438
|
let line = cap[2].split('\n', 1)[0].replace(/^\t+/, (t) => ' '.repeat(3 * t.length));
|
|
439
439
|
let nextLine = src.split('\n', 1)[0];
|
|
440
|
+
let blankLine = !line.trim();
|
|
440
441
|
let indent = 0;
|
|
441
442
|
if (this.options.pedantic) {
|
|
442
443
|
indent = 2;
|
|
443
444
|
itemContents = line.trimStart();
|
|
444
445
|
}
|
|
446
|
+
else if (blankLine) {
|
|
447
|
+
indent = cap[1].length + 1;
|
|
448
|
+
}
|
|
445
449
|
else {
|
|
446
450
|
indent = cap[2].search(/[^ ]/); // Find first non-space char
|
|
447
451
|
indent = indent > 4 ? 1 : indent; // Treat indented code blocks (> 4 spaces) as having only 1 indent
|
|
448
452
|
itemContents = line.slice(indent);
|
|
449
453
|
indent += cap[1].length;
|
|
450
454
|
}
|
|
451
|
-
|
|
452
|
-
if (!line && /^ *$/.test(nextLine)) { // Items begin with at most one blank line
|
|
455
|
+
if (blankLine && /^ *$/.test(nextLine)) { // Items begin with at most one blank line
|
|
453
456
|
raw += nextLine + '\n';
|
|
454
457
|
src = src.substring(nextLine.length + 1);
|
|
455
458
|
endEarly = true;
|
|
@@ -545,8 +548,8 @@
|
|
|
545
548
|
list.raw += raw;
|
|
546
549
|
}
|
|
547
550
|
// Do not consume newlines at end of final item. Alternatively, make itemRegex *start* with any newlines to simplify/speed up endsWithBlankLine logic
|
|
548
|
-
list.items[list.items.length - 1].raw = raw.trimEnd();
|
|
549
|
-
|
|
551
|
+
list.items[list.items.length - 1].raw = list.items[list.items.length - 1].raw.trimEnd();
|
|
552
|
+
list.items[list.items.length - 1].text = list.items[list.items.length - 1].text.trimEnd();
|
|
550
553
|
list.raw = list.raw.trimEnd();
|
|
551
554
|
// Item child tokens handled here at end because we needed to have the final item to trim it first
|
|
552
555
|
for (let i = 0; i < list.items.length; i++) {
|
|
@@ -2362,7 +2365,7 @@
|
|
|
2362
2365
|
// eslint-disable-next-line prefer-rest-params
|
|
2363
2366
|
return func.apply(this, arguments);
|
|
2364
2367
|
}
|
|
2365
|
-
return func(renderer.parser.parseInline(token.tokens), token.depth, unescape(renderer.parser.parseInline(token.tokens, renderer.parser.textRenderer)));
|
|
2368
|
+
return func.call(this, renderer.parser.parseInline(token.tokens), token.depth, unescape(renderer.parser.parseInline(token.tokens, renderer.parser.textRenderer)));
|
|
2366
2369
|
};
|
|
2367
2370
|
case 'code':
|
|
2368
2371
|
return function (token) {
|
|
@@ -2371,7 +2374,7 @@
|
|
|
2371
2374
|
// eslint-disable-next-line prefer-rest-params
|
|
2372
2375
|
return func.apply(this, arguments);
|
|
2373
2376
|
}
|
|
2374
|
-
return func(token.text, token.lang, !!token.escaped);
|
|
2377
|
+
return func.call(this, token.text, token.lang, !!token.escaped);
|
|
2375
2378
|
};
|
|
2376
2379
|
case 'table':
|
|
2377
2380
|
return function (token) {
|
|
@@ -2406,7 +2409,7 @@
|
|
|
2406
2409
|
}
|
|
2407
2410
|
body += this.tablerow({ text: cell });
|
|
2408
2411
|
}
|
|
2409
|
-
return func(header, body);
|
|
2412
|
+
return func.call(this, header, body);
|
|
2410
2413
|
};
|
|
2411
2414
|
case 'blockquote':
|
|
2412
2415
|
return function (token) {
|
|
@@ -2416,7 +2419,7 @@
|
|
|
2416
2419
|
return func.apply(this, arguments);
|
|
2417
2420
|
}
|
|
2418
2421
|
const body = this.parser.parse(token.tokens);
|
|
2419
|
-
return func(body);
|
|
2422
|
+
return func.call(this, body);
|
|
2420
2423
|
};
|
|
2421
2424
|
case 'list':
|
|
2422
2425
|
return function (token) {
|
|
@@ -2465,7 +2468,7 @@
|
|
|
2465
2468
|
tokens: item.tokens
|
|
2466
2469
|
});
|
|
2467
2470
|
}
|
|
2468
|
-
return func(body, ordered, start);
|
|
2471
|
+
return func.call(this, body, ordered, start);
|
|
2469
2472
|
};
|
|
2470
2473
|
case 'html':
|
|
2471
2474
|
return function (token) {
|
|
@@ -2474,7 +2477,7 @@
|
|
|
2474
2477
|
// eslint-disable-next-line prefer-rest-params
|
|
2475
2478
|
return func.apply(this, arguments);
|
|
2476
2479
|
}
|
|
2477
|
-
return func(token.text, token.block);
|
|
2480
|
+
return func.call(this, token.text, token.block);
|
|
2478
2481
|
};
|
|
2479
2482
|
case 'paragraph':
|
|
2480
2483
|
return function (token) {
|
|
@@ -2483,7 +2486,7 @@
|
|
|
2483
2486
|
// eslint-disable-next-line prefer-rest-params
|
|
2484
2487
|
return func.apply(this, arguments);
|
|
2485
2488
|
}
|
|
2486
|
-
return func(this.parser.parseInline(token.tokens));
|
|
2489
|
+
return func.call(this, this.parser.parseInline(token.tokens));
|
|
2487
2490
|
};
|
|
2488
2491
|
case 'escape':
|
|
2489
2492
|
return function (token) {
|
|
@@ -2492,7 +2495,7 @@
|
|
|
2492
2495
|
// eslint-disable-next-line prefer-rest-params
|
|
2493
2496
|
return func.apply(this, arguments);
|
|
2494
2497
|
}
|
|
2495
|
-
return func(token.text);
|
|
2498
|
+
return func.call(this, token.text);
|
|
2496
2499
|
};
|
|
2497
2500
|
case 'link':
|
|
2498
2501
|
return function (token) {
|
|
@@ -2501,7 +2504,7 @@
|
|
|
2501
2504
|
// eslint-disable-next-line prefer-rest-params
|
|
2502
2505
|
return func.apply(this, arguments);
|
|
2503
2506
|
}
|
|
2504
|
-
return func(token.href, token.title, this.parser.parseInline(token.tokens));
|
|
2507
|
+
return func.call(this, token.href, token.title, this.parser.parseInline(token.tokens));
|
|
2505
2508
|
};
|
|
2506
2509
|
case 'image':
|
|
2507
2510
|
return function (token) {
|
|
@@ -2510,7 +2513,7 @@
|
|
|
2510
2513
|
// eslint-disable-next-line prefer-rest-params
|
|
2511
2514
|
return func.apply(this, arguments);
|
|
2512
2515
|
}
|
|
2513
|
-
return func(token.href, token.title, token.text);
|
|
2516
|
+
return func.call(this, token.href, token.title, token.text);
|
|
2514
2517
|
};
|
|
2515
2518
|
case 'strong':
|
|
2516
2519
|
return function (token) {
|
|
@@ -2519,7 +2522,7 @@
|
|
|
2519
2522
|
// eslint-disable-next-line prefer-rest-params
|
|
2520
2523
|
return func.apply(this, arguments);
|
|
2521
2524
|
}
|
|
2522
|
-
return func(this.parser.parseInline(token.tokens));
|
|
2525
|
+
return func.call(this, this.parser.parseInline(token.tokens));
|
|
2523
2526
|
};
|
|
2524
2527
|
case 'em':
|
|
2525
2528
|
return function (token) {
|
|
@@ -2528,7 +2531,7 @@
|
|
|
2528
2531
|
// eslint-disable-next-line prefer-rest-params
|
|
2529
2532
|
return func.apply(this, arguments);
|
|
2530
2533
|
}
|
|
2531
|
-
return func(this.parser.parseInline(token.tokens));
|
|
2534
|
+
return func.call(this, this.parser.parseInline(token.tokens));
|
|
2532
2535
|
};
|
|
2533
2536
|
case 'codespan':
|
|
2534
2537
|
return function (token) {
|
|
@@ -2537,7 +2540,7 @@
|
|
|
2537
2540
|
// eslint-disable-next-line prefer-rest-params
|
|
2538
2541
|
return func.apply(this, arguments);
|
|
2539
2542
|
}
|
|
2540
|
-
return func(token.text);
|
|
2543
|
+
return func.call(this, token.text);
|
|
2541
2544
|
};
|
|
2542
2545
|
case 'del':
|
|
2543
2546
|
return function (token) {
|
|
@@ -2546,7 +2549,7 @@
|
|
|
2546
2549
|
// eslint-disable-next-line prefer-rest-params
|
|
2547
2550
|
return func.apply(this, arguments);
|
|
2548
2551
|
}
|
|
2549
|
-
return func(this.parser.parseInline(token.tokens));
|
|
2552
|
+
return func.call(this, this.parser.parseInline(token.tokens));
|
|
2550
2553
|
};
|
|
2551
2554
|
case 'text':
|
|
2552
2555
|
return function (token) {
|
|
@@ -2555,7 +2558,7 @@
|
|
|
2555
2558
|
// eslint-disable-next-line prefer-rest-params
|
|
2556
2559
|
return func.apply(this, arguments);
|
|
2557
2560
|
}
|
|
2558
|
-
return func(token.text);
|
|
2561
|
+
return func.call(this, token.text);
|
|
2559
2562
|
};
|
|
2560
2563
|
// do nothing
|
|
2561
2564
|
}
|