marked 13.0.1 → 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 +10 -7
- 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 +10 -7
- package/lib/marked.esm.js.map +1 -1
- package/lib/marked.umd.js +10 -7
- 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++) {
|