marked 15.0.3 → 15.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.cjs +19 -8
- package/lib/marked.cjs.map +1 -1
- package/lib/marked.esm.js +19 -8
- package/lib/marked.esm.js.map +1 -1
- package/lib/marked.umd.js +19 -8
- package/lib/marked.umd.js.map +1 -1
- package/man/marked.1 +1 -1
- package/marked.min.js +3 -3
- package/package.json +8 -8
package/lib/marked.cjs
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* marked v15.0.
|
|
3
|
-
* Copyright (c) 2011-
|
|
2
|
+
* marked v15.0.5 - a markdown parser
|
|
3
|
+
* Copyright (c) 2011-2025, Christopher Jeffrey. (MIT Licensed)
|
|
4
4
|
* https://github.com/markedjs/marked
|
|
5
5
|
*/
|
|
6
6
|
|
|
@@ -260,23 +260,33 @@ const _punctuationOrSpace = /[\s\p{P}\p{S}]/u;
|
|
|
260
260
|
const _notPunctuationOrSpace = /[^\s\p{P}\p{S}]/u;
|
|
261
261
|
const punctuation = edit(/^((?![*_])punctSpace)/, 'u')
|
|
262
262
|
.replace(/punctSpace/g, _punctuationOrSpace).getRegex();
|
|
263
|
+
// GFM allows ~ inside strong and em for strikethrough
|
|
264
|
+
const _punctuationGfmStrongEm = /(?!~)[\p{P}\p{S}]/u;
|
|
265
|
+
const _punctuationOrSpaceGfmStrongEm = /(?!~)[\s\p{P}\p{S}]/u;
|
|
266
|
+
const _notPunctuationOrSpaceGfmStrongEm = /(?:[^\s\p{P}\p{S}]|~)/u;
|
|
263
267
|
// sequences em should skip over [title](link), `code`, <html>
|
|
264
268
|
const blockSkip = /\[[^[\]]*?\]\((?:\\.|[^\\\(\)]|\((?:\\.|[^\\\(\)])*\))*\)|`[^`]*?`|<[^<>]*?>/g;
|
|
265
269
|
const emStrongLDelim = edit(/^(?:\*+(?:((?!\*)punct)|[^\s*]))|^_+(?:((?!_)punct)|([^\s_]))/, 'u')
|
|
266
270
|
.replace(/punct/g, _punctuation)
|
|
267
271
|
.getRegex();
|
|
268
|
-
const
|
|
272
|
+
const emStrongRDelimAstCore = '^[^_*]*?__[^_*]*?\\*[^_*]*?(?=__)' // Skip orphan inside strong
|
|
269
273
|
+ '|[^*]+(?=[^*])' // Consume to delim
|
|
270
274
|
+ '|(?!\\*)punct(\\*+)(?=[\\s]|$)' // (1) #*** can only be a Right Delimiter
|
|
271
275
|
+ '|notPunctSpace(\\*+)(?!\\*)(?=punctSpace|$)' // (2) a***#, a*** can only be a Right Delimiter
|
|
272
276
|
+ '|(?!\\*)punctSpace(\\*+)(?=notPunctSpace)' // (3) #***a, ***a can only be Left Delimiter
|
|
273
277
|
+ '|[\\s](\\*+)(?!\\*)(?=punct)' // (4) ***# can only be Left Delimiter
|
|
274
278
|
+ '|(?!\\*)punct(\\*+)(?!\\*)(?=punct)' // (5) #***# can be either Left or Right Delimiter
|
|
275
|
-
+ '|notPunctSpace(\\*+)(?=notPunctSpace)'
|
|
279
|
+
+ '|notPunctSpace(\\*+)(?=notPunctSpace)'; // (6) a***a can be either Left or Right Delimiter
|
|
280
|
+
const emStrongRDelimAst = edit(emStrongRDelimAstCore, 'gu')
|
|
276
281
|
.replace(/notPunctSpace/g, _notPunctuationOrSpace)
|
|
277
282
|
.replace(/punctSpace/g, _punctuationOrSpace)
|
|
278
283
|
.replace(/punct/g, _punctuation)
|
|
279
284
|
.getRegex();
|
|
285
|
+
const emStrongRDelimAstGfm = edit(emStrongRDelimAstCore, 'gu')
|
|
286
|
+
.replace(/notPunctSpace/g, _notPunctuationOrSpaceGfmStrongEm)
|
|
287
|
+
.replace(/punctSpace/g, _punctuationOrSpaceGfmStrongEm)
|
|
288
|
+
.replace(/punct/g, _punctuationGfmStrongEm)
|
|
289
|
+
.getRegex();
|
|
280
290
|
// (6) Not allowed for _
|
|
281
291
|
const emStrongRDelimUnd = edit('^[^_*]*?\\*\\*[^_*]*?_[^_*]*?(?=\\*\\*)' // Skip orphan inside strong
|
|
282
292
|
+ '|[^_]+(?=[^_])' // Consume to delim
|
|
@@ -364,7 +374,7 @@ const inlinePedantic = {
|
|
|
364
374
|
*/
|
|
365
375
|
const inlineGfm = {
|
|
366
376
|
...inlineNormal,
|
|
367
|
-
|
|
377
|
+
emStrongRDelimAst: emStrongRDelimAstGfm,
|
|
368
378
|
url: edit(/^((?:ftp|https?):\/\/|www\.)(?:[a-zA-Z0-9\-]+\.?)+[^\s<]*|^email/, 'i')
|
|
369
379
|
.replace('email', /[A-Za-z0-9._+-]+(@)[a-zA-Z0-9-_]+(?:\.[a-zA-Z0-9-_]*[a-zA-Z0-9])+(?![-_])/)
|
|
370
380
|
.getRegex(),
|
|
@@ -493,9 +503,6 @@ function rtrim(str, c, invert) {
|
|
|
493
503
|
if (currChar === c && !invert) {
|
|
494
504
|
suffLen++;
|
|
495
505
|
}
|
|
496
|
-
else if (currChar !== c && invert) {
|
|
497
|
-
suffLen++;
|
|
498
|
-
}
|
|
499
506
|
else {
|
|
500
507
|
break;
|
|
501
508
|
}
|
|
@@ -887,6 +894,10 @@ class _Tokenizer {
|
|
|
887
894
|
lastItem.raw = lastItem.raw.trimEnd();
|
|
888
895
|
lastItem.text = lastItem.text.trimEnd();
|
|
889
896
|
}
|
|
897
|
+
else {
|
|
898
|
+
// not a list since there were no items
|
|
899
|
+
return;
|
|
900
|
+
}
|
|
890
901
|
list.raw = list.raw.trimEnd();
|
|
891
902
|
// Item child tokens handled here at end because we needed to have the final item to trim it first
|
|
892
903
|
for (let i = 0; i < list.items.length; i++) {
|