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