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.umd.js CHANGED
@@ -1,6 +1,6 @@
1
1
  /**
2
- * marked v15.0.4 - a markdown parser
3
- * Copyright (c) 2011-2024, Christopher Jeffrey. (MIT Licensed)
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 emStrongRDelimAst = edit('^[^_*]*?__[^_*]*?\\*[^_*]*?(?=__)' // Skip orphan inside strong
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)', 'gu') // (6) a***a can be either Left or Right Delimiter
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
- escape: edit(escape$1).replace('])', '~|])').getRegex(),
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
  }