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.umd.js
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
|
|
|
@@ -264,23 +264,33 @@
|
|
|
264
264
|
const _notPunctuationOrSpace = /[^\s\p{P}\p{S}]/u;
|
|
265
265
|
const punctuation = edit(/^((?![*_])punctSpace)/, 'u')
|
|
266
266
|
.replace(/punctSpace/g, _punctuationOrSpace).getRegex();
|
|
267
|
+
// GFM allows ~ inside strong and em for strikethrough
|
|
268
|
+
const _punctuationGfmStrongEm = /(?!~)[\p{P}\p{S}]/u;
|
|
269
|
+
const _punctuationOrSpaceGfmStrongEm = /(?!~)[\s\p{P}\p{S}]/u;
|
|
270
|
+
const _notPunctuationOrSpaceGfmStrongEm = /(?:[^\s\p{P}\p{S}]|~)/u;
|
|
267
271
|
// sequences em should skip over [title](link), `code`, <html>
|
|
268
272
|
const blockSkip = /\[[^[\]]*?\]\((?:\\.|[^\\\(\)]|\((?:\\.|[^\\\(\)])*\))*\)|`[^`]*?`|<[^<>]*?>/g;
|
|
269
273
|
const emStrongLDelim = edit(/^(?:\*+(?:((?!\*)punct)|[^\s*]))|^_+(?:((?!_)punct)|([^\s_]))/, 'u')
|
|
270
274
|
.replace(/punct/g, _punctuation)
|
|
271
275
|
.getRegex();
|
|
272
|
-
const
|
|
276
|
+
const emStrongRDelimAstCore = '^[^_*]*?__[^_*]*?\\*[^_*]*?(?=__)' // Skip orphan inside strong
|
|
273
277
|
+ '|[^*]+(?=[^*])' // Consume to delim
|
|
274
278
|
+ '|(?!\\*)punct(\\*+)(?=[\\s]|$)' // (1) #*** can only be a Right Delimiter
|
|
275
279
|
+ '|notPunctSpace(\\*+)(?!\\*)(?=punctSpace|$)' // (2) a***#, a*** can only be a Right Delimiter
|
|
276
280
|
+ '|(?!\\*)punctSpace(\\*+)(?=notPunctSpace)' // (3) #***a, ***a can only be Left Delimiter
|
|
277
281
|
+ '|[\\s](\\*+)(?!\\*)(?=punct)' // (4) ***# can only be Left Delimiter
|
|
278
282
|
+ '|(?!\\*)punct(\\*+)(?!\\*)(?=punct)' // (5) #***# can be either Left or Right Delimiter
|
|
279
|
-
+ '|notPunctSpace(\\*+)(?=notPunctSpace)'
|
|
283
|
+
+ '|notPunctSpace(\\*+)(?=notPunctSpace)'; // (6) a***a can be either Left or Right Delimiter
|
|
284
|
+
const emStrongRDelimAst = edit(emStrongRDelimAstCore, 'gu')
|
|
280
285
|
.replace(/notPunctSpace/g, _notPunctuationOrSpace)
|
|
281
286
|
.replace(/punctSpace/g, _punctuationOrSpace)
|
|
282
287
|
.replace(/punct/g, _punctuation)
|
|
283
288
|
.getRegex();
|
|
289
|
+
const emStrongRDelimAstGfm = edit(emStrongRDelimAstCore, 'gu')
|
|
290
|
+
.replace(/notPunctSpace/g, _notPunctuationOrSpaceGfmStrongEm)
|
|
291
|
+
.replace(/punctSpace/g, _punctuationOrSpaceGfmStrongEm)
|
|
292
|
+
.replace(/punct/g, _punctuationGfmStrongEm)
|
|
293
|
+
.getRegex();
|
|
284
294
|
// (6) Not allowed for _
|
|
285
295
|
const emStrongRDelimUnd = edit('^[^_*]*?\\*\\*[^_*]*?_[^_*]*?(?=\\*\\*)' // Skip orphan inside strong
|
|
286
296
|
+ '|[^_]+(?=[^_])' // Consume to delim
|
|
@@ -368,7 +378,7 @@
|
|
|
368
378
|
*/
|
|
369
379
|
const inlineGfm = {
|
|
370
380
|
...inlineNormal,
|
|
371
|
-
|
|
381
|
+
emStrongRDelimAst: emStrongRDelimAstGfm,
|
|
372
382
|
url: edit(/^((?:ftp|https?):\/\/|www\.)(?:[a-zA-Z0-9\-]+\.?)+[^\s<]*|^email/, 'i')
|
|
373
383
|
.replace('email', /[A-Za-z0-9._+-]+(@)[a-zA-Z0-9-_]+(?:\.[a-zA-Z0-9-_]*[a-zA-Z0-9])+(?![-_])/)
|
|
374
384
|
.getRegex(),
|
|
@@ -497,9 +507,6 @@
|
|
|
497
507
|
if (currChar === c && !invert) {
|
|
498
508
|
suffLen++;
|
|
499
509
|
}
|
|
500
|
-
else if (currChar !== c && invert) {
|
|
501
|
-
suffLen++;
|
|
502
|
-
}
|
|
503
510
|
else {
|
|
504
511
|
break;
|
|
505
512
|
}
|
|
@@ -891,6 +898,10 @@
|
|
|
891
898
|
lastItem.raw = lastItem.raw.trimEnd();
|
|
892
899
|
lastItem.text = lastItem.text.trimEnd();
|
|
893
900
|
}
|
|
901
|
+
else {
|
|
902
|
+
// not a list since there were no items
|
|
903
|
+
return;
|
|
904
|
+
}
|
|
894
905
|
list.raw = list.raw.trimEnd();
|
|
895
906
|
// Item child tokens handled here at end because we needed to have the final item to trim it first
|
|
896
907
|
for (let i = 0; i < list.items.length; i++) {
|