marked 14.1.4 → 15.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.ts CHANGED
@@ -1,79 +1,74 @@
1
1
  // Generated by dts-bundle-generator v9.5.1
2
2
 
3
- export type MarkedToken = (Tokens.Space | Tokens.Code | Tokens.Heading | Tokens.Table | Tokens.Hr | Tokens.Blockquote | Tokens.List | Tokens.ListItem | Tokens.Paragraph | Tokens.HTML | Tokens.Text | Tokens.Def | Tokens.Escape | Tokens.Tag | Tokens.Image | Tokens.Link | Tokens.Strong | Tokens.Em | Tokens.Codespan | Tokens.Br | Tokens.Del);
3
+ export type MarkedToken = (Tokens.Blockquote | Tokens.Br | Tokens.Code | Tokens.Codespan | Tokens.Def | Tokens.Del | Tokens.Em | Tokens.Escape | Tokens.Heading | Tokens.Hr | Tokens.HTML | Tokens.Image | Tokens.Link | Tokens.List | Tokens.ListItem | Tokens.Paragraph | Tokens.Space | Tokens.Strong | Tokens.Table | Tokens.Tag | Tokens.Text);
4
4
  export type Token = (MarkedToken | Tokens.Generic);
5
5
  export declare namespace Tokens {
6
- interface Space {
7
- type: "space";
6
+ interface Blockquote {
7
+ type: "blockquote";
8
+ raw: string;
9
+ text: string;
10
+ tokens: Token[];
11
+ }
12
+ interface Br {
13
+ type: "br";
8
14
  raw: string;
9
15
  }
16
+ interface Checkbox {
17
+ checked: boolean;
18
+ }
10
19
  interface Code {
11
20
  type: "code";
12
21
  raw: string;
13
- codeBlockStyle?: "indented" | undefined;
14
- lang?: string | undefined;
22
+ codeBlockStyle?: "indented";
23
+ lang?: string;
15
24
  text: string;
16
25
  escaped?: boolean;
17
26
  }
18
- interface Heading {
19
- type: "heading";
27
+ interface Codespan {
28
+ type: "codespan";
20
29
  raw: string;
21
- depth: number;
22
30
  text: string;
23
- tokens: Token[];
24
31
  }
25
- interface Table {
26
- type: "table";
32
+ interface Def {
33
+ type: "def";
27
34
  raw: string;
28
- align: Array<"center" | "left" | "right" | null>;
29
- header: TableCell[];
30
- rows: TableCell[][];
31
- }
32
- interface TableRow {
33
- text: string;
35
+ tag: string;
36
+ href: string;
37
+ title: string;
34
38
  }
35
- interface TableCell {
39
+ interface Del {
40
+ type: "del";
41
+ raw: string;
36
42
  text: string;
37
43
  tokens: Token[];
38
- header: boolean;
39
- align: "center" | "left" | "right" | null;
40
44
  }
41
- interface Hr {
42
- type: "hr";
45
+ interface Em {
46
+ type: "em";
43
47
  raw: string;
48
+ text: string;
49
+ tokens: Token[];
44
50
  }
45
- interface Blockquote {
46
- type: "blockquote";
51
+ interface Escape {
52
+ type: "escape";
47
53
  raw: string;
48
54
  text: string;
49
- tokens: Token[];
50
55
  }
51
- interface List {
52
- type: "list";
56
+ interface Generic {
57
+ [index: string]: any;
58
+ type: string;
53
59
  raw: string;
54
- ordered: boolean;
55
- start: number | "";
56
- loose: boolean;
57
- items: ListItem[];
60
+ tokens?: Token[];
58
61
  }
59
- interface ListItem {
60
- type: "list_item";
62
+ interface Heading {
63
+ type: "heading";
61
64
  raw: string;
62
- task: boolean;
63
- checked?: boolean | undefined;
64
- loose: boolean;
65
+ depth: number;
65
66
  text: string;
66
67
  tokens: Token[];
67
68
  }
68
- interface Checkbox {
69
- checked: boolean;
70
- }
71
- interface Paragraph {
72
- type: "paragraph";
69
+ interface Hr {
70
+ type: "hr";
73
71
  raw: string;
74
- pre?: boolean | undefined;
75
- text: string;
76
- tokens: Token[];
77
72
  }
78
73
  interface HTML {
79
74
  type: "html";
@@ -82,46 +77,48 @@ export declare namespace Tokens {
82
77
  text: string;
83
78
  block: boolean;
84
79
  }
85
- interface Text {
86
- type: "text";
80
+ interface Image {
81
+ type: "image";
87
82
  raw: string;
83
+ href: string;
84
+ title: string | null;
88
85
  text: string;
89
- tokens?: Token[];
90
86
  }
91
- interface Def {
92
- type: "def";
87
+ interface Link {
88
+ type: "link";
93
89
  raw: string;
94
- tag: string;
95
90
  href: string;
96
- title: string;
91
+ title?: string | null;
92
+ text: string;
93
+ tokens: Token[];
97
94
  }
98
- interface Escape {
99
- type: "escape";
95
+ interface List {
96
+ type: "list";
100
97
  raw: string;
101
- text: string;
98
+ ordered: boolean;
99
+ start: number | "";
100
+ loose: boolean;
101
+ items: ListItem[];
102
102
  }
103
- interface Tag {
104
- type: "text" | "html";
103
+ interface ListItem {
104
+ type: "list_item";
105
105
  raw: string;
106
- inLink: boolean;
107
- inRawBlock: boolean;
106
+ task: boolean;
107
+ checked?: boolean;
108
+ loose: boolean;
108
109
  text: string;
109
- block: boolean;
110
+ tokens: Token[];
110
111
  }
111
- interface Link {
112
- type: "link";
112
+ interface Paragraph {
113
+ type: "paragraph";
113
114
  raw: string;
114
- href: string;
115
- title?: string | null;
115
+ pre?: boolean;
116
116
  text: string;
117
117
  tokens: Token[];
118
118
  }
119
- interface Image {
120
- type: "image";
119
+ interface Space {
120
+ type: "space";
121
121
  raw: string;
122
- href: string;
123
- title: string | null;
124
- text: string;
125
122
  }
126
123
  interface Strong {
127
124
  type: "strong";
@@ -129,32 +126,36 @@ export declare namespace Tokens {
129
126
  text: string;
130
127
  tokens: Token[];
131
128
  }
132
- interface Em {
133
- type: "em";
129
+ interface Table {
130
+ type: "table";
134
131
  raw: string;
132
+ align: Array<"center" | "left" | "right" | null>;
133
+ header: TableCell[];
134
+ rows: TableCell[][];
135
+ }
136
+ interface TableCell {
135
137
  text: string;
136
138
  tokens: Token[];
139
+ header: boolean;
140
+ align: "center" | "left" | "right" | null;
137
141
  }
138
- interface Codespan {
139
- type: "codespan";
140
- raw: string;
142
+ interface TableRow {
141
143
  text: string;
142
144
  }
143
- interface Br {
144
- type: "br";
145
- raw: string;
146
- }
147
- interface Del {
148
- type: "del";
145
+ interface Tag {
146
+ type: "html";
149
147
  raw: string;
148
+ inLink: boolean;
149
+ inRawBlock: boolean;
150
150
  text: string;
151
- tokens: Token[];
151
+ block: boolean;
152
152
  }
153
- interface Generic {
154
- [index: string]: any;
155
- type: string;
153
+ interface Text {
154
+ type: "text";
156
155
  raw: string;
157
- tokens?: Token[] | undefined;
156
+ text: string;
157
+ tokens?: Token[];
158
+ escaped?: boolean;
158
159
  }
159
160
  }
160
161
  export type Links = Record<string, Pick<Tokens.Link | Tokens.Image, "href" | "title">>;
@@ -191,7 +192,7 @@ declare class _Renderer {
191
192
  del({ tokens }: Tokens.Del): string;
192
193
  link({ href, title, tokens }: Tokens.Link): string;
193
194
  image({ href, title, text }: Tokens.Image): string;
194
- text(token: Tokens.Text | Tokens.Escape | Tokens.Tag): string;
195
+ text(token: Tokens.Text | Tokens.Escape): string;
195
196
  }
196
197
  /**
197
198
  * TextRenderer
@@ -233,6 +234,64 @@ declare class _Parser {
233
234
  */
234
235
  parseInline(tokens: Token[], renderer?: _Renderer | _TextRenderer): string;
235
236
  }
237
+ declare const other: {
238
+ codeRemoveIndent: RegExp;
239
+ outputLinkReplace: RegExp;
240
+ indentCodeCompensation: RegExp;
241
+ beginningSpace: RegExp;
242
+ endingHash: RegExp;
243
+ startingSpaceChar: RegExp;
244
+ endingSpaceChar: RegExp;
245
+ nonSpaceChar: RegExp;
246
+ newLineCharGlobal: RegExp;
247
+ tabCharGlobal: RegExp;
248
+ multipleSpaceGlobal: RegExp;
249
+ blankLine: RegExp;
250
+ doubleBlankLine: RegExp;
251
+ blockquoteStart: RegExp;
252
+ blockquoteSetextReplace: RegExp;
253
+ blockquoteSetextReplace2: RegExp;
254
+ listReplaceTabs: RegExp;
255
+ listReplaceNesting: RegExp;
256
+ listIsTask: RegExp;
257
+ listReplaceTask: RegExp;
258
+ anyLine: RegExp;
259
+ hrefBrackets: RegExp;
260
+ tableDelimiter: RegExp;
261
+ tableAlignChars: RegExp;
262
+ tableRowBlankLine: RegExp;
263
+ tableAlignRight: RegExp;
264
+ tableAlignCenter: RegExp;
265
+ tableAlignLeft: RegExp;
266
+ startATag: RegExp;
267
+ endATag: RegExp;
268
+ startPreScriptTag: RegExp;
269
+ endPreScriptTag: RegExp;
270
+ startAngleBracket: RegExp;
271
+ endAngleBracket: RegExp;
272
+ pedanticHrefTitle: RegExp;
273
+ unicodeAlphaNumeric: RegExp;
274
+ escapeTest: RegExp;
275
+ escapeReplace: RegExp;
276
+ escapeTestNoEncode: RegExp;
277
+ escapeReplaceNoEncode: RegExp;
278
+ unescapeTest: RegExp;
279
+ caret: RegExp;
280
+ percentDecode: RegExp;
281
+ findPipe: RegExp;
282
+ splitPipe: RegExp;
283
+ slashPipe: RegExp;
284
+ carriageReturn: RegExp;
285
+ spaceLine: RegExp;
286
+ notSpaceStart: RegExp;
287
+ endingNewline: RegExp;
288
+ listItemRegex: (bull: string) => RegExp;
289
+ nextBulletRegex: (indent: number) => RegExp;
290
+ hrRegex: (indent: number) => RegExp;
291
+ fencesBeginRegex: (indent: number) => RegExp;
292
+ headingBeginRegex: (indent: number) => RegExp;
293
+ htmlBeginRegex: (indent: number) => RegExp;
294
+ };
236
295
  declare const blockNormal: {
237
296
  blockquote: RegExp;
238
297
  code: RegExp;
@@ -272,6 +331,7 @@ declare const inlineNormal: {
272
331
  };
273
332
  export type InlineKeys = keyof typeof inlineNormal;
274
333
  export interface Rules {
334
+ other: typeof other;
275
335
  block: Record<BlockKeys, RegExp>;
276
336
  inline: Record<InlineKeys, RegExp>;
277
337
  }
@@ -310,7 +370,7 @@ declare class _Tokenizer {
310
370
  }
311
371
  declare class _Hooks {
312
372
  options: MarkedOptions;
313
- block: boolean | undefined;
373
+ block?: boolean;
314
374
  constructor(options?: MarkedOptions);
315
375
  static passThroughHooks: Set<string>;
316
376
  /**
@@ -342,9 +402,9 @@ export type TokenizerStartFunction = (this: TokenizerThis, src: string) => numbe
342
402
  export interface TokenizerExtension {
343
403
  name: string;
344
404
  level: "block" | "inline";
345
- start?: TokenizerStartFunction | undefined;
405
+ start?: TokenizerStartFunction;
346
406
  tokenizer: TokenizerExtensionFunction;
347
- childTokens?: string[] | undefined;
407
+ childTokens?: string[];
348
408
  }
349
409
  export interface RendererThis {
350
410
  parser: _Parser;
@@ -375,15 +435,15 @@ export interface MarkedExtension {
375
435
  /**
376
436
  * Enable GFM line breaks. This option requires the gfm option to be true.
377
437
  */
378
- breaks?: boolean | undefined;
438
+ breaks?: boolean;
379
439
  /**
380
440
  * Add tokenizers and renderers to marked
381
441
  */
382
- extensions?: TokenizerAndRendererExtension[] | undefined | null;
442
+ extensions?: TokenizerAndRendererExtension[] | null;
383
443
  /**
384
444
  * Enable GitHub flavored markdown.
385
445
  */
386
- gfm?: boolean | undefined;
446
+ gfm?: boolean;
387
447
  /**
388
448
  * Hooks are methods that hook into some part of marked.
389
449
  * preprocess is called to process markdown before sending it to marked.
@@ -392,48 +452,48 @@ export interface MarkedExtension {
392
452
  * provideLexer is called to provide a function to tokenize markdown.
393
453
  * provideParser is called to provide a function to parse tokens.
394
454
  */
395
- hooks?: HooksObject | undefined | null;
455
+ hooks?: HooksObject | null;
396
456
  /**
397
457
  * Conform to obscure parts of markdown.pl as much as possible. Don't fix any of the original markdown bugs or poor behavior.
398
458
  */
399
- pedantic?: boolean | undefined;
459
+ pedantic?: boolean;
400
460
  /**
401
461
  * Type: object Default: new Renderer()
402
462
  *
403
463
  * An object containing functions to render tokens to HTML.
404
464
  */
405
- renderer?: RendererObject | undefined | null;
465
+ renderer?: RendererObject | null;
406
466
  /**
407
467
  * Shows an HTML error message when rendering fails.
408
468
  */
409
- silent?: boolean | undefined;
469
+ silent?: boolean;
410
470
  /**
411
471
  * The tokenizer defines how to turn markdown text into tokens.
412
472
  */
413
- tokenizer?: TokenizerObject | undefined | null;
473
+ tokenizer?: TokenizerObject | null;
414
474
  /**
415
475
  * The walkTokens function gets called with every token.
416
476
  * Child tokens are called before moving on to sibling tokens.
417
477
  * Each token is passed by reference so updates are persisted when passed to the parser.
418
478
  * The return value of the function is ignored.
419
479
  */
420
- walkTokens?: ((token: Token) => void | Promise<void>) | undefined | null;
480
+ walkTokens?: ((token: Token) => void | Promise<void>) | null;
421
481
  }
422
482
  export interface MarkedOptions extends Omit<MarkedExtension, "hooks" | "renderer" | "tokenizer" | "extensions" | "walkTokens"> {
423
483
  /**
424
484
  * Hooks are methods that hook into some part of marked.
425
485
  */
426
- hooks?: _Hooks | undefined | null;
486
+ hooks?: _Hooks | null;
427
487
  /**
428
488
  * Type: object Default: new Renderer()
429
489
  *
430
490
  * An object containing functions to render tokens to HTML.
431
491
  */
432
- renderer?: _Renderer | undefined | null;
492
+ renderer?: _Renderer | null;
433
493
  /**
434
494
  * The tokenizer defines how to turn markdown text into tokens.
435
495
  */
436
- tokenizer?: _Tokenizer | undefined | null;
496
+ tokenizer?: _Tokenizer | null;
437
497
  /**
438
498
  * Custom extensions
439
499
  */
@@ -488,8 +548,8 @@ declare class _Lexer {
488
548
  table: RegExp;
489
549
  text: RegExp;
490
550
  };
491
- gfm: Record<"code" | "blockquote" | "hr" | "html" | "table" | "text" | "heading" | "list" | "paragraph" | "def" | "fences" | "lheading" | "newline", RegExp>;
492
- pedantic: Record<"code" | "blockquote" | "hr" | "html" | "table" | "text" | "heading" | "list" | "paragraph" | "def" | "fences" | "lheading" | "newline", RegExp>;
551
+ gfm: Record<"code" | "blockquote" | "hr" | "html" | "table" | "text" | "def" | "heading" | "list" | "paragraph" | "fences" | "lheading" | "newline", RegExp>;
552
+ pedantic: Record<"code" | "blockquote" | "hr" | "html" | "table" | "text" | "def" | "heading" | "list" | "paragraph" | "fences" | "lheading" | "newline", RegExp>;
493
553
  };
494
554
  inline: {
495
555
  normal: {
@@ -513,9 +573,9 @@ declare class _Lexer {
513
573
  text: RegExp;
514
574
  url: RegExp;
515
575
  };
516
- gfm: Record<"link" | "code" | "url" | "br" | "del" | "text" | "escape" | "tag" | "reflink" | "autolink" | "nolink" | "_backpedal" | "anyPunctuation" | "blockSkip" | "emStrongLDelim" | "emStrongRDelimAst" | "emStrongRDelimUnd" | "punctuation" | "reflinkSearch", RegExp>;
517
- breaks: Record<"link" | "code" | "url" | "br" | "del" | "text" | "escape" | "tag" | "reflink" | "autolink" | "nolink" | "_backpedal" | "anyPunctuation" | "blockSkip" | "emStrongLDelim" | "emStrongRDelimAst" | "emStrongRDelimUnd" | "punctuation" | "reflinkSearch", RegExp>;
518
- pedantic: Record<"link" | "code" | "url" | "br" | "del" | "text" | "escape" | "tag" | "reflink" | "autolink" | "nolink" | "_backpedal" | "anyPunctuation" | "blockSkip" | "emStrongLDelim" | "emStrongRDelimAst" | "emStrongRDelimUnd" | "punctuation" | "reflinkSearch", RegExp>;
576
+ gfm: Record<"link" | "code" | "url" | "br" | "del" | "text" | "escape" | "tag" | "reflink" | "nolink" | "_backpedal" | "anyPunctuation" | "autolink" | "blockSkip" | "emStrongLDelim" | "emStrongRDelimAst" | "emStrongRDelimUnd" | "punctuation" | "reflinkSearch", RegExp>;
577
+ breaks: Record<"link" | "code" | "url" | "br" | "del" | "text" | "escape" | "tag" | "reflink" | "nolink" | "_backpedal" | "anyPunctuation" | "autolink" | "blockSkip" | "emStrongLDelim" | "emStrongRDelimAst" | "emStrongRDelimUnd" | "punctuation" | "reflinkSearch", RegExp>;
578
+ pedantic: Record<"link" | "code" | "url" | "br" | "del" | "text" | "escape" | "tag" | "reflink" | "nolink" | "_backpedal" | "anyPunctuation" | "autolink" | "blockSkip" | "emStrongLDelim" | "emStrongRDelimAst" | "emStrongRDelimUnd" | "punctuation" | "reflinkSearch", RegExp>;
519
579
  };
520
580
  };
521
581
  /**
@@ -557,7 +617,7 @@ export declare class Marked {
557
617
  (src: string, options: MarkedOptions & {
558
618
  async: false;
559
619
  }): string;
560
- (src: string, options?: MarkedOptions | undefined | null): string | Promise<string>;
620
+ (src: string, options?: MarkedOptions | null): string | Promise<string>;
561
621
  };
562
622
  parseInline: {
563
623
  (src: string, options: MarkedOptions & {
@@ -566,7 +626,7 @@ export declare class Marked {
566
626
  (src: string, options: MarkedOptions & {
567
627
  async: false;
568
628
  }): string;
569
- (src: string, options?: MarkedOptions | undefined | null): string | Promise<string>;
629
+ (src: string, options?: MarkedOptions | null): string | Promise<string>;
570
630
  };
571
631
  Parser: typeof _Parser;
572
632
  Renderer: typeof _Renderer;
@@ -609,7 +669,7 @@ export declare function marked(src: string, options: MarkedOptions & {
609
669
  export declare function marked(src: string, options: MarkedOptions & {
610
670
  async: true;
611
671
  }): Promise<string>;
612
- export declare function marked(src: string, options?: MarkedOptions | undefined | null): string | Promise<string>;
672
+ export declare function marked(src: string, options?: MarkedOptions | null): string | Promise<string>;
613
673
  export declare namespace marked {
614
674
  var options: (options: MarkedOptions) => typeof marked;
615
675
  var setOptions: (options: MarkedOptions) => typeof marked;
@@ -624,7 +684,7 @@ export declare namespace marked {
624
684
  (src: string, options: MarkedOptions & {
625
685
  async: false;
626
686
  }): string;
627
- (src: string, options?: MarkedOptions | undefined | null): string | Promise<string>;
687
+ (src: string, options?: MarkedOptions | null): string | Promise<string>;
628
688
  };
629
689
  var Parser: typeof _Parser;
630
690
  var parser: typeof _Parser.parse;
@@ -647,7 +707,7 @@ export declare const parseInline: {
647
707
  (src: string, options: MarkedOptions & {
648
708
  async: false;
649
709
  }): string;
650
- (src: string, options?: MarkedOptions | undefined | null): string | Promise<string>;
710
+ (src: string, options?: MarkedOptions | null): string | Promise<string>;
651
711
  };
652
712
  export declare const parse: typeof marked;
653
713
  export declare const parser: typeof _Parser.parse;