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.esm.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
 
@@ -258,23 +258,37 @@ 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
- const emStrongLDelim = edit(/^(?:\*+(?:((?!\*)punct)|[^\s*]))|^_+(?:((?!_)punct)|([^\s_]))/, 'u')
267
+ const emStrongLDelimCore = /^(?:\*+(?:((?!\*)punct)|[^\s*]))|^_+(?:((?!_)punct)|([^\s_]))/;
268
+ const emStrongLDelim = edit(emStrongLDelimCore, 'u')
264
269
  .replace(/punct/g, _punctuation)
265
270
  .getRegex();
266
- const emStrongRDelimAst = edit('^[^_*]*?__[^_*]*?\\*[^_*]*?(?=__)' // Skip orphan inside strong
271
+ const emStrongLDelimGfm = edit(emStrongLDelimCore, 'u')
272
+ .replace(/punct/g, _punctuationGfmStrongEm)
273
+ .getRegex();
274
+ const emStrongRDelimAstCore = '^[^_*]*?__[^_*]*?\\*[^_*]*?(?=__)' // Skip orphan inside strong
267
275
  + '|[^*]+(?=[^*])' // Consume to delim
268
276
  + '|(?!\\*)punct(\\*+)(?=[\\s]|$)' // (1) #*** can only be a Right Delimiter
269
277
  + '|notPunctSpace(\\*+)(?!\\*)(?=punctSpace|$)' // (2) a***#, a*** can only be a Right Delimiter
270
278
  + '|(?!\\*)punctSpace(\\*+)(?=notPunctSpace)' // (3) #***a, ***a can only be Left Delimiter
271
279
  + '|[\\s](\\*+)(?!\\*)(?=punct)' // (4) ***# can only be Left Delimiter
272
280
  + '|(?!\\*)punct(\\*+)(?!\\*)(?=punct)' // (5) #***# can be either Left or Right Delimiter
273
- + '|notPunctSpace(\\*+)(?=notPunctSpace)', 'gu') // (6) a***a can be either Left or Right Delimiter
281
+ + '|notPunctSpace(\\*+)(?=notPunctSpace)'; // (6) a***a can be either Left or Right Delimiter
282
+ const emStrongRDelimAst = edit(emStrongRDelimAstCore, 'gu')
274
283
  .replace(/notPunctSpace/g, _notPunctuationOrSpace)
275
284
  .replace(/punctSpace/g, _punctuationOrSpace)
276
285
  .replace(/punct/g, _punctuation)
277
286
  .getRegex();
287
+ const emStrongRDelimAstGfm = edit(emStrongRDelimAstCore, 'gu')
288
+ .replace(/notPunctSpace/g, _notPunctuationOrSpaceGfmStrongEm)
289
+ .replace(/punctSpace/g, _punctuationOrSpaceGfmStrongEm)
290
+ .replace(/punct/g, _punctuationGfmStrongEm)
291
+ .getRegex();
278
292
  // (6) Not allowed for _
279
293
  const emStrongRDelimUnd = edit('^[^_*]*?\\*\\*[^_*]*?_[^_*]*?(?=\\*\\*)' // Skip orphan inside strong
280
294
  + '|[^_]+(?=[^_])' // Consume to delim
@@ -362,7 +376,8 @@ const inlinePedantic = {
362
376
  */
363
377
  const inlineGfm = {
364
378
  ...inlineNormal,
365
- escape: edit(escape$1).replace('])', '~|])').getRegex(),
379
+ emStrongRDelimAst: emStrongRDelimAstGfm,
380
+ emStrongLDelim: emStrongLDelimGfm,
366
381
  url: edit(/^((?:ftp|https?):\/\/|www\.)(?:[a-zA-Z0-9\-]+\.?)+[^\s<]*|^email/, 'i')
367
382
  .replace('email', /[A-Za-z0-9._+-]+(@)[a-zA-Z0-9-_]+(?:\.[a-zA-Z0-9-_]*[a-zA-Z0-9])+(?![-_])/)
368
383
  .getRegex(),
@@ -488,10 +503,7 @@ function rtrim(str, c, invert) {
488
503
  // Step left until we fail to match the invert condition.
489
504
  while (suffLen < l) {
490
505
  const currChar = str.charAt(l - suffLen - 1);
491
- if (currChar === c && !invert) {
492
- suffLen++;
493
- }
494
- else if (currChar !== c && invert) {
506
+ if (currChar === c && true) {
495
507
  suffLen++;
496
508
  }
497
509
  else {