marked 13.0.0 → 13.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.d.cts CHANGED
@@ -396,15 +396,15 @@ export interface RendererExtension {
396
396
  export type TokenizerAndRendererExtension = TokenizerExtension | RendererExtension | (TokenizerExtension & RendererExtension);
397
397
  export type HooksApi = Omit<_Hooks, "constructor" | "options">;
398
398
  export type HooksObject = {
399
- [K in keyof HooksApi]?: (...args: Parameters<HooksApi[K]>) => ReturnType<HooksApi[K]> | Promise<ReturnType<HooksApi[K]>>;
399
+ [K in keyof HooksApi]?: (this: _Hooks, ...args: Parameters<HooksApi[K]>) => ReturnType<HooksApi[K]> | Promise<ReturnType<HooksApi[K]>>;
400
400
  };
401
401
  export type RendererApi = Omit<_Renderer, "constructor" | "options" | "parser">;
402
402
  export type RendererObject = {
403
- [K in keyof RendererApi]?: (...args: Parameters<RendererApi[K]>) => ReturnType<RendererApi[K]> | false;
403
+ [K in keyof RendererApi]?: (this: _Renderer, ...args: Parameters<RendererApi[K]>) => ReturnType<RendererApi[K]> | false;
404
404
  };
405
405
  export type TokenizerApi = Omit<_Tokenizer, "constructor" | "options" | "rules" | "lexer">;
406
406
  export type TokenizerObject = {
407
- [K in keyof TokenizerApi]?: (...args: Parameters<TokenizerApi[K]>) => ReturnType<TokenizerApi[K]> | false;
407
+ [K in keyof TokenizerApi]?: (this: _Tokenizer, ...args: Parameters<TokenizerApi[K]>) => ReturnType<TokenizerApi[K]> | false;
408
408
  };
409
409
  export interface MarkedExtension {
410
410
  /**
package/lib/marked.d.ts CHANGED
@@ -396,15 +396,15 @@ export interface RendererExtension {
396
396
  export type TokenizerAndRendererExtension = TokenizerExtension | RendererExtension | (TokenizerExtension & RendererExtension);
397
397
  export type HooksApi = Omit<_Hooks, "constructor" | "options">;
398
398
  export type HooksObject = {
399
- [K in keyof HooksApi]?: (...args: Parameters<HooksApi[K]>) => ReturnType<HooksApi[K]> | Promise<ReturnType<HooksApi[K]>>;
399
+ [K in keyof HooksApi]?: (this: _Hooks, ...args: Parameters<HooksApi[K]>) => ReturnType<HooksApi[K]> | Promise<ReturnType<HooksApi[K]>>;
400
400
  };
401
401
  export type RendererApi = Omit<_Renderer, "constructor" | "options" | "parser">;
402
402
  export type RendererObject = {
403
- [K in keyof RendererApi]?: (...args: Parameters<RendererApi[K]>) => ReturnType<RendererApi[K]> | false;
403
+ [K in keyof RendererApi]?: (this: _Renderer, ...args: Parameters<RendererApi[K]>) => ReturnType<RendererApi[K]> | false;
404
404
  };
405
405
  export type TokenizerApi = Omit<_Tokenizer, "constructor" | "options" | "rules" | "lexer">;
406
406
  export type TokenizerObject = {
407
- [K in keyof TokenizerApi]?: (...args: Parameters<TokenizerApi[K]>) => ReturnType<TokenizerApi[K]> | false;
407
+ [K in keyof TokenizerApi]?: (this: _Tokenizer, ...args: Parameters<TokenizerApi[K]>) => ReturnType<TokenizerApi[K]> | false;
408
408
  };
409
409
  export interface MarkedExtension {
410
410
  /**
package/lib/marked.esm.js CHANGED
@@ -1,5 +1,5 @@
1
1
  /**
2
- * marked v13.0.0 - a markdown parser
2
+ * marked v13.0.1 - a markdown parser
3
3
  * Copyright (c) 2011-2024, Christopher Jeffrey. (MIT Licensed)
4
4
  * https://github.com/markedjs/marked
5
5
  */
@@ -2356,7 +2356,7 @@ class Marked {
2356
2356
  // eslint-disable-next-line prefer-rest-params
2357
2357
  return func.apply(this, arguments);
2358
2358
  }
2359
- return func(renderer.parser.parseInline(token.tokens), token.depth, unescape(renderer.parser.parseInline(token.tokens, renderer.parser.textRenderer)));
2359
+ return func.call(this, renderer.parser.parseInline(token.tokens), token.depth, unescape(renderer.parser.parseInline(token.tokens, renderer.parser.textRenderer)));
2360
2360
  };
2361
2361
  case 'code':
2362
2362
  return function (token) {
@@ -2365,7 +2365,7 @@ class Marked {
2365
2365
  // eslint-disable-next-line prefer-rest-params
2366
2366
  return func.apply(this, arguments);
2367
2367
  }
2368
- return func(token.text, token.lang, !!token.escaped);
2368
+ return func.call(this, token.text, token.lang, !!token.escaped);
2369
2369
  };
2370
2370
  case 'table':
2371
2371
  return function (token) {
@@ -2400,7 +2400,7 @@ class Marked {
2400
2400
  }
2401
2401
  body += this.tablerow({ text: cell });
2402
2402
  }
2403
- return func(header, body);
2403
+ return func.call(this, header, body);
2404
2404
  };
2405
2405
  case 'blockquote':
2406
2406
  return function (token) {
@@ -2410,7 +2410,7 @@ class Marked {
2410
2410
  return func.apply(this, arguments);
2411
2411
  }
2412
2412
  const body = this.parser.parse(token.tokens);
2413
- return func(body);
2413
+ return func.call(this, body);
2414
2414
  };
2415
2415
  case 'list':
2416
2416
  return function (token) {
@@ -2459,7 +2459,7 @@ class Marked {
2459
2459
  tokens: item.tokens
2460
2460
  });
2461
2461
  }
2462
- return func(body, ordered, start);
2462
+ return func.call(this, body, ordered, start);
2463
2463
  };
2464
2464
  case 'html':
2465
2465
  return function (token) {
@@ -2468,7 +2468,7 @@ class Marked {
2468
2468
  // eslint-disable-next-line prefer-rest-params
2469
2469
  return func.apply(this, arguments);
2470
2470
  }
2471
- return func(token.text, token.block);
2471
+ return func.call(this, token.text, token.block);
2472
2472
  };
2473
2473
  case 'paragraph':
2474
2474
  return function (token) {
@@ -2477,7 +2477,7 @@ class Marked {
2477
2477
  // eslint-disable-next-line prefer-rest-params
2478
2478
  return func.apply(this, arguments);
2479
2479
  }
2480
- return func(this.parser.parseInline(token.tokens));
2480
+ return func.call(this, this.parser.parseInline(token.tokens));
2481
2481
  };
2482
2482
  case 'escape':
2483
2483
  return function (token) {
@@ -2486,7 +2486,7 @@ class Marked {
2486
2486
  // eslint-disable-next-line prefer-rest-params
2487
2487
  return func.apply(this, arguments);
2488
2488
  }
2489
- return func(token.text);
2489
+ return func.call(this, token.text);
2490
2490
  };
2491
2491
  case 'link':
2492
2492
  return function (token) {
@@ -2495,7 +2495,7 @@ class Marked {
2495
2495
  // eslint-disable-next-line prefer-rest-params
2496
2496
  return func.apply(this, arguments);
2497
2497
  }
2498
- return func(token.href, token.title, this.parser.parseInline(token.tokens));
2498
+ return func.call(this, token.href, token.title, this.parser.parseInline(token.tokens));
2499
2499
  };
2500
2500
  case 'image':
2501
2501
  return function (token) {
@@ -2504,7 +2504,7 @@ class Marked {
2504
2504
  // eslint-disable-next-line prefer-rest-params
2505
2505
  return func.apply(this, arguments);
2506
2506
  }
2507
- return func(token.href, token.title, token.text);
2507
+ return func.call(this, token.href, token.title, token.text);
2508
2508
  };
2509
2509
  case 'strong':
2510
2510
  return function (token) {
@@ -2513,7 +2513,7 @@ class Marked {
2513
2513
  // eslint-disable-next-line prefer-rest-params
2514
2514
  return func.apply(this, arguments);
2515
2515
  }
2516
- return func(this.parser.parseInline(token.tokens));
2516
+ return func.call(this, this.parser.parseInline(token.tokens));
2517
2517
  };
2518
2518
  case 'em':
2519
2519
  return function (token) {
@@ -2522,7 +2522,7 @@ class Marked {
2522
2522
  // eslint-disable-next-line prefer-rest-params
2523
2523
  return func.apply(this, arguments);
2524
2524
  }
2525
- return func(this.parser.parseInline(token.tokens));
2525
+ return func.call(this, this.parser.parseInline(token.tokens));
2526
2526
  };
2527
2527
  case 'codespan':
2528
2528
  return function (token) {
@@ -2531,7 +2531,7 @@ class Marked {
2531
2531
  // eslint-disable-next-line prefer-rest-params
2532
2532
  return func.apply(this, arguments);
2533
2533
  }
2534
- return func(token.text);
2534
+ return func.call(this, token.text);
2535
2535
  };
2536
2536
  case 'del':
2537
2537
  return function (token) {
@@ -2540,7 +2540,7 @@ class Marked {
2540
2540
  // eslint-disable-next-line prefer-rest-params
2541
2541
  return func.apply(this, arguments);
2542
2542
  }
2543
- return func(this.parser.parseInline(token.tokens));
2543
+ return func.call(this, this.parser.parseInline(token.tokens));
2544
2544
  };
2545
2545
  case 'text':
2546
2546
  return function (token) {
@@ -2549,7 +2549,7 @@ class Marked {
2549
2549
  // eslint-disable-next-line prefer-rest-params
2550
2550
  return func.apply(this, arguments);
2551
2551
  }
2552
- return func(token.text);
2552
+ return func.call(this, token.text);
2553
2553
  };
2554
2554
  // do nothing
2555
2555
  }