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.cjs 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
 
@@ -260,23 +260,37 @@ const _punctuationOrSpace = /[\s\p{P}\p{S}]/u;
260
260
  const _notPunctuationOrSpace = /[^\s\p{P}\p{S}]/u;
261
261
  const punctuation = edit(/^((?![*_])punctSpace)/, 'u')
262
262
  .replace(/punctSpace/g, _punctuationOrSpace).getRegex();
263
+ // GFM allows ~ inside strong and em for strikethrough
264
+ const _punctuationGfmStrongEm = /(?!~)[\p{P}\p{S}]/u;
265
+ const _punctuationOrSpaceGfmStrongEm = /(?!~)[\s\p{P}\p{S}]/u;
266
+ const _notPunctuationOrSpaceGfmStrongEm = /(?:[^\s\p{P}\p{S}]|~)/u;
263
267
  // sequences em should skip over [title](link), `code`, <html>
264
268
  const blockSkip = /\[[^[\]]*?\]\((?:\\.|[^\\\(\)]|\((?:\\.|[^\\\(\)])*\))*\)|`[^`]*?`|<[^<>]*?>/g;
265
- const emStrongLDelim = edit(/^(?:\*+(?:((?!\*)punct)|[^\s*]))|^_+(?:((?!_)punct)|([^\s_]))/, 'u')
269
+ const emStrongLDelimCore = /^(?:\*+(?:((?!\*)punct)|[^\s*]))|^_+(?:((?!_)punct)|([^\s_]))/;
270
+ const emStrongLDelim = edit(emStrongLDelimCore, 'u')
266
271
  .replace(/punct/g, _punctuation)
267
272
  .getRegex();
268
- const emStrongRDelimAst = edit('^[^_*]*?__[^_*]*?\\*[^_*]*?(?=__)' // Skip orphan inside strong
273
+ const emStrongLDelimGfm = edit(emStrongLDelimCore, 'u')
274
+ .replace(/punct/g, _punctuationGfmStrongEm)
275
+ .getRegex();
276
+ const emStrongRDelimAstCore = '^[^_*]*?__[^_*]*?\\*[^_*]*?(?=__)' // Skip orphan inside strong
269
277
  + '|[^*]+(?=[^*])' // Consume to delim
270
278
  + '|(?!\\*)punct(\\*+)(?=[\\s]|$)' // (1) #*** can only be a Right Delimiter
271
279
  + '|notPunctSpace(\\*+)(?!\\*)(?=punctSpace|$)' // (2) a***#, a*** can only be a Right Delimiter
272
280
  + '|(?!\\*)punctSpace(\\*+)(?=notPunctSpace)' // (3) #***a, ***a can only be Left Delimiter
273
281
  + '|[\\s](\\*+)(?!\\*)(?=punct)' // (4) ***# can only be Left Delimiter
274
282
  + '|(?!\\*)punct(\\*+)(?!\\*)(?=punct)' // (5) #***# can be either Left or Right Delimiter
275
- + '|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')
276
285
  .replace(/notPunctSpace/g, _notPunctuationOrSpace)
277
286
  .replace(/punctSpace/g, _punctuationOrSpace)
278
287
  .replace(/punct/g, _punctuation)
279
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();
280
294
  // (6) Not allowed for _
281
295
  const emStrongRDelimUnd = edit('^[^_*]*?\\*\\*[^_*]*?_[^_*]*?(?=\\*\\*)' // Skip orphan inside strong
282
296
  + '|[^_]+(?=[^_])' // Consume to delim
@@ -364,7 +378,8 @@ const inlinePedantic = {
364
378
  */
365
379
  const inlineGfm = {
366
380
  ...inlineNormal,
367
- escape: edit(escape$1).replace('])', '~|])').getRegex(),
381
+ emStrongRDelimAst: emStrongRDelimAstGfm,
382
+ emStrongLDelim: emStrongLDelimGfm,
368
383
  url: edit(/^((?:ftp|https?):\/\/|www\.)(?:[a-zA-Z0-9\-]+\.?)+[^\s<]*|^email/, 'i')
369
384
  .replace('email', /[A-Za-z0-9._+-]+(@)[a-zA-Z0-9-_]+(?:\.[a-zA-Z0-9-_]*[a-zA-Z0-9])+(?![-_])/)
370
385
  .getRegex(),
@@ -490,10 +505,7 @@ function rtrim(str, c, invert) {
490
505
  // Step left until we fail to match the invert condition.
491
506
  while (suffLen < l) {
492
507
  const currChar = str.charAt(l - suffLen - 1);
493
- if (currChar === c && !invert) {
494
- suffLen++;
495
- }
496
- else if (currChar !== c && invert) {
508
+ if (currChar === c && true) {
497
509
  suffLen++;
498
510
  }
499
511
  else {