marked 15.0.1 → 15.0.3

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.1 - a markdown parser
2
+ * marked v15.0.3 - a markdown parser
3
3
  * Copyright (c) 2011-2024, Christopher Jeffrey. (MIT Licensed)
4
4
  * https://github.com/markedjs/marked
5
5
  */
@@ -255,35 +255,41 @@ const inlineCode = /^(`+)([^`]|[^`][\s\S]*?[^`])\1(?!`)/;
255
255
  const br = /^( {2,}|\\)\n(?!\s*$)/;
256
256
  const inlineText = /^(`+|[^`])(?:(?= {2,}\n)|[\s\S]*?(?:(?=[\\<!\[`*_]|\b_|$)|[^ ](?= {2,}\n)))/;
257
257
  // list of unicode punctuation marks, plus any missing characters from CommonMark spec
258
- const _punctuation = '\\p{P}\\p{S}';
259
- const punctuation = edit(/^((?![*_])[\spunctuation])/, 'u')
260
- .replace(/punctuation/g, _punctuation).getRegex();
258
+ const _punctuation = /[\p{P}\p{S}]/u;
259
+ const _punctuationOrSpace = /[\s\p{P}\p{S}]/u;
260
+ const _notPunctuationOrSpace = /[^\s\p{P}\p{S}]/u;
261
+ const punctuation = edit(/^((?![*_])punctSpace)/, 'u')
262
+ .replace(/punctSpace/g, _punctuationOrSpace).getRegex();
261
263
  // sequences em should skip over [title](link), `code`, <html>
262
264
  const blockSkip = /\[[^[\]]*?\]\((?:\\.|[^\\\(\)]|\((?:\\.|[^\\\(\)])*\))*\)|`[^`]*?`|<[^<>]*?>/g;
263
- const emStrongLDelim = edit(/^(?:\*+(?:((?!\*)[punct])|[^\s*]))|^_+(?:((?!_)[punct])|([^\s_]))/, 'u')
265
+ const emStrongLDelim = edit(/^(?:\*+(?:((?!\*)punct)|[^\s*]))|^_+(?:((?!_)punct)|([^\s_]))/, 'u')
264
266
  .replace(/punct/g, _punctuation)
265
267
  .getRegex();
266
268
  const emStrongRDelimAst = edit('^[^_*]*?__[^_*]*?\\*[^_*]*?(?=__)' // Skip orphan inside strong
267
269
  + '|[^*]+(?=[^*])' // Consume to delim
268
- + '|(?!\\*)[punct](\\*+)(?=[\\s]|$)' // (1) #*** can only be a Right Delimiter
269
- + '|[^punct\\s](\\*+)(?!\\*)(?=[punct\\s]|$)' // (2) a***#, a*** can only be a Right Delimiter
270
- + '|(?!\\*)[punct\\s](\\*+)(?=[^punct\\s])' // (3) #***a, ***a can only be Left Delimiter
271
- + '|[\\s](\\*+)(?!\\*)(?=[punct])' // (4) ***# can only be Left Delimiter
272
- + '|(?!\\*)[punct](\\*+)(?!\\*)(?=[punct])' // (5) #***# can be either Left or Right Delimiter
273
- + '|[^punct\\s](\\*+)(?=[^punct\\s])', 'gu') // (6) a***a can be either Left or Right Delimiter
270
+ + '|(?!\\*)punct(\\*+)(?=[\\s]|$)' // (1) #*** can only be a Right Delimiter
271
+ + '|notPunctSpace(\\*+)(?!\\*)(?=punctSpace|$)' // (2) a***#, a*** can only be a Right Delimiter
272
+ + '|(?!\\*)punctSpace(\\*+)(?=notPunctSpace)' // (3) #***a, ***a can only be Left Delimiter
273
+ + '|[\\s](\\*+)(?!\\*)(?=punct)' // (4) ***# can only be Left Delimiter
274
+ + '|(?!\\*)punct(\\*+)(?!\\*)(?=punct)' // (5) #***# can be either Left or Right Delimiter
275
+ + '|notPunctSpace(\\*+)(?=notPunctSpace)', 'gu') // (6) a***a can be either Left or Right Delimiter
276
+ .replace(/notPunctSpace/g, _notPunctuationOrSpace)
277
+ .replace(/punctSpace/g, _punctuationOrSpace)
274
278
  .replace(/punct/g, _punctuation)
275
279
  .getRegex();
276
280
  // (6) Not allowed for _
277
281
  const emStrongRDelimUnd = edit('^[^_*]*?\\*\\*[^_*]*?_[^_*]*?(?=\\*\\*)' // Skip orphan inside strong
278
282
  + '|[^_]+(?=[^_])' // Consume to delim
279
- + '|(?!_)[punct](_+)(?=[\\s]|$)' // (1) #___ can only be a Right Delimiter
280
- + '|[^punct\\s](_+)(?!_)(?=[punct\\s]|$)' // (2) a___#, a___ can only be a Right Delimiter
281
- + '|(?!_)[punct\\s](_+)(?=[^punct\\s])' // (3) #___a, ___a can only be Left Delimiter
282
- + '|[\\s](_+)(?!_)(?=[punct])' // (4) ___# can only be Left Delimiter
283
- + '|(?!_)[punct](_+)(?!_)(?=[punct])', 'gu') // (5) #___# can be either Left or Right Delimiter
283
+ + '|(?!_)punct(_+)(?=[\\s]|$)' // (1) #___ can only be a Right Delimiter
284
+ + '|notPunctSpace(_+)(?!_)(?=punctSpace|$)' // (2) a___#, a___ can only be a Right Delimiter
285
+ + '|(?!_)punctSpace(_+)(?=notPunctSpace)' // (3) #___a, ___a can only be Left Delimiter
286
+ + '|[\\s](_+)(?!_)(?=punct)' // (4) ___# can only be Left Delimiter
287
+ + '|(?!_)punct(_+)(?!_)(?=punct)', 'gu') // (5) #___# can be either Left or Right Delimiter
288
+ .replace(/notPunctSpace/g, _notPunctuationOrSpace)
289
+ .replace(/punctSpace/g, _punctuationOrSpace)
284
290
  .replace(/punct/g, _punctuation)
285
291
  .getRegex();
286
- const anyPunctuation = edit(/\\([punct])/, 'gu')
292
+ const anyPunctuation = edit(/\\(punct)/, 'gu')
287
293
  .replace(/punct/g, _punctuation)
288
294
  .getRegex();
289
295
  const autolink = edit(/^<(scheme:[^\s\x00-\x1f<>]*|email)>/)