marked 13.0.2 → 13.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 v13.0.2 - a markdown parser
2
+ * marked v13.0.3 - a markdown parser
3
3
  * Copyright (c) 2011-2024, Christopher Jeffrey. (MIT Licensed)
4
4
  * https://github.com/markedjs/marked
5
5
  */
@@ -29,7 +29,7 @@
29
29
  renderer: null,
30
30
  silent: false,
31
31
  tokenizer: null,
32
- walkTokens: null
32
+ walkTokens: null,
33
33
  };
34
34
  }
35
35
  exports.defaults = _getDefaults();
@@ -49,7 +49,7 @@
49
49
  '<': '&lt;',
50
50
  '>': '&gt;',
51
51
  '"': '&quot;',
52
- "'": '&#39;'
52
+ "'": '&#39;',
53
53
  };
54
54
  const getEscapeReplacement = (ch) => escapeReplacements[ch];
55
55
  function escape$1(html, encode) {
@@ -93,7 +93,7 @@
93
93
  },
94
94
  getRegex: () => {
95
95
  return new RegExp(source, opt);
96
- }
96
+ },
97
97
  };
98
98
  return obj;
99
99
  }
@@ -101,7 +101,7 @@
101
101
  try {
102
102
  href = encodeURI(href).replace(/%25/g, '%');
103
103
  }
104
- catch (e) {
104
+ catch {
105
105
  return null;
106
106
  }
107
107
  return href;
@@ -212,7 +212,7 @@
212
212
  href,
213
213
  title,
214
214
  text,
215
- tokens: lexer.inlineTokens(text)
215
+ tokens: lexer.inlineTokens(text),
216
216
  };
217
217
  lexer.state.inLink = false;
218
218
  return token;
@@ -222,7 +222,7 @@
222
222
  raw,
223
223
  href,
224
224
  title,
225
- text: escape$1(text)
225
+ text: escape$1(text),
226
226
  };
227
227
  }
228
228
  function indentCodeCompensation(raw, text) {
@@ -261,7 +261,7 @@
261
261
  if (cap && cap[0].length > 0) {
262
262
  return {
263
263
  type: 'space',
264
- raw: cap[0]
264
+ raw: cap[0],
265
265
  };
266
266
  }
267
267
  }
@@ -275,7 +275,7 @@
275
275
  codeBlockStyle: 'indented',
276
276
  text: !this.options.pedantic
277
277
  ? rtrim(text, '\n')
278
- : text
278
+ : text,
279
279
  };
280
280
  }
281
281
  }
@@ -288,7 +288,7 @@
288
288
  type: 'code',
289
289
  raw,
290
290
  lang: cap[2] ? cap[2].trim().replace(this.rules.inline.anyPunctuation, '$1') : cap[2],
291
- text
291
+ text,
292
292
  };
293
293
  }
294
294
  }
@@ -312,7 +312,7 @@
312
312
  raw: cap[0],
313
313
  depth: cap[1].length,
314
314
  text,
315
- tokens: this.lexer.inline(text)
315
+ tokens: this.lexer.inline(text),
316
316
  };
317
317
  }
318
318
  }
@@ -321,7 +321,7 @@
321
321
  if (cap) {
322
322
  return {
323
323
  type: 'hr',
324
- raw: rtrim(cap[0], '\n')
324
+ raw: rtrim(cap[0], '\n'),
325
325
  };
326
326
  }
327
327
  }
@@ -398,7 +398,7 @@
398
398
  type: 'blockquote',
399
399
  raw,
400
400
  tokens,
401
- text
401
+ text,
402
402
  };
403
403
  }
404
404
  }
@@ -413,7 +413,7 @@
413
413
  ordered: isordered,
414
414
  start: isordered ? +bull.slice(0, -1) : '',
415
415
  loose: false,
416
- items: []
416
+ items: [],
417
417
  };
418
418
  bull = isordered ? `\\d{1,9}\\${bull.slice(-1)}` : `\\${bull}`;
419
419
  if (this.options.pedantic) {
@@ -543,7 +543,7 @@
543
543
  checked: ischecked,
544
544
  loose: false,
545
545
  text: itemContents,
546
- tokens: []
546
+ tokens: [],
547
547
  });
548
548
  list.raw += raw;
549
549
  }
@@ -579,7 +579,7 @@
579
579
  block: true,
580
580
  raw: cap[0],
581
581
  pre: cap[1] === 'pre' || cap[1] === 'script' || cap[1] === 'style',
582
- text: cap[0]
582
+ text: cap[0],
583
583
  };
584
584
  return token;
585
585
  }
@@ -595,7 +595,7 @@
595
595
  tag,
596
596
  raw: cap[0],
597
597
  href,
598
- title
598
+ title,
599
599
  };
600
600
  }
601
601
  }
@@ -616,7 +616,7 @@
616
616
  raw: cap[0],
617
617
  header: [],
618
618
  align: [],
619
- rows: []
619
+ rows: [],
620
620
  };
621
621
  if (headers.length !== aligns.length) {
622
622
  // header and align columns must be equal, rows can be different.
@@ -641,7 +641,7 @@
641
641
  text: headers[i],
642
642
  tokens: this.lexer.inline(headers[i]),
643
643
  header: true,
644
- align: item.align[i]
644
+ align: item.align[i],
645
645
  });
646
646
  }
647
647
  for (const row of rows) {
@@ -650,7 +650,7 @@
650
650
  text: cell,
651
651
  tokens: this.lexer.inline(cell),
652
652
  header: false,
653
- align: item.align[i]
653
+ align: item.align[i],
654
654
  };
655
655
  }));
656
656
  }
@@ -664,7 +664,7 @@
664
664
  raw: cap[0],
665
665
  depth: cap[2].charAt(0) === '=' ? 1 : 2,
666
666
  text: cap[1],
667
- tokens: this.lexer.inline(cap[1])
667
+ tokens: this.lexer.inline(cap[1]),
668
668
  };
669
669
  }
670
670
  }
@@ -678,7 +678,7 @@
678
678
  type: 'paragraph',
679
679
  raw: cap[0],
680
680
  text,
681
- tokens: this.lexer.inline(text)
681
+ tokens: this.lexer.inline(text),
682
682
  };
683
683
  }
684
684
  }
@@ -689,7 +689,7 @@
689
689
  type: 'text',
690
690
  raw: cap[0],
691
691
  text: cap[0],
692
- tokens: this.lexer.inline(cap[0])
692
+ tokens: this.lexer.inline(cap[0]),
693
693
  };
694
694
  }
695
695
  }
@@ -699,7 +699,7 @@
699
699
  return {
700
700
  type: 'escape',
701
701
  raw: cap[0],
702
- text: escape$1(cap[1])
702
+ text: escape$1(cap[1]),
703
703
  };
704
704
  }
705
705
  }
@@ -724,7 +724,7 @@
724
724
  inLink: this.lexer.state.inLink,
725
725
  inRawBlock: this.lexer.state.inRawBlock,
726
726
  block: false,
727
- text: cap[0]
727
+ text: cap[0],
728
728
  };
729
729
  }
730
730
  }
@@ -779,7 +779,7 @@
779
779
  }
780
780
  return outputLink(cap, {
781
781
  href: href ? href.replace(this.rules.inline.anyPunctuation, '$1') : href,
782
- title: title ? title.replace(this.rules.inline.anyPunctuation, '$1') : title
782
+ title: title ? title.replace(this.rules.inline.anyPunctuation, '$1') : title,
783
783
  }, cap[0], this.lexer);
784
784
  }
785
785
  }
@@ -794,7 +794,7 @@
794
794
  return {
795
795
  type: 'text',
796
796
  raw: text,
797
- text
797
+ text,
798
798
  };
799
799
  }
800
800
  return outputLink(cap, link, cap[0], this.lexer);
@@ -846,7 +846,7 @@
846
846
  type: 'em',
847
847
  raw,
848
848
  text,
849
- tokens: this.lexer.inlineTokens(text)
849
+ tokens: this.lexer.inlineTokens(text),
850
850
  };
851
851
  }
852
852
  // Create 'strong' if smallest delimiter has even char count. **a***
@@ -855,7 +855,7 @@
855
855
  type: 'strong',
856
856
  raw,
857
857
  text,
858
- tokens: this.lexer.inlineTokens(text)
858
+ tokens: this.lexer.inlineTokens(text),
859
859
  };
860
860
  }
861
861
  }
@@ -873,7 +873,7 @@
873
873
  return {
874
874
  type: 'codespan',
875
875
  raw: cap[0],
876
- text
876
+ text,
877
877
  };
878
878
  }
879
879
  }
@@ -882,7 +882,7 @@
882
882
  if (cap) {
883
883
  return {
884
884
  type: 'br',
885
- raw: cap[0]
885
+ raw: cap[0],
886
886
  };
887
887
  }
888
888
  }
@@ -893,7 +893,7 @@
893
893
  type: 'del',
894
894
  raw: cap[0],
895
895
  text: cap[2],
896
- tokens: this.lexer.inlineTokens(cap[2])
896
+ tokens: this.lexer.inlineTokens(cap[2]),
897
897
  };
898
898
  }
899
899
  }
@@ -918,9 +918,9 @@
918
918
  {
919
919
  type: 'text',
920
920
  raw: text,
921
- text
922
- }
923
- ]
921
+ text,
922
+ },
923
+ ],
924
924
  };
925
925
  }
926
926
  }
@@ -956,9 +956,9 @@
956
956
  {
957
957
  type: 'text',
958
958
  raw: text,
959
- text
960
- }
961
- ]
959
+ text,
960
+ },
961
+ ],
962
962
  };
963
963
  }
964
964
  }
@@ -975,7 +975,7 @@
975
975
  return {
976
976
  type: 'text',
977
977
  raw: cap[0],
978
- text
978
+ text,
979
979
  };
980
980
  }
981
981
  }
@@ -1059,7 +1059,7 @@
1059
1059
  newline,
1060
1060
  paragraph,
1061
1061
  table: noopTest,
1062
- text: blockText
1062
+ text: blockText,
1063
1063
  };
1064
1064
  /**
1065
1065
  * GFM Block Grammar
@@ -1089,7 +1089,7 @@
1089
1089
  .replace('list', ' {0,3}(?:[*+-]|1[.)]) ') // only lists starting from 1 can interrupt
1090
1090
  .replace('html', '</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|textarea|!--)')
1091
1091
  .replace('tag', _tag) // pars can be interrupted by type (6) html blocks
1092
- .getRegex()
1092
+ .getRegex(),
1093
1093
  };
1094
1094
  /**
1095
1095
  * Pedantic grammar (original John Gruber's loose markdown specification)
@@ -1119,7 +1119,7 @@
1119
1119
  .replace('|list', '')
1120
1120
  .replace('|html', '')
1121
1121
  .replace('|tag', '')
1122
- .getRegex()
1122
+ .getRegex(),
1123
1123
  };
1124
1124
  /**
1125
1125
  * Inline-Level Grammar
@@ -1213,7 +1213,7 @@
1213
1213
  reflinkSearch,
1214
1214
  tag,
1215
1215
  text: inlineText,
1216
- url: noopTest
1216
+ url: noopTest,
1217
1217
  };
1218
1218
  /**
1219
1219
  * Pedantic Inline Grammar
@@ -1225,7 +1225,7 @@
1225
1225
  .getRegex(),
1226
1226
  reflink: edit(/^!?\[(label)\]\s*\[([^\]]*)\]/)
1227
1227
  .replace('label', _inlineLabel)
1228
- .getRegex()
1228
+ .getRegex(),
1229
1229
  };
1230
1230
  /**
1231
1231
  * GFM Inline Grammar
@@ -1238,7 +1238,7 @@
1238
1238
  .getRegex(),
1239
1239
  _backpedal: /(?:[^?!.,:;*_'"~()&]+|\([^)]*\)|&(?![a-zA-Z0-9]+;$)|[?!.,:;*_'"~)]+(?!$))+/,
1240
1240
  del: /^(~~?)(?=[^\s~])([\s\S]*?[^\s~])\1(?=[^~]|$)/,
1241
- text: /^([`~]+|[^`~])(?:(?= {2,}\n)|(?=[a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-]+@)|[\s\S]*?(?:(?=[\\<!\[`*~_]|\b_|https?:\/\/|ftp:\/\/|www\.|$)|[^ ](?= {2,}\n)|[^a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-](?=[a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-]+@)))/
1241
+ text: /^([`~]+|[^`~])(?:(?= {2,}\n)|(?=[a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-]+@)|[\s\S]*?(?:(?=[\\<!\[`*~_]|\b_|https?:\/\/|ftp:\/\/|www\.|$)|[^ ](?= {2,}\n)|[^a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-](?=[a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-]+@)))/,
1242
1242
  };
1243
1243
  /**
1244
1244
  * GFM + Line Breaks Inline Grammar
@@ -1249,7 +1249,7 @@
1249
1249
  text: edit(inlineGfm.text)
1250
1250
  .replace('\\b_', '\\b_| {2,}\\n')
1251
1251
  .replace(/\{2,\}/g, '*')
1252
- .getRegex()
1252
+ .getRegex(),
1253
1253
  };
1254
1254
  /**
1255
1255
  * exports
@@ -1257,13 +1257,13 @@
1257
1257
  const block = {
1258
1258
  normal: blockNormal,
1259
1259
  gfm: blockGfm,
1260
- pedantic: blockPedantic
1260
+ pedantic: blockPedantic,
1261
1261
  };
1262
1262
  const inline = {
1263
1263
  normal: inlineNormal,
1264
1264
  gfm: inlineGfm,
1265
1265
  breaks: inlineBreaks,
1266
- pedantic: inlinePedantic
1266
+ pedantic: inlinePedantic,
1267
1267
  };
1268
1268
 
1269
1269
  /**
@@ -1288,11 +1288,11 @@
1288
1288
  this.state = {
1289
1289
  inLink: false,
1290
1290
  inRawBlock: false,
1291
- top: true
1291
+ top: true,
1292
1292
  };
1293
1293
  const rules = {
1294
1294
  block: block.normal,
1295
- inline: inline.normal
1295
+ inline: inline.normal,
1296
1296
  };
1297
1297
  if (this.options.pedantic) {
1298
1298
  rules.block = block.pedantic;
@@ -1315,7 +1315,7 @@
1315
1315
  static get rules() {
1316
1316
  return {
1317
1317
  block,
1318
- inline
1318
+ inline,
1319
1319
  };
1320
1320
  }
1321
1321
  /**
@@ -1447,7 +1447,7 @@
1447
1447
  else if (!this.tokens.links[token.tag]) {
1448
1448
  this.tokens.links[token.tag] = {
1449
1449
  href: token.href,
1450
- title: token.title
1450
+ title: token.title,
1451
1451
  };
1452
1452
  }
1453
1453
  continue;
@@ -1763,7 +1763,7 @@
1763
1763
  item.tokens.unshift({
1764
1764
  type: 'text',
1765
1765
  raw: checkbox + ' ',
1766
- text: checkbox + ' '
1766
+ text: checkbox + ' ',
1767
1767
  });
1768
1768
  }
1769
1769
  }
@@ -1999,7 +1999,7 @@
1999
1999
  type: 'paragraph',
2000
2000
  raw: body,
2001
2001
  text: body,
2002
- tokens: [{ type: 'text', raw: body, text: body }]
2002
+ tokens: [{ type: 'text', raw: body, text: body }],
2003
2003
  });
2004
2004
  }
2005
2005
  else {
@@ -2103,7 +2103,7 @@
2103
2103
  static passThroughHooks = new Set([
2104
2104
  'preprocess',
2105
2105
  'postprocess',
2106
- 'processAllTokens'
2106
+ 'processAllTokens',
2107
2107
  ]);
2108
2108
  /**
2109
2109
  * Process markdown before marked
@@ -2258,13 +2258,13 @@
2258
2258
  }
2259
2259
  const rendererProp = prop;
2260
2260
  let rendererFunc = pack.renderer[rendererProp];
2261
+ if (!pack.useNewRenderer) {
2262
+ // TODO: Remove this in next major version
2263
+ rendererFunc = this.#convertRendererFunction(rendererFunc, rendererProp, renderer);
2264
+ }
2261
2265
  const prevRenderer = renderer[rendererProp];
2262
2266
  // Replace renderer with func to run extension, but fall back if false
2263
2267
  renderer[rendererProp] = (...args) => {
2264
- if (!pack.useNewRenderer) {
2265
- // TODO: Remove this in next major version
2266
- rendererFunc = this.#convertRendererFunction(rendererFunc, rendererProp, renderer);
2267
- }
2268
2268
  let ret = rendererFunc.apply(renderer, args);
2269
2269
  if (ret === false) {
2270
2270
  ret = prevRenderer.apply(renderer, args);
@@ -2391,7 +2391,7 @@
2391
2391
  text: token.header[j].text,
2392
2392
  tokens: token.header[j].tokens,
2393
2393
  header: true,
2394
- align: token.align[j]
2394
+ align: token.align[j],
2395
2395
  });
2396
2396
  }
2397
2397
  header += this.tablerow({ text: cell });
@@ -2404,7 +2404,7 @@
2404
2404
  text: row[k].text,
2405
2405
  tokens: row[k].tokens,
2406
2406
  header: false,
2407
- align: token.align[k]
2407
+ align: token.align[k],
2408
2408
  });
2409
2409
  }
2410
2410
  body += this.tablerow({ text: cell });
@@ -2449,7 +2449,7 @@
2449
2449
  else {
2450
2450
  item.tokens.unshift({
2451
2451
  type: 'text',
2452
- text: checkbox + ' '
2452
+ text: checkbox + ' ',
2453
2453
  });
2454
2454
  }
2455
2455
  }
@@ -2465,7 +2465,7 @@
2465
2465
  task,
2466
2466
  checked: !!checked,
2467
2467
  loose,
2468
- tokens: item.tokens
2468
+ tokens: item.tokens,
2469
2469
  });
2470
2470
  }
2471
2471
  return func.call(this, body, ordered, start);