marked 15.0.4 → 15.0.6

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.6 - 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,37 @@
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
- const emStrongLDelim = edit(/^(?:\*+(?:((?!\*)punct)|[^\s*]))|^_+(?:((?!_)punct)|([^\s_]))/, 'u')
273
+ const emStrongLDelimCore = /^(?:\*+(?:((?!\*)punct)|[^\s*]))|^_+(?:((?!_)punct)|([^\s_]))/;
274
+ const emStrongLDelim = edit(emStrongLDelimCore, 'u')
270
275
  .replace(/punct/g, _punctuation)
271
276
  .getRegex();
272
- const emStrongRDelimAst = edit('^[^_*]*?__[^_*]*?\\*[^_*]*?(?=__)' // Skip orphan inside strong
277
+ const emStrongLDelimGfm = edit(emStrongLDelimCore, 'u')
278
+ .replace(/punct/g, _punctuationGfmStrongEm)
279
+ .getRegex();
280
+ const emStrongRDelimAstCore = '^[^_*]*?__[^_*]*?\\*[^_*]*?(?=__)' // Skip orphan inside strong
273
281
  + '|[^*]+(?=[^*])' // Consume to delim
274
282
  + '|(?!\\*)punct(\\*+)(?=[\\s]|$)' // (1) #*** can only be a Right Delimiter
275
283
  + '|notPunctSpace(\\*+)(?!\\*)(?=punctSpace|$)' // (2) a***#, a*** can only be a Right Delimiter
276
284
  + '|(?!\\*)punctSpace(\\*+)(?=notPunctSpace)' // (3) #***a, ***a can only be Left Delimiter
277
285
  + '|[\\s](\\*+)(?!\\*)(?=punct)' // (4) ***# can only be Left Delimiter
278
286
  + '|(?!\\*)punct(\\*+)(?!\\*)(?=punct)' // (5) #***# can be either Left or Right Delimiter
279
- + '|notPunctSpace(\\*+)(?=notPunctSpace)', 'gu') // (6) a***a can be either Left or Right Delimiter
287
+ + '|notPunctSpace(\\*+)(?=notPunctSpace)'; // (6) a***a can be either Left or Right Delimiter
288
+ const emStrongRDelimAst = edit(emStrongRDelimAstCore, 'gu')
280
289
  .replace(/notPunctSpace/g, _notPunctuationOrSpace)
281
290
  .replace(/punctSpace/g, _punctuationOrSpace)
282
291
  .replace(/punct/g, _punctuation)
283
292
  .getRegex();
293
+ const emStrongRDelimAstGfm = edit(emStrongRDelimAstCore, 'gu')
294
+ .replace(/notPunctSpace/g, _notPunctuationOrSpaceGfmStrongEm)
295
+ .replace(/punctSpace/g, _punctuationOrSpaceGfmStrongEm)
296
+ .replace(/punct/g, _punctuationGfmStrongEm)
297
+ .getRegex();
284
298
  // (6) Not allowed for _
285
299
  const emStrongRDelimUnd = edit('^[^_*]*?\\*\\*[^_*]*?_[^_*]*?(?=\\*\\*)' // Skip orphan inside strong
286
300
  + '|[^_]+(?=[^_])' // Consume to delim
@@ -368,7 +382,8 @@
368
382
  */
369
383
  const inlineGfm = {
370
384
  ...inlineNormal,
371
- escape: edit(escape$1).replace('])', '~|])').getRegex(),
385
+ emStrongRDelimAst: emStrongRDelimAstGfm,
386
+ emStrongLDelim: emStrongLDelimGfm,
372
387
  url: edit(/^((?:ftp|https?):\/\/|www\.)(?:[a-zA-Z0-9\-]+\.?)+[^\s<]*|^email/, 'i')
373
388
  .replace('email', /[A-Za-z0-9._+-]+(@)[a-zA-Z0-9-_]+(?:\.[a-zA-Z0-9-_]*[a-zA-Z0-9])+(?![-_])/)
374
389
  .getRegex(),
@@ -494,10 +509,7 @@
494
509
  // Step left until we fail to match the invert condition.
495
510
  while (suffLen < l) {
496
511
  const currChar = str.charAt(l - suffLen - 1);
497
- if (currChar === c && !invert) {
498
- suffLen++;
499
- }
500
- else if (currChar !== c && invert) {
512
+ if (currChar === c && true) {
501
513
  suffLen++;
502
514
  }
503
515
  else {