marked 15.0.5 → 15.0.7

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,5 +1,5 @@
1
1
  /**
2
- * marked v15.0.5 - a markdown parser
2
+ * marked v15.0.7 - a markdown parser
3
3
  * Copyright (c) 2011-2025, Christopher Jeffrey. (MIT Licensed)
4
4
  * https://github.com/markedjs/marked
5
5
  */
@@ -116,13 +116,24 @@ const fences = /^ {0,3}(`{3,}(?=[^`\n]*(?:\n|$))|~{3,})([^\n]*)(?:\n|$)(?:|([\s\
116
116
  const hr = /^ {0,3}((?:-[\t ]*){3,}|(?:_[ \t]*){3,}|(?:\*[ \t]*){3,})(?:\n+|$)/;
117
117
  const heading = /^ {0,3}(#{1,6})(?=\s|$)(.*)(?:\n+|$)/;
118
118
  const bullet = /(?:[*+-]|\d{1,9}[.)])/;
119
- const lheading = edit(/^(?!bull |blockCode|fences|blockquote|heading|html)((?:.|\n(?!\s*?\n|bull |blockCode|fences|blockquote|heading|html))+?)\n {0,3}(=+|-+) *(?:\n+|$)/)
119
+ const lheadingCore = /^(?!bull |blockCode|fences|blockquote|heading|html|table)((?:.|\n(?!\s*?\n|bull |blockCode|fences|blockquote|heading|html|table))+?)\n {0,3}(=+|-+) *(?:\n+|$)/;
120
+ const lheading = edit(lheadingCore)
120
121
  .replace(/bull/g, bullet) // lists can interrupt
121
122
  .replace(/blockCode/g, /(?: {4}| {0,3}\t)/) // indented code blocks can interrupt
122
123
  .replace(/fences/g, / {0,3}(?:`{3,}|~{3,})/) // fenced code blocks can interrupt
123
124
  .replace(/blockquote/g, / {0,3}>/) // blockquote can interrupt
124
125
  .replace(/heading/g, / {0,3}#{1,6}/) // ATX heading can interrupt
125
126
  .replace(/html/g, / {0,3}<[^\n>]+>\n/) // block html can interrupt
127
+ .replace(/\|table/g, '') // table not in commonmark
128
+ .getRegex();
129
+ const lheadingGfm = edit(lheadingCore)
130
+ .replace(/bull/g, bullet) // lists can interrupt
131
+ .replace(/blockCode/g, /(?: {4}| {0,3}\t)/) // indented code blocks can interrupt
132
+ .replace(/fences/g, / {0,3}(?:`{3,}|~{3,})/) // fenced code blocks can interrupt
133
+ .replace(/blockquote/g, / {0,3}>/) // blockquote can interrupt
134
+ .replace(/heading/g, / {0,3}#{1,6}/) // ATX heading can interrupt
135
+ .replace(/html/g, / {0,3}<[^\n>]+>\n/) // block html can interrupt
136
+ .replace(/table/g, / {0,3}\|?(?:[:\- ]*\|)+[\:\- ]*\n/) // table can interrupt
126
137
  .getRegex();
127
138
  const _paragraph = /^([^\n]+(?:\n(?!hr|heading|lheading|blockquote|fences|list|html|table| +\n)[^\n]+)*)/;
128
139
  const blockText = /^[^\n]+/;
@@ -204,6 +215,7 @@ const gfmTable = edit('^ *([^\\n ].*)\\n' // Header
204
215
  .getRegex();
205
216
  const blockGfm = {
206
217
  ...blockNormal,
218
+ lheading: lheadingGfm,
207
219
  table: gfmTable,
208
220
  paragraph: edit(_paragraph)
209
221
  .replace('hr', hr)
@@ -266,9 +278,13 @@ const _punctuationOrSpaceGfmStrongEm = /(?!~)[\s\p{P}\p{S}]/u;
266
278
  const _notPunctuationOrSpaceGfmStrongEm = /(?:[^\s\p{P}\p{S}]|~)/u;
267
279
  // sequences em should skip over [title](link), `code`, <html>
268
280
  const blockSkip = /\[[^[\]]*?\]\((?:\\.|[^\\\(\)]|\((?:\\.|[^\\\(\)])*\))*\)|`[^`]*?`|<[^<>]*?>/g;
269
- const emStrongLDelim = edit(/^(?:\*+(?:((?!\*)punct)|[^\s*]))|^_+(?:((?!_)punct)|([^\s_]))/, 'u')
281
+ const emStrongLDelimCore = /^(?:\*+(?:((?!\*)punct)|[^\s*]))|^_+(?:((?!_)punct)|([^\s_]))/;
282
+ const emStrongLDelim = edit(emStrongLDelimCore, 'u')
270
283
  .replace(/punct/g, _punctuation)
271
284
  .getRegex();
285
+ const emStrongLDelimGfm = edit(emStrongLDelimCore, 'u')
286
+ .replace(/punct/g, _punctuationGfmStrongEm)
287
+ .getRegex();
272
288
  const emStrongRDelimAstCore = '^[^_*]*?__[^_*]*?\\*[^_*]*?(?=__)' // Skip orphan inside strong
273
289
  + '|[^*]+(?=[^*])' // Consume to delim
274
290
  + '|(?!\\*)punct(\\*+)(?=[\\s]|$)' // (1) #*** can only be a Right Delimiter
@@ -375,6 +391,7 @@ const inlinePedantic = {
375
391
  const inlineGfm = {
376
392
  ...inlineNormal,
377
393
  emStrongRDelimAst: emStrongRDelimAstGfm,
394
+ emStrongLDelim: emStrongLDelimGfm,
378
395
  url: edit(/^((?:ftp|https?):\/\/|www\.)(?:[a-zA-Z0-9\-]+\.?)+[^\s<]*|^email/, 'i')
379
396
  .replace('email', /[A-Za-z0-9._+-]+(@)[a-zA-Z0-9-_]+(?:\.[a-zA-Z0-9-_]*[a-zA-Z0-9])+(?![-_])/)
380
397
  .getRegex(),
@@ -500,7 +517,7 @@ function rtrim(str, c, invert) {
500
517
  // Step left until we fail to match the invert condition.
501
518
  while (suffLen < l) {
502
519
  const currChar = str.charAt(l - suffLen - 1);
503
- if (currChar === c && !invert) {
520
+ if (currChar === c && true) {
504
521
  suffLen++;
505
522
  }
506
523
  else {