marked 15.0.4 → 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 +15 -8
- package/lib/marked.cjs.map +1 -1
- package/lib/marked.esm.js +15 -8
- package/lib/marked.esm.js.map +1 -1
- package/lib/marked.umd.js +15 -8
- package/lib/marked.umd.js.map +1 -1
- package/man/marked.1 +1 -1
- package/marked.min.js +3 -3
- package/package.json +7 -7
package/lib/marked.esm.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
|
|
|
@@ -258,23 +258,33 @@ const _punctuationOrSpace = /[\s\p{P}\p{S}]/u;
|
|
|
258
258
|
const _notPunctuationOrSpace = /[^\s\p{P}\p{S}]/u;
|
|
259
259
|
const punctuation = edit(/^((?![*_])punctSpace)/, 'u')
|
|
260
260
|
.replace(/punctSpace/g, _punctuationOrSpace).getRegex();
|
|
261
|
+
// GFM allows ~ inside strong and em for strikethrough
|
|
262
|
+
const _punctuationGfmStrongEm = /(?!~)[\p{P}\p{S}]/u;
|
|
263
|
+
const _punctuationOrSpaceGfmStrongEm = /(?!~)[\s\p{P}\p{S}]/u;
|
|
264
|
+
const _notPunctuationOrSpaceGfmStrongEm = /(?:[^\s\p{P}\p{S}]|~)/u;
|
|
261
265
|
// sequences em should skip over [title](link), `code`, <html>
|
|
262
266
|
const blockSkip = /\[[^[\]]*?\]\((?:\\.|[^\\\(\)]|\((?:\\.|[^\\\(\)])*\))*\)|`[^`]*?`|<[^<>]*?>/g;
|
|
263
267
|
const emStrongLDelim = edit(/^(?:\*+(?:((?!\*)punct)|[^\s*]))|^_+(?:((?!_)punct)|([^\s_]))/, 'u')
|
|
264
268
|
.replace(/punct/g, _punctuation)
|
|
265
269
|
.getRegex();
|
|
266
|
-
const
|
|
270
|
+
const emStrongRDelimAstCore = '^[^_*]*?__[^_*]*?\\*[^_*]*?(?=__)' // Skip orphan inside strong
|
|
267
271
|
+ '|[^*]+(?=[^*])' // Consume to delim
|
|
268
272
|
+ '|(?!\\*)punct(\\*+)(?=[\\s]|$)' // (1) #*** can only be a Right Delimiter
|
|
269
273
|
+ '|notPunctSpace(\\*+)(?!\\*)(?=punctSpace|$)' // (2) a***#, a*** can only be a Right Delimiter
|
|
270
274
|
+ '|(?!\\*)punctSpace(\\*+)(?=notPunctSpace)' // (3) #***a, ***a can only be Left Delimiter
|
|
271
275
|
+ '|[\\s](\\*+)(?!\\*)(?=punct)' // (4) ***# can only be Left Delimiter
|
|
272
276
|
+ '|(?!\\*)punct(\\*+)(?!\\*)(?=punct)' // (5) #***# can be either Left or Right Delimiter
|
|
273
|
-
+ '|notPunctSpace(\\*+)(?=notPunctSpace)'
|
|
277
|
+
+ '|notPunctSpace(\\*+)(?=notPunctSpace)'; // (6) a***a can be either Left or Right Delimiter
|
|
278
|
+
const emStrongRDelimAst = edit(emStrongRDelimAstCore, 'gu')
|
|
274
279
|
.replace(/notPunctSpace/g, _notPunctuationOrSpace)
|
|
275
280
|
.replace(/punctSpace/g, _punctuationOrSpace)
|
|
276
281
|
.replace(/punct/g, _punctuation)
|
|
277
282
|
.getRegex();
|
|
283
|
+
const emStrongRDelimAstGfm = edit(emStrongRDelimAstCore, 'gu')
|
|
284
|
+
.replace(/notPunctSpace/g, _notPunctuationOrSpaceGfmStrongEm)
|
|
285
|
+
.replace(/punctSpace/g, _punctuationOrSpaceGfmStrongEm)
|
|
286
|
+
.replace(/punct/g, _punctuationGfmStrongEm)
|
|
287
|
+
.getRegex();
|
|
278
288
|
// (6) Not allowed for _
|
|
279
289
|
const emStrongRDelimUnd = edit('^[^_*]*?\\*\\*[^_*]*?_[^_*]*?(?=\\*\\*)' // Skip orphan inside strong
|
|
280
290
|
+ '|[^_]+(?=[^_])' // Consume to delim
|
|
@@ -362,7 +372,7 @@ const inlinePedantic = {
|
|
|
362
372
|
*/
|
|
363
373
|
const inlineGfm = {
|
|
364
374
|
...inlineNormal,
|
|
365
|
-
|
|
375
|
+
emStrongRDelimAst: emStrongRDelimAstGfm,
|
|
366
376
|
url: edit(/^((?:ftp|https?):\/\/|www\.)(?:[a-zA-Z0-9\-]+\.?)+[^\s<]*|^email/, 'i')
|
|
367
377
|
.replace('email', /[A-Za-z0-9._+-]+(@)[a-zA-Z0-9-_]+(?:\.[a-zA-Z0-9-_]*[a-zA-Z0-9])+(?![-_])/)
|
|
368
378
|
.getRegex(),
|
|
@@ -491,9 +501,6 @@ function rtrim(str, c, invert) {
|
|
|
491
501
|
if (currChar === c && !invert) {
|
|
492
502
|
suffLen++;
|
|
493
503
|
}
|
|
494
|
-
else if (currChar !== c && invert) {
|
|
495
|
-
suffLen++;
|
|
496
|
-
}
|
|
497
504
|
else {
|
|
498
505
|
break;
|
|
499
506
|
}
|