marked 7.0.5 → 8.0.1

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 v7.0.5 - a markdown parser
2
+ * marked v8.0.1 - a markdown parser
3
3
  * Copyright (c) 2011-2023, Christopher Jeffrey. (MIT Licensed)
4
4
  * https://github.com/markedjs/marked
5
5
  */
@@ -17,25 +17,15 @@
17
17
  function _getDefaults() {
18
18
  return {
19
19
  async: false,
20
- baseUrl: null,
21
20
  breaks: false,
22
21
  extensions: null,
23
22
  gfm: true,
24
- headerIds: false,
25
- headerPrefix: '',
26
- highlight: null,
27
23
  hooks: null,
28
- langPrefix: 'language-',
29
- mangle: false,
30
24
  pedantic: false,
31
25
  renderer: null,
32
- sanitize: false,
33
- sanitizer: null,
34
26
  silent: false,
35
- smartypants: false,
36
27
  tokenizer: null,
37
- walkTokens: null,
38
- xhtml: false
28
+ walkTokens: null
39
29
  };
40
30
  }
41
31
  exports.defaults = _getDefaults();
@@ -103,26 +93,7 @@ function edit(regex, opt) {
103
93
  };
104
94
  return obj;
105
95
  }
106
- const nonWordAndColonTest = /[^\w:]/g;
107
- const originIndependentUrl = /^$|^[a-z][a-z0-9+.-]*:|^[?#]/i;
108
- function cleanUrl(sanitize, base, href) {
109
- if (sanitize) {
110
- let prot;
111
- try {
112
- prot = decodeURIComponent(unescape(href))
113
- .replace(nonWordAndColonTest, '')
114
- .toLowerCase();
115
- }
116
- catch (e) {
117
- return null;
118
- }
119
- if (prot.indexOf('javascript:') === 0 || prot.indexOf('vbscript:') === 0 || prot.indexOf('data:') === 0) {
120
- return null;
121
- }
122
- }
123
- if (base && !originIndependentUrl.test(href)) {
124
- href = resolveUrl(base, href);
125
- }
96
+ function cleanUrl(href) {
126
97
  try {
127
98
  href = encodeURI(href).replace(/%25/g, '%');
128
99
  }
@@ -131,40 +102,6 @@ function cleanUrl(sanitize, base, href) {
131
102
  }
132
103
  return href;
133
104
  }
134
- const baseUrls = {};
135
- const justDomain = /^[^:]+:\/*[^/]*$/;
136
- const protocol = /^([^:]+:)[\s\S]*$/;
137
- const domain = /^([^:]+:\/*[^/]*)[\s\S]*$/;
138
- function resolveUrl(base, href) {
139
- if (!baseUrls[' ' + base]) {
140
- // we can ignore everything in base after the last slash of its path component,
141
- // but we might need to add _that_
142
- // https://tools.ietf.org/html/rfc3986#section-3
143
- if (justDomain.test(base)) {
144
- baseUrls[' ' + base] = base + '/';
145
- }
146
- else {
147
- baseUrls[' ' + base] = rtrim(base, '/', true);
148
- }
149
- }
150
- base = baseUrls[' ' + base];
151
- const relativeBase = base.indexOf(':') === -1;
152
- if (href.substring(0, 2) === '//') {
153
- if (relativeBase) {
154
- return href;
155
- }
156
- return base.replace(protocol, '$1') + href;
157
- }
158
- else if (href.charAt(0) === '/') {
159
- if (relativeBase) {
160
- return href;
161
- }
162
- return base.replace(domain, '$1') + href;
163
- }
164
- else {
165
- return base + href;
166
- }
167
- }
168
105
  const noopTest = { exec: () => null };
169
106
  function splitCells(tableRow, count) {
170
107
  // ensure that every cell-delimiting pipe has a space
@@ -258,35 +195,6 @@ function findClosingBracket(str, b) {
258
195
  }
259
196
  return -1;
260
197
  }
261
- function checkDeprecations(opt, callback) {
262
- if (!opt || opt.silent) {
263
- return;
264
- }
265
- if (callback) {
266
- console.warn('marked(): callback is deprecated since version 5.0.0, should not be used and will be removed in the future. Read more here: https://marked.js.org/using_pro#async');
267
- }
268
- if (opt.sanitize || opt.sanitizer) {
269
- console.warn('marked(): sanitize and sanitizer parameters are deprecated since version 0.7.0, should not be used and will be removed in the future. Read more here: https://marked.js.org/#/USING_ADVANCED.md#options');
270
- }
271
- if (opt.highlight || opt.langPrefix !== 'language-') {
272
- console.warn('marked(): highlight and langPrefix parameters are deprecated since version 5.0.0, should not be used and will be removed in the future. Instead use https://www.npmjs.com/package/marked-highlight.');
273
- }
274
- if (opt.mangle) {
275
- console.warn('marked(): mangle parameter is enabled by default, but is deprecated since version 5.0.0, and will be removed in the future. To clear this warning, install https://www.npmjs.com/package/marked-mangle, or disable by setting `{mangle: false}`.');
276
- }
277
- if (opt.baseUrl) {
278
- console.warn('marked(): baseUrl parameter is deprecated since version 5.0.0, should not be used and will be removed in the future. Instead use https://www.npmjs.com/package/marked-base-url.');
279
- }
280
- if (opt.smartypants) {
281
- console.warn('marked(): smartypants parameter is deprecated since version 5.0.0, should not be used and will be removed in the future. Instead use https://www.npmjs.com/package/marked-smartypants.');
282
- }
283
- if (opt.xhtml) {
284
- console.warn('marked(): xhtml parameter is deprecated since version 5.0.0, should not be used and will be removed in the future. Instead use https://www.npmjs.com/package/marked-xhtml.');
285
- }
286
- if (opt.headerIds || opt.headerPrefix) {
287
- console.warn('marked(): headerIds and headerPrefix parameters enabled by default, but are deprecated since version 5.0.0, and will be removed in the future. To clear this warning, install https://www.npmjs.com/package/marked-gfm-heading-id, or disable by setting `{headerIds: false}`.');
288
- }
289
- }
290
198
 
291
199
  function outputLink(cap, link, raw, lexer) {
292
200
  const href = link.href;
@@ -468,7 +376,7 @@ class _Tokenizer {
468
376
  let indent = 0;
469
377
  if (this.options.pedantic) {
470
378
  indent = 2;
471
- itemContents = line.trimLeft();
379
+ itemContents = line.trimStart();
472
380
  }
473
381
  else {
474
382
  indent = cap[2].search(/[^ ]/); // Find first non-space char
@@ -573,9 +481,9 @@ class _Tokenizer {
573
481
  list.raw += raw;
574
482
  }
575
483
  // Do not consume newlines at end of final item. Alternatively, make itemRegex *start* with any newlines to simplify/speed up endsWithBlankLine logic
576
- list.items[list.items.length - 1].raw = raw.trimRight();
577
- list.items[list.items.length - 1].text = itemContents.trimRight();
578
- list.raw = list.raw.trimRight();
484
+ list.items[list.items.length - 1].raw = raw.trimEnd();
485
+ list.items[list.items.length - 1].text = itemContents.trimEnd();
486
+ list.raw = list.raw.trimEnd();
579
487
  // Item child tokens handled here at end because we needed to have the final item to trim it first
580
488
  for (let i = 0; i < list.items.length; i++) {
581
489
  this.lexer.state.top = false;
@@ -603,17 +511,9 @@ class _Tokenizer {
603
511
  type: 'html',
604
512
  block: true,
605
513
  raw: cap[0],
606
- pre: !this.options.sanitizer
607
- && (cap[1] === 'pre' || cap[1] === 'script' || cap[1] === 'style'),
514
+ pre: cap[1] === 'pre' || cap[1] === 'script' || cap[1] === 'style',
608
515
  text: cap[0]
609
516
  };
610
- if (this.options.sanitize) {
611
- const text = this.options.sanitizer ? this.options.sanitizer(cap[0]) : escape(cap[0]);
612
- const paragraph = token;
613
- paragraph.type = 'paragraph';
614
- paragraph.text = text;
615
- paragraph.tokens = this.lexer.inline(text);
616
- }
617
517
  return token;
618
518
  }
619
519
  }
@@ -751,18 +651,12 @@ class _Tokenizer {
751
651
  this.lexer.state.inRawBlock = false;
752
652
  }
753
653
  return {
754
- type: this.options.sanitize
755
- ? 'text'
756
- : 'html',
654
+ type: 'html',
757
655
  raw: cap[0],
758
656
  inLink: this.lexer.state.inLink,
759
657
  inRawBlock: this.lexer.state.inRawBlock,
760
658
  block: false,
761
- text: this.options.sanitize
762
- ? (this.options.sanitizer
763
- ? this.options.sanitizer(cap[0])
764
- : escape(cap[0]))
765
- : cap[0]
659
+ text: cap[0]
766
660
  };
767
661
  }
768
662
  }
@@ -933,12 +827,12 @@ class _Tokenizer {
933
827
  };
934
828
  }
935
829
  }
936
- autolink(src, mangle) {
830
+ autolink(src) {
937
831
  const cap = this.rules.inline.autolink.exec(src);
938
832
  if (cap) {
939
833
  let text, href;
940
834
  if (cap[2] === '@') {
941
- text = escape(this.options.mangle ? mangle(cap[1]) : cap[1]);
835
+ text = escape(cap[1]);
942
836
  href = 'mailto:' + text;
943
837
  }
944
838
  else {
@@ -960,12 +854,12 @@ class _Tokenizer {
960
854
  };
961
855
  }
962
856
  }
963
- url(src, mangle) {
857
+ url(src) {
964
858
  let cap;
965
859
  if (cap = this.rules.inline.url.exec(src)) {
966
860
  let text, href;
967
861
  if (cap[2] === '@') {
968
- text = escape(this.options.mangle ? mangle(cap[0]) : cap[0]);
862
+ text = escape(cap[0]);
969
863
  href = 'mailto:' + text;
970
864
  }
971
865
  else {
@@ -998,15 +892,15 @@ class _Tokenizer {
998
892
  };
999
893
  }
1000
894
  }
1001
- inlineText(src, smartypants) {
895
+ inlineText(src) {
1002
896
  const cap = this.rules.inline.text.exec(src);
1003
897
  if (cap) {
1004
898
  let text;
1005
899
  if (this.lexer.state.inRawBlock) {
1006
- text = this.options.sanitize ? (this.options.sanitizer ? this.options.sanitizer(cap[0]) : escape(cap[0])) : cap[0];
900
+ text = cap[0];
1007
901
  }
1008
902
  else {
1009
- text = escape(this.options.smartypants ? smartypants(cap[0]) : cap[0]);
903
+ text = escape(cap[0]);
1010
904
  }
1011
905
  return {
1012
906
  type: 'text',
@@ -1294,39 +1188,6 @@ inline.breaks = {
1294
1188
  .getRegex()
1295
1189
  };
1296
1190
 
1297
- /**
1298
- * smartypants text replacement
1299
- */
1300
- function smartypants(text) {
1301
- return text
1302
- // em-dashes
1303
- .replace(/---/g, '\u2014')
1304
- // en-dashes
1305
- .replace(/--/g, '\u2013')
1306
- // opening singles
1307
- .replace(/(^|[-\u2014/(\[{"\s])'/g, '$1\u2018')
1308
- // closing singles & apostrophes
1309
- .replace(/'/g, '\u2019')
1310
- // opening doubles
1311
- .replace(/(^|[-\u2014/(\[{\u2018\s])"/g, '$1\u201c')
1312
- // closing doubles
1313
- .replace(/"/g, '\u201d')
1314
- // ellipses
1315
- .replace(/\.{3}/g, '\u2026');
1316
- }
1317
- /**
1318
- * mangle email addresses
1319
- */
1320
- function mangle(text) {
1321
- let out = '';
1322
- for (let i = 0; i < text.length; i++) {
1323
- const ch = Math.random() > 0.5
1324
- ? 'x' + text.charCodeAt(i).toString(16)
1325
- : text.charCodeAt(i).toString();
1326
- out += '&#' + ch + ';';
1327
- }
1328
- return out;
1329
- }
1330
1191
  /**
1331
1192
  * Block Lexer
1332
1193
  */
@@ -1700,13 +1561,13 @@ class _Lexer {
1700
1561
  continue;
1701
1562
  }
1702
1563
  // autolink
1703
- if (token = this.tokenizer.autolink(src, mangle)) {
1564
+ if (token = this.tokenizer.autolink(src)) {
1704
1565
  src = src.substring(token.raw.length);
1705
1566
  tokens.push(token);
1706
1567
  continue;
1707
1568
  }
1708
1569
  // url (gfm)
1709
- if (!this.state.inLink && (token = this.tokenizer.url(src, mangle))) {
1570
+ if (!this.state.inLink && (token = this.tokenizer.url(src))) {
1710
1571
  src = src.substring(token.raw.length);
1711
1572
  tokens.push(token);
1712
1573
  continue;
@@ -1728,7 +1589,7 @@ class _Lexer {
1728
1589
  cutSrc = src.substring(0, startIndex + 1);
1729
1590
  }
1730
1591
  }
1731
- if (token = this.tokenizer.inlineText(cutSrc, smartypants)) {
1592
+ if (token = this.tokenizer.inlineText(cutSrc)) {
1732
1593
  src = src.substring(token.raw.length);
1733
1594
  if (token.raw.slice(-1) !== '_') { // Track prevChar before string of ____ started
1734
1595
  prevChar = token.raw.slice(-1);
@@ -1769,21 +1630,13 @@ class _Renderer {
1769
1630
  }
1770
1631
  code(code, infostring, escaped) {
1771
1632
  const lang = (infostring || '').match(/^\S*/)?.[0];
1772
- if (this.options.highlight) {
1773
- const out = this.options.highlight(code, lang);
1774
- if (out != null && out !== code) {
1775
- escaped = true;
1776
- code = out;
1777
- }
1778
- }
1779
1633
  code = code.replace(/\n$/, '') + '\n';
1780
1634
  if (!lang) {
1781
1635
  return '<pre><code>'
1782
1636
  + (escaped ? code : escape(code, true))
1783
1637
  + '</code></pre>\n';
1784
1638
  }
1785
- return '<pre><code class="'
1786
- + this.options.langPrefix
1639
+ return '<pre><code class="language-'
1787
1640
  + escape(lang)
1788
1641
  + '">'
1789
1642
  + (escaped ? code : escape(code, true))
@@ -1795,16 +1648,12 @@ class _Renderer {
1795
1648
  html(html, block) {
1796
1649
  return html;
1797
1650
  }
1798
- heading(text, level, raw, slugger) {
1799
- if (this.options.headerIds) {
1800
- const id = this.options.headerPrefix + slugger.slug(raw);
1801
- return `<h${level} id="${id}">${text}</h${level}>\n`;
1802
- }
1651
+ heading(text, level, raw) {
1803
1652
  // ignore IDs
1804
1653
  return `<h${level}>${text}</h${level}>\n`;
1805
1654
  }
1806
1655
  hr() {
1807
- return this.options.xhtml ? '<hr/>\n' : '<hr>\n';
1656
+ return '<hr>\n';
1808
1657
  }
1809
1658
  list(body, ordered, start) {
1810
1659
  const type = ordered ? 'ol' : 'ul';
@@ -1817,9 +1666,7 @@ class _Renderer {
1817
1666
  checkbox(checked) {
1818
1667
  return '<input '
1819
1668
  + (checked ? 'checked="" ' : '')
1820
- + 'disabled="" type="checkbox"'
1821
- + (this.options.xhtml ? ' /' : '')
1822
- + '> ';
1669
+ + 'disabled="" type="checkbox">';
1823
1670
  }
1824
1671
  paragraph(text) {
1825
1672
  return `<p>${text}</p>\n`;
@@ -1857,13 +1704,13 @@ class _Renderer {
1857
1704
  return `<code>${text}</code>`;
1858
1705
  }
1859
1706
  br() {
1860
- return this.options.xhtml ? '<br/>' : '<br>';
1707
+ return '<br>';
1861
1708
  }
1862
1709
  del(text) {
1863
1710
  return `<del>${text}</del>`;
1864
1711
  }
1865
1712
  link(href, title, text) {
1866
- const cleanHref = cleanUrl(this.options.sanitize, this.options.baseUrl, href);
1713
+ const cleanHref = cleanUrl(href);
1867
1714
  if (cleanHref === null) {
1868
1715
  return text;
1869
1716
  }
@@ -1876,7 +1723,7 @@ class _Renderer {
1876
1723
  return out;
1877
1724
  }
1878
1725
  image(href, title, text) {
1879
- const cleanHref = cleanUrl(this.options.sanitize, this.options.baseUrl, href);
1726
+ const cleanHref = cleanUrl(href);
1880
1727
  if (cleanHref === null) {
1881
1728
  return text;
1882
1729
  }
@@ -1885,7 +1732,7 @@ class _Renderer {
1885
1732
  if (title) {
1886
1733
  out += ` title="${title}"`;
1887
1734
  }
1888
- out += this.options.xhtml ? '/>' : '>';
1735
+ out += '>';
1889
1736
  return out;
1890
1737
  }
1891
1738
  text(text) {
@@ -1928,52 +1775,6 @@ class _TextRenderer {
1928
1775
  }
1929
1776
  }
1930
1777
 
1931
- /**
1932
- * Slugger generates header id
1933
- */
1934
- class _Slugger {
1935
- seen;
1936
- constructor() {
1937
- this.seen = {};
1938
- }
1939
- serialize(value) {
1940
- return value
1941
- .toLowerCase()
1942
- .trim()
1943
- // remove html tags
1944
- .replace(/<[!\/a-z].*?>/ig, '')
1945
- // remove unwanted chars
1946
- .replace(/[\u2000-\u206F\u2E00-\u2E7F\\'!"#$%&()*+,./:;<=>?@[\]^`{|}~]/g, '')
1947
- .replace(/\s/g, '-');
1948
- }
1949
- /**
1950
- * Finds the next safe (unique) slug to use
1951
- */
1952
- getNextSafeSlug(originalSlug, isDryRun) {
1953
- let slug = originalSlug;
1954
- let occurenceAccumulator = 0;
1955
- if (this.seen.hasOwnProperty(slug)) {
1956
- occurenceAccumulator = this.seen[originalSlug];
1957
- do {
1958
- occurenceAccumulator++;
1959
- slug = originalSlug + '-' + occurenceAccumulator;
1960
- } while (this.seen.hasOwnProperty(slug));
1961
- }
1962
- if (!isDryRun) {
1963
- this.seen[originalSlug] = occurenceAccumulator;
1964
- this.seen[slug] = 0;
1965
- }
1966
- return slug;
1967
- }
1968
- /**
1969
- * Convert string to unique id
1970
- */
1971
- slug(value, options = {}) {
1972
- const slug = this.serialize(value);
1973
- return this.getNextSafeSlug(slug, options.dryrun);
1974
- }
1975
- }
1976
-
1977
1778
  /**
1978
1779
  * Parsing & Compiling
1979
1780
  */
@@ -1981,14 +1782,12 @@ class _Parser {
1981
1782
  options;
1982
1783
  renderer;
1983
1784
  textRenderer;
1984
- slugger;
1985
1785
  constructor(options) {
1986
1786
  this.options = options || exports.defaults;
1987
1787
  this.options.renderer = this.options.renderer || new _Renderer();
1988
1788
  this.renderer = this.options.renderer;
1989
1789
  this.renderer.options = this.options;
1990
1790
  this.textRenderer = new _TextRenderer();
1991
- this.slugger = new _Slugger();
1992
1791
  }
1993
1792
  /**
1994
1793
  * Static Parse Method
@@ -2030,7 +1829,7 @@ class _Parser {
2030
1829
  }
2031
1830
  case 'heading': {
2032
1831
  const headingToken = token;
2033
- out += this.renderer.heading(this.parseInline(headingToken.tokens), headingToken.depth, unescape(this.parseInline(headingToken.tokens, this.textRenderer)), this.slugger);
1832
+ out += this.renderer.heading(this.parseInline(headingToken.tokens), headingToken.depth, unescape(this.parseInline(headingToken.tokens, this.textRenderer)));
2034
1833
  continue;
2035
1834
  }
2036
1835
  case 'code': {
@@ -2088,12 +1887,12 @@ class _Parser {
2088
1887
  else {
2089
1888
  item.tokens.unshift({
2090
1889
  type: 'text',
2091
- text: checkbox
1890
+ text: checkbox + ' '
2092
1891
  });
2093
1892
  }
2094
1893
  }
2095
1894
  else {
2096
- itemBody += checkbox;
1895
+ itemBody += checkbox + ' ';
2097
1896
  }
2098
1897
  }
2099
1898
  itemBody += this.parse(item.tokens, loose);
@@ -2253,7 +2052,6 @@ class Marked {
2253
2052
  Lexer = _Lexer;
2254
2053
  lexer = _Lexer.lex;
2255
2054
  Tokenizer = _Tokenizer;
2256
- Slugger = _Slugger;
2257
2055
  Hooks = _Hooks;
2258
2056
  constructor(...args) {
2259
2057
  this.use(...args);
@@ -2450,12 +2248,8 @@ class Marked {
2450
2248
  return this;
2451
2249
  }
2452
2250
  #parseMarkdown(lexer, parser) {
2453
- return (src, optOrCallback, callback) => {
2454
- if (typeof optOrCallback === 'function') {
2455
- callback = optOrCallback;
2456
- optOrCallback = null;
2457
- }
2458
- const origOpt = { ...optOrCallback };
2251
+ return (src, options) => {
2252
+ const origOpt = { ...options };
2459
2253
  const opt = { ...this.defaults, ...origOpt };
2460
2254
  // Show warning if an extension set async to true but the parse was called with async: false
2461
2255
  if (this.defaults.async === true && origOpt.async === false) {
@@ -2464,7 +2258,7 @@ class Marked {
2464
2258
  }
2465
2259
  opt.async = true;
2466
2260
  }
2467
- const throwError = this.#onError(!!opt.silent, !!opt.async, callback);
2261
+ const throwError = this.#onError(!!opt.silent, !!opt.async);
2468
2262
  // throw error in case of non string input
2469
2263
  if (typeof src === 'undefined' || src === null) {
2470
2264
  return throwError(new Error('marked(): input parameter is undefined or null'));
@@ -2473,76 +2267,9 @@ class Marked {
2473
2267
  return throwError(new Error('marked(): input parameter is of type '
2474
2268
  + Object.prototype.toString.call(src) + ', string expected'));
2475
2269
  }
2476
- checkDeprecations(opt, callback);
2477
2270
  if (opt.hooks) {
2478
2271
  opt.hooks.options = opt;
2479
2272
  }
2480
- if (callback) {
2481
- const resultCallback = callback;
2482
- const highlight = opt.highlight;
2483
- let tokens;
2484
- try {
2485
- if (opt.hooks) {
2486
- src = opt.hooks.preprocess(src);
2487
- }
2488
- tokens = lexer(src, opt);
2489
- }
2490
- catch (e) {
2491
- return throwError(e);
2492
- }
2493
- const done = (err) => {
2494
- let out;
2495
- if (!err) {
2496
- try {
2497
- if (opt.walkTokens) {
2498
- this.walkTokens(tokens, opt.walkTokens);
2499
- }
2500
- out = parser(tokens, opt);
2501
- if (opt.hooks) {
2502
- out = opt.hooks.postprocess(out);
2503
- }
2504
- }
2505
- catch (e) {
2506
- err = e;
2507
- }
2508
- }
2509
- opt.highlight = highlight;
2510
- return err
2511
- ? throwError(err)
2512
- : resultCallback(null, out);
2513
- };
2514
- if (!highlight || highlight.length < 3) {
2515
- return done();
2516
- }
2517
- delete opt.highlight;
2518
- if (!tokens.length)
2519
- return done();
2520
- let pending = 0;
2521
- this.walkTokens(tokens, (token) => {
2522
- if (token.type === 'code') {
2523
- pending++;
2524
- setTimeout(() => {
2525
- highlight(token.text, token.lang, (err, code) => {
2526
- if (err) {
2527
- return done(err);
2528
- }
2529
- if (code != null && code !== token.text) {
2530
- token.text = code;
2531
- token.escaped = true;
2532
- }
2533
- pending--;
2534
- if (pending === 0) {
2535
- done();
2536
- }
2537
- });
2538
- }, 0);
2539
- }
2540
- });
2541
- if (pending === 0) {
2542
- done();
2543
- }
2544
- return;
2545
- }
2546
2273
  if (opt.async) {
2547
2274
  return Promise.resolve(opt.hooks ? opt.hooks.preprocess(src) : src)
2548
2275
  .then(src => lexer(src, opt))
@@ -2570,7 +2297,7 @@ class Marked {
2570
2297
  }
2571
2298
  };
2572
2299
  }
2573
- #onError(silent, async, callback) {
2300
+ #onError(silent, async) {
2574
2301
  return (e) => {
2575
2302
  e.message += '\nPlease report this to https://github.com/markedjs/marked.';
2576
2303
  if (silent) {
@@ -2580,27 +2307,19 @@ class Marked {
2580
2307
  if (async) {
2581
2308
  return Promise.resolve(msg);
2582
2309
  }
2583
- if (callback) {
2584
- callback(null, msg);
2585
- return;
2586
- }
2587
2310
  return msg;
2588
2311
  }
2589
2312
  if (async) {
2590
2313
  return Promise.reject(e);
2591
2314
  }
2592
- if (callback) {
2593
- callback(e);
2594
- return;
2595
- }
2596
2315
  throw e;
2597
2316
  };
2598
2317
  }
2599
2318
  }
2600
2319
 
2601
2320
  const markedInstance = new Marked();
2602
- function marked(src, opt, callback) {
2603
- return markedInstance.parse(src, opt, callback);
2321
+ function marked(src, opt) {
2322
+ return markedInstance.parse(src, opt);
2604
2323
  }
2605
2324
  /**
2606
2325
  * Sets the default options.
@@ -2652,7 +2371,6 @@ marked.TextRenderer = _TextRenderer;
2652
2371
  marked.Lexer = _Lexer;
2653
2372
  marked.lexer = _Lexer.lex;
2654
2373
  marked.Tokenizer = _Tokenizer;
2655
- marked.Slugger = _Slugger;
2656
2374
  marked.Hooks = _Hooks;
2657
2375
  marked.parse = marked;
2658
2376
  const options = marked.options;
@@ -2669,7 +2387,6 @@ exports.Lexer = _Lexer;
2669
2387
  exports.Marked = Marked;
2670
2388
  exports.Parser = _Parser;
2671
2389
  exports.Renderer = _Renderer;
2672
- exports.Slugger = _Slugger;
2673
2390
  exports.TextRenderer = _TextRenderer;
2674
2391
  exports.Tokenizer = _Tokenizer;
2675
2392
  exports.getDefaults = _getDefaults;