marked 7.0.2 → 7.0.4
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 +144 -109
- package/lib/marked.cjs.map +1 -1
- package/lib/marked.d.ts +28 -28
- package/lib/marked.esm.js +144 -109
- package/lib/marked.esm.js.map +1 -1
- package/lib/marked.umd.js +144 -109
- package/lib/marked.umd.js.map +1 -1
- package/marked.min.js +3 -3
- package/package.json +4 -3
package/lib/marked.d.ts
CHANGED
|
@@ -1,8 +1,5 @@
|
|
|
1
1
|
declare module "Tokens" {
|
|
2
|
-
export type Token = (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 | Tokens.Generic)
|
|
3
|
-
loose?: boolean;
|
|
4
|
-
tokens?: Token[];
|
|
5
|
-
};
|
|
2
|
+
export type Token = (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 | Tokens.Generic);
|
|
6
3
|
export namespace Tokens {
|
|
7
4
|
interface Space {
|
|
8
5
|
type: 'space';
|
|
@@ -32,7 +29,7 @@ declare module "Tokens" {
|
|
|
32
29
|
}
|
|
33
30
|
interface TableCell {
|
|
34
31
|
text: string;
|
|
35
|
-
tokens
|
|
32
|
+
tokens: Token[];
|
|
36
33
|
}
|
|
37
34
|
interface Hr {
|
|
38
35
|
type: 'hr';
|
|
@@ -59,7 +56,7 @@ declare module "Tokens" {
|
|
|
59
56
|
checked?: boolean | undefined;
|
|
60
57
|
loose: boolean;
|
|
61
58
|
text: string;
|
|
62
|
-
tokens
|
|
59
|
+
tokens: Token[];
|
|
63
60
|
}
|
|
64
61
|
interface Paragraph {
|
|
65
62
|
type: 'paragraph';
|
|
@@ -441,11 +438,13 @@ declare module "MarkedOptions" {
|
|
|
441
438
|
export interface TokenizerThis {
|
|
442
439
|
lexer: _Lexer;
|
|
443
440
|
}
|
|
441
|
+
export type TokenizerExtensionFunction = (this: TokenizerThis, src: string, tokens: Token[] | TokensList) => Tokens.Generic | undefined;
|
|
442
|
+
export type TokenizerStartFunction = (this: TokenizerThis, src: string) => number | void;
|
|
444
443
|
export interface TokenizerExtension {
|
|
445
444
|
name: string;
|
|
446
445
|
level: 'block' | 'inline';
|
|
447
|
-
start?:
|
|
448
|
-
tokenizer:
|
|
446
|
+
start?: TokenizerStartFunction | undefined;
|
|
447
|
+
tokenizer: TokenizerExtensionFunction;
|
|
449
448
|
childTokens?: string[] | undefined;
|
|
450
449
|
}
|
|
451
450
|
export interface RendererThis {
|
|
@@ -568,42 +567,43 @@ declare module "MarkedOptions" {
|
|
|
568
567
|
* Each token is passed by reference so updates are persisted when passed to the parser.
|
|
569
568
|
* The return value of the function is ignored.
|
|
570
569
|
*/
|
|
571
|
-
walkTokens?: ((token: Token) => void | Promise<void>) | undefined | null;
|
|
570
|
+
walkTokens?: ((token: Token) => void | unknown | Promise<void>) | undefined | null;
|
|
572
571
|
/**
|
|
573
572
|
* Generate closing slash for self-closing tags (<br/> instead of <br>)
|
|
574
573
|
* @deprecated Deprecated in v5.0.0 use marked-xhtml to emit self-closing HTML tags for void elements (<br/>, <img/>, etc.) with a "/" as required by XHTML.
|
|
575
574
|
*/
|
|
576
575
|
xhtml?: boolean | undefined;
|
|
577
576
|
}
|
|
578
|
-
export interface MarkedOptions extends Omit<MarkedExtension, '
|
|
577
|
+
export interface MarkedOptions extends Omit<MarkedExtension, 'renderer' | 'tokenizer' | 'extensions' | 'walkTokens'> {
|
|
579
578
|
/**
|
|
580
579
|
* Type: object Default: new Renderer()
|
|
581
580
|
*
|
|
582
581
|
* An object containing functions to render tokens to HTML.
|
|
583
582
|
*/
|
|
584
|
-
renderer?:
|
|
583
|
+
renderer?: _Renderer | undefined | null;
|
|
585
584
|
/**
|
|
586
585
|
* The tokenizer defines how to turn markdown text into tokens.
|
|
587
586
|
*/
|
|
588
|
-
tokenizer?:
|
|
589
|
-
/**
|
|
590
|
-
*
|
|
591
|
-
|
|
592
|
-
|
|
593
|
-
|
|
594
|
-
|
|
595
|
-
|
|
587
|
+
tokenizer?: _Tokenizer | undefined | null;
|
|
588
|
+
/**
|
|
589
|
+
* Custom extensions
|
|
590
|
+
*/
|
|
591
|
+
extensions?: null | {
|
|
592
|
+
renderers: {
|
|
593
|
+
[name: string]: RendererExtensionFunction;
|
|
594
|
+
};
|
|
595
|
+
childTokens: {
|
|
596
|
+
[name: string]: string[];
|
|
597
|
+
};
|
|
598
|
+
inline?: TokenizerExtensionFunction[];
|
|
599
|
+
block?: TokenizerExtensionFunction[];
|
|
600
|
+
startInline?: TokenizerStartFunction[];
|
|
601
|
+
startBlock?: TokenizerStartFunction[];
|
|
602
|
+
};
|
|
596
603
|
/**
|
|
597
|
-
*
|
|
604
|
+
* walkTokens function returns array of values for Promise.all
|
|
598
605
|
*/
|
|
599
|
-
|
|
600
|
-
renderers: Record<string, RendererExtensionFunction>;
|
|
601
|
-
childTokens: Record<string, string[]>;
|
|
602
|
-
block: any[];
|
|
603
|
-
inline: any[];
|
|
604
|
-
startBlock: Array<(this: TokenizerThis, src: string) => number | void>;
|
|
605
|
-
startInline: Array<(this: TokenizerThis, src: string) => number | void>;
|
|
606
|
-
}) | undefined | null;
|
|
606
|
+
walkTokens?: null | ((token: Token) => void | (unknown | Promise<void>)[]);
|
|
607
607
|
}
|
|
608
608
|
}
|
|
609
609
|
declare module "defaults" {
|