1 |
|
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);
|
4 | export type Token = (MarkedToken | Tokens.Generic);
|
5 | export declare namespace Tokens {
|
6 | interface Space {
|
7 | type: "space";
|
8 | raw: string;
|
9 | }
|
10 | interface Code {
|
11 | type: "code";
|
12 | raw: string;
|
13 | codeBlockStyle?: "indented" | undefined;
|
14 | lang?: string | undefined;
|
15 | text: string;
|
16 | escaped?: boolean;
|
17 | }
|
18 | interface Heading {
|
19 | type: "heading";
|
20 | raw: string;
|
21 | depth: number;
|
22 | text: string;
|
23 | tokens: Token[];
|
24 | }
|
25 | interface Table {
|
26 | type: "table";
|
27 | raw: string;
|
28 | align: Array<"center" | "left" | "right" | null>;
|
29 | header: TableCell[];
|
30 | rows: TableCell[][];
|
31 | }
|
32 | interface TableRow {
|
33 | text: string;
|
34 | }
|
35 | interface TableCell {
|
36 | text: string;
|
37 | tokens: Token[];
|
38 | header: boolean;
|
39 | align: "center" | "left" | "right" | null;
|
40 | }
|
41 | interface Hr {
|
42 | type: "hr";
|
43 | raw: string;
|
44 | }
|
45 | interface Blockquote {
|
46 | type: "blockquote";
|
47 | raw: string;
|
48 | text: string;
|
49 | tokens: Token[];
|
50 | }
|
51 | interface List {
|
52 | type: "list";
|
53 | raw: string;
|
54 | ordered: boolean;
|
55 | start: number | "";
|
56 | loose: boolean;
|
57 | items: ListItem[];
|
58 | }
|
59 | interface ListItem {
|
60 | type: "list_item";
|
61 | raw: string;
|
62 | task: boolean;
|
63 | checked?: boolean | undefined;
|
64 | loose: boolean;
|
65 | text: string;
|
66 | tokens: Token[];
|
67 | }
|
68 | interface Checkbox {
|
69 | checked: boolean;
|
70 | }
|
71 | interface Paragraph {
|
72 | type: "paragraph";
|
73 | raw: string;
|
74 | pre?: boolean | undefined;
|
75 | text: string;
|
76 | tokens: Token[];
|
77 | }
|
78 | interface HTML {
|
79 | type: "html";
|
80 | raw: string;
|
81 | pre: boolean;
|
82 | text: string;
|
83 | block: boolean;
|
84 | }
|
85 | interface Text {
|
86 | type: "text";
|
87 | raw: string;
|
88 | text: string;
|
89 | tokens?: Token[];
|
90 | }
|
91 | interface Def {
|
92 | type: "def";
|
93 | raw: string;
|
94 | tag: string;
|
95 | href: string;
|
96 | title: string;
|
97 | }
|
98 | interface Escape {
|
99 | type: "escape";
|
100 | raw: string;
|
101 | text: string;
|
102 | }
|
103 | interface Tag {
|
104 | type: "text" | "html";
|
105 | raw: string;
|
106 | inLink: boolean;
|
107 | inRawBlock: boolean;
|
108 | text: string;
|
109 | block: boolean;
|
110 | }
|
111 | interface Link {
|
112 | type: "link";
|
113 | raw: string;
|
114 | href: string;
|
115 | title?: string | null;
|
116 | text: string;
|
117 | tokens: Token[];
|
118 | }
|
119 | interface Image {
|
120 | type: "image";
|
121 | raw: string;
|
122 | href: string;
|
123 | title: string | null;
|
124 | text: string;
|
125 | }
|
126 | interface Strong {
|
127 | type: "strong";
|
128 | raw: string;
|
129 | text: string;
|
130 | tokens: Token[];
|
131 | }
|
132 | interface Em {
|
133 | type: "em";
|
134 | raw: string;
|
135 | text: string;
|
136 | tokens: Token[];
|
137 | }
|
138 | interface Codespan {
|
139 | type: "codespan";
|
140 | raw: string;
|
141 | text: string;
|
142 | }
|
143 | interface Br {
|
144 | type: "br";
|
145 | raw: string;
|
146 | }
|
147 | interface Del {
|
148 | type: "del";
|
149 | raw: string;
|
150 | text: string;
|
151 | tokens: Token[];
|
152 | }
|
153 | interface Generic {
|
154 | [index: string]: any;
|
155 | type: string;
|
156 | raw: string;
|
157 | tokens?: Token[] | undefined;
|
158 | }
|
159 | }
|
160 | export type Links = Record<string, Pick<Tokens.Link | Tokens.Image, "href" | "title">>;
|
161 | export type TokensList = Token[] & {
|
162 | links: Links;
|
163 | };
|
164 |
|
165 |
|
166 |
|
167 | declare class _Renderer {
|
168 | options: MarkedOptions;
|
169 | parser: _Parser;
|
170 | constructor(options?: MarkedOptions);
|
171 | space(token: Tokens.Space): string;
|
172 | code({ text, lang, escaped }: Tokens.Code): string;
|
173 | blockquote({ tokens }: Tokens.Blockquote): string;
|
174 | html({ text }: Tokens.HTML | Tokens.Tag): string;
|
175 | heading({ tokens, depth }: Tokens.Heading): string;
|
176 | hr(token: Tokens.Hr): string;
|
177 | list(token: Tokens.List): string;
|
178 | listitem(item: Tokens.ListItem): string;
|
179 | checkbox({ checked }: Tokens.Checkbox): string;
|
180 | paragraph({ tokens }: Tokens.Paragraph): string;
|
181 | table(token: Tokens.Table): string;
|
182 | tablerow({ text }: Tokens.TableRow): string;
|
183 | tablecell(token: Tokens.TableCell): string;
|
184 | /**
|
185 | * span level renderer
|
186 | */
|
187 | strong({ tokens }: Tokens.Strong): string;
|
188 | em({ tokens }: Tokens.Em): string;
|
189 | codespan({ text }: Tokens.Codespan): string;
|
190 | br(token: Tokens.Br): string;
|
191 | del({ tokens }: Tokens.Del): string;
|
192 | link({ href, title, tokens }: Tokens.Link): string;
|
193 | image({ href, title, text }: Tokens.Image): string;
|
194 | text(token: Tokens.Text | Tokens.Escape | Tokens.Tag): string;
|
195 | }
|
196 | /**
|
197 | * TextRenderer
|
198 | * returns only the textual part of the token
|
199 | */
|
200 | declare class _TextRenderer {
|
201 | strong({ text }: Tokens.Strong): string;
|
202 | em({ text }: Tokens.Em): string;
|
203 | codespan({ text }: Tokens.Codespan): string;
|
204 | del({ text }: Tokens.Del): string;
|
205 | html({ text }: Tokens.HTML | Tokens.Tag): string;
|
206 | text({ text }: Tokens.Text | Tokens.Escape | Tokens.Tag): string;
|
207 | link({ text }: Tokens.Link): string;
|
208 | image({ text }: Tokens.Image): string;
|
209 | br(): string;
|
210 | }
|
211 |
|
212 |
|
213 |
|
214 | declare class _Parser {
|
215 | options: MarkedOptions;
|
216 | renderer: _Renderer;
|
217 | textRenderer: _TextRenderer;
|
218 | constructor(options?: MarkedOptions);
|
219 | /**
|
220 | * Static Parse Method
|
221 | */
|
222 | static parse(tokens: Token[], options?: MarkedOptions): string;
|
223 | /**
|
224 | * Static Parse Inline Method
|
225 | */
|
226 | static parseInline(tokens: Token[], options?: MarkedOptions): string;
|
227 | /**
|
228 | * Parse Loop
|
229 | */
|
230 | parse(tokens: Token[], top?: boolean): string;
|
231 | /**
|
232 | * Parse Inline Tokens
|
233 | */
|
234 | parseInline(tokens: Token[], renderer?: _Renderer | _TextRenderer): string;
|
235 | }
|
236 | declare const blockNormal: {
|
237 | blockquote: RegExp;
|
238 | code: RegExp;
|
239 | def: RegExp;
|
240 | fences: RegExp;
|
241 | heading: RegExp;
|
242 | hr: RegExp;
|
243 | html: RegExp;
|
244 | lheading: RegExp;
|
245 | list: RegExp;
|
246 | newline: RegExp;
|
247 | paragraph: RegExp;
|
248 | table: RegExp;
|
249 | text: RegExp;
|
250 | };
|
251 | export type BlockKeys = keyof typeof blockNormal;
|
252 | declare const inlineNormal: {
|
253 | _backpedal: RegExp;
|
254 | anyPunctuation: RegExp;
|
255 | autolink: RegExp;
|
256 | blockSkip: RegExp;
|
257 | br: RegExp;
|
258 | code: RegExp;
|
259 | del: RegExp;
|
260 | emStrongLDelim: RegExp;
|
261 | emStrongRDelimAst: RegExp;
|
262 | emStrongRDelimUnd: RegExp;
|
263 | escape: RegExp;
|
264 | link: RegExp;
|
265 | nolink: RegExp;
|
266 | punctuation: RegExp;
|
267 | reflink: RegExp;
|
268 | reflinkSearch: RegExp;
|
269 | tag: RegExp;
|
270 | text: RegExp;
|
271 | url: RegExp;
|
272 | };
|
273 | export type InlineKeys = keyof typeof inlineNormal;
|
274 |
|
275 |
|
276 |
|
277 | export declare const block: {
|
278 | normal: {
|
279 | blockquote: RegExp;
|
280 | code: RegExp;
|
281 | def: RegExp;
|
282 | fences: RegExp;
|
283 | heading: RegExp;
|
284 | hr: RegExp;
|
285 | html: RegExp;
|
286 | lheading: RegExp;
|
287 | list: RegExp;
|
288 | newline: RegExp;
|
289 | paragraph: RegExp;
|
290 | table: RegExp;
|
291 | text: RegExp;
|
292 | };
|
293 | gfm: Record<"code" | "blockquote" | "hr" | "html" | "table" | "text" | "heading" | "list" | "paragraph" | "def" | "fences" | "lheading" | "newline", RegExp>;
|
294 | pedantic: Record<"code" | "blockquote" | "hr" | "html" | "table" | "text" | "heading" | "list" | "paragraph" | "def" | "fences" | "lheading" | "newline", RegExp>;
|
295 | };
|
296 | export declare const inline: {
|
297 | normal: {
|
298 | _backpedal: RegExp;
|
299 | anyPunctuation: RegExp;
|
300 | autolink: RegExp;
|
301 | blockSkip: RegExp;
|
302 | br: RegExp;
|
303 | code: RegExp;
|
304 | del: RegExp;
|
305 | emStrongLDelim: RegExp;
|
306 | emStrongRDelimAst: RegExp;
|
307 | emStrongRDelimUnd: RegExp;
|
308 | escape: RegExp;
|
309 | link: RegExp;
|
310 | nolink: RegExp;
|
311 | punctuation: RegExp;
|
312 | reflink: RegExp;
|
313 | reflinkSearch: RegExp;
|
314 | tag: RegExp;
|
315 | text: RegExp;
|
316 | url: RegExp;
|
317 | };
|
318 | gfm: Record<"link" | "code" | "url" | "br" | "del" | "text" | "escape" | "tag" | "reflink" | "autolink" | "nolink" | "_backpedal" | "anyPunctuation" | "blockSkip" | "emStrongLDelim" | "emStrongRDelimAst" | "emStrongRDelimUnd" | "punctuation" | "reflinkSearch", RegExp>;
|
319 | breaks: Record<"link" | "code" | "url" | "br" | "del" | "text" | "escape" | "tag" | "reflink" | "autolink" | "nolink" | "_backpedal" | "anyPunctuation" | "blockSkip" | "emStrongLDelim" | "emStrongRDelimAst" | "emStrongRDelimUnd" | "punctuation" | "reflinkSearch", RegExp>;
|
320 | pedantic: Record<"link" | "code" | "url" | "br" | "del" | "text" | "escape" | "tag" | "reflink" | "autolink" | "nolink" | "_backpedal" | "anyPunctuation" | "blockSkip" | "emStrongLDelim" | "emStrongRDelimAst" | "emStrongRDelimUnd" | "punctuation" | "reflinkSearch", RegExp>;
|
321 | };
|
322 | export interface Rules {
|
323 | block: Record<BlockKeys, RegExp>;
|
324 | inline: Record<InlineKeys, RegExp>;
|
325 | }
|
326 |
|
327 |
|
328 |
|
329 | declare class _Tokenizer {
|
330 | options: MarkedOptions;
|
331 | rules: Rules;
|
332 | lexer: _Lexer;
|
333 | constructor(options?: MarkedOptions);
|
334 | space(src: string): Tokens.Space | undefined;
|
335 | code(src: string): Tokens.Code | undefined;
|
336 | fences(src: string): Tokens.Code | undefined;
|
337 | heading(src: string): Tokens.Heading | undefined;
|
338 | hr(src: string): Tokens.Hr | undefined;
|
339 | blockquote(src: string): Tokens.Blockquote | undefined;
|
340 | list(src: string): Tokens.List | undefined;
|
341 | html(src: string): Tokens.HTML | undefined;
|
342 | def(src: string): Tokens.Def | undefined;
|
343 | table(src: string): Tokens.Table | undefined;
|
344 | lheading(src: string): Tokens.Heading | undefined;
|
345 | paragraph(src: string): Tokens.Paragraph | undefined;
|
346 | text(src: string): Tokens.Text | undefined;
|
347 | escape(src: string): Tokens.Escape | undefined;
|
348 | tag(src: string): Tokens.Tag | undefined;
|
349 | link(src: string): Tokens.Link | Tokens.Image | undefined;
|
350 | reflink(src: string, links: Links): Tokens.Link | Tokens.Image | Tokens.Text | undefined;
|
351 | emStrong(src: string, maskedSrc: string, prevChar?: string): Tokens.Em | Tokens.Strong | undefined;
|
352 | codespan(src: string): Tokens.Codespan | undefined;
|
353 | br(src: string): Tokens.Br | undefined;
|
354 | del(src: string): Tokens.Del | undefined;
|
355 | autolink(src: string): Tokens.Link | undefined;
|
356 | url(src: string): Tokens.Link | undefined;
|
357 | inlineText(src: string): Tokens.Text | undefined;
|
358 | }
|
359 | declare class _Hooks {
|
360 | options: MarkedOptions;
|
361 | constructor(options?: MarkedOptions);
|
362 | static passThroughHooks: Set<string>;
|
363 | /**
|
364 | * Process markdown before marked
|
365 | */
|
366 | preprocess(markdown: string): string;
|
367 | /**
|
368 | * Process HTML after marked is finished
|
369 | */
|
370 | postprocess(html: string): string;
|
371 | /**
|
372 | * Process all tokens before walk tokens
|
373 | */
|
374 | processAllTokens(tokens: Token[] | TokensList): Token[] | TokensList;
|
375 | }
|
376 | export interface TokenizerThis {
|
377 | lexer: _Lexer;
|
378 | }
|
379 | export type TokenizerExtensionFunction = (this: TokenizerThis, src: string, tokens: Token[] | TokensList) => Tokens.Generic | undefined;
|
380 | export type TokenizerStartFunction = (this: TokenizerThis, src: string) => number | void;
|
381 | export interface TokenizerExtension {
|
382 | name: string;
|
383 | level: "block" | "inline";
|
384 | start?: TokenizerStartFunction | undefined;
|
385 | tokenizer: TokenizerExtensionFunction;
|
386 | childTokens?: string[] | undefined;
|
387 | }
|
388 | export interface RendererThis {
|
389 | parser: _Parser;
|
390 | }
|
391 | export type RendererExtensionFunction = (this: RendererThis, token: Tokens.Generic) => string | false | undefined;
|
392 | export interface RendererExtension {
|
393 | name: string;
|
394 | renderer: RendererExtensionFunction;
|
395 | }
|
396 | export type TokenizerAndRendererExtension = TokenizerExtension | RendererExtension | (TokenizerExtension & RendererExtension);
|
397 | export type HooksApi = Omit<_Hooks, "constructor" | "options">;
|
398 | export type HooksObject = {
|
399 | [K in keyof HooksApi]?: (this: _Hooks, ...args: Parameters<HooksApi[K]>) => ReturnType<HooksApi[K]> | Promise<ReturnType<HooksApi[K]>>;
|
400 | };
|
401 | export type RendererApi = Omit<_Renderer, "constructor" | "options" | "parser">;
|
402 | export type RendererObject = {
|
403 | [K in keyof RendererApi]?: (this: _Renderer, ...args: Parameters<RendererApi[K]>) => ReturnType<RendererApi[K]> | false;
|
404 | };
|
405 | export type TokenizerApi = Omit<_Tokenizer, "constructor" | "options" | "rules" | "lexer">;
|
406 | export type TokenizerObject = {
|
407 | [K in keyof TokenizerApi]?: (this: _Tokenizer, ...args: Parameters<TokenizerApi[K]>) => ReturnType<TokenizerApi[K]> | false;
|
408 | };
|
409 | export interface MarkedExtension {
|
410 | |
411 |
|
412 |
|
413 | async?: boolean;
|
414 | |
415 |
|
416 |
|
417 | breaks?: boolean | undefined;
|
418 | |
419 |
|
420 |
|
421 | extensions?: TokenizerAndRendererExtension[] | undefined | null;
|
422 | |
423 |
|
424 |
|
425 | gfm?: boolean | undefined;
|
426 | |
427 |
|
428 |
|
429 |
|
430 |
|
431 |
|
432 | hooks?: HooksObject | undefined | null;
|
433 | |
434 |
|
435 |
|
436 | pedantic?: boolean | undefined;
|
437 | |
438 |
|
439 |
|
440 |
|
441 |
|
442 | renderer?: RendererObject | undefined | null;
|
443 | |
444 |
|
445 |
|
446 | silent?: boolean | undefined;
|
447 | |
448 |
|
449 |
|
450 | tokenizer?: TokenizerObject | undefined | null;
|
451 | |
452 |
|
453 |
|
454 |
|
455 |
|
456 |
|
457 | walkTokens?: ((token: Token) => void | Promise<void>) | undefined | null;
|
458 | /**
|
459 | * Use the new renderer that accepts an object instead of individual parameters.
|
460 | * This option will be removed and default to true in the next major version.
|
461 | */
|
462 | useNewRenderer?: boolean | undefined;
|
463 | }
|
464 | export interface MarkedOptions extends Omit<MarkedExtension, "useNewRenderer" | "hooks" | "renderer" | "tokenizer" | "extensions" | "walkTokens"> {
|
465 | /**
|
466 | * Hooks are methods that hook into some part of marked.
|
467 | */
|
468 | hooks?: _Hooks | undefined | null;
|
469 | /**
|
470 | * Type: object Default: new Renderer()
|
471 | *
|
472 | * An object containing functions to render tokens to HTML.
|
473 | */
|
474 | renderer?: _Renderer | undefined | null;
|
475 | /**
|
476 | * The tokenizer defines how to turn markdown text into tokens.
|
477 | */
|
478 | tokenizer?: _Tokenizer | undefined | null;
|
479 | /**
|
480 | * Custom extensions
|
481 | */
|
482 | extensions?: null | {
|
483 | renderers: {
|
484 | [name: string]: RendererExtensionFunction;
|
485 | };
|
486 | childTokens: {
|
487 | [name: string]: string[];
|
488 | };
|
489 | inline?: TokenizerExtensionFunction[];
|
490 | block?: TokenizerExtensionFunction[];
|
491 | startInline?: TokenizerStartFunction[];
|
492 | startBlock?: TokenizerStartFunction[];
|
493 | };
|
494 | /**
|
495 | * walkTokens function returns array of values for Promise.all
|
496 | */
|
497 | walkTokens?: null | ((token: Token) => void | Promise<void> | (void | Promise<void>)[]);
|
498 | }
|
499 | /**
|
500 | * Block Lexer
|
501 | */
|
502 | declare class _Lexer {
|
503 | tokens: TokensList;
|
504 | options: MarkedOptions;
|
505 | state: {
|
506 | inLink: boolean;
|
507 | inRawBlock: boolean;
|
508 | top: boolean;
|
509 | };
|
510 | private tokenizer;
|
511 | private inlineQueue;
|
512 | constructor(options?: MarkedOptions);
|
513 | /**
|
514 | * Expose Rules
|
515 | */
|
516 | static get rules(): {
|
517 | block: {
|
518 | normal: {
|
519 | blockquote: RegExp;
|
520 | code: RegExp;
|
521 | def: RegExp;
|
522 | fences: RegExp;
|
523 | heading: RegExp;
|
524 | hr: RegExp;
|
525 | html: RegExp;
|
526 | lheading: RegExp;
|
527 | list: RegExp;
|
528 | newline: RegExp;
|
529 | paragraph: RegExp;
|
530 | table: RegExp;
|
531 | text: RegExp;
|
532 | };
|
533 | gfm: Record<"code" | "blockquote" | "hr" | "html" | "table" | "text" | "heading" | "list" | "paragraph" | "def" | "fences" | "lheading" | "newline", RegExp>;
|
534 | pedantic: Record<"code" | "blockquote" | "hr" | "html" | "table" | "text" | "heading" | "list" | "paragraph" | "def" | "fences" | "lheading" | "newline", RegExp>;
|
535 | };
|
536 | inline: {
|
537 | normal: {
|
538 | _backpedal: RegExp;
|
539 | anyPunctuation: RegExp;
|
540 | autolink: RegExp;
|
541 | blockSkip: RegExp;
|
542 | br: RegExp;
|
543 | code: RegExp;
|
544 | del: RegExp;
|
545 | emStrongLDelim: RegExp;
|
546 | emStrongRDelimAst: RegExp;
|
547 | emStrongRDelimUnd: RegExp;
|
548 | escape: RegExp;
|
549 | link: RegExp;
|
550 | nolink: RegExp;
|
551 | punctuation: RegExp;
|
552 | reflink: RegExp;
|
553 | reflinkSearch: RegExp;
|
554 | tag: RegExp;
|
555 | text: RegExp;
|
556 | url: RegExp;
|
557 | };
|
558 | gfm: Record<"link" | "code" | "url" | "br" | "del" | "text" | "escape" | "tag" | "reflink" | "autolink" | "nolink" | "_backpedal" | "anyPunctuation" | "blockSkip" | "emStrongLDelim" | "emStrongRDelimAst" | "emStrongRDelimUnd" | "punctuation" | "reflinkSearch", RegExp>;
|
559 | breaks: Record<"link" | "code" | "url" | "br" | "del" | "text" | "escape" | "tag" | "reflink" | "autolink" | "nolink" | "_backpedal" | "anyPunctuation" | "blockSkip" | "emStrongLDelim" | "emStrongRDelimAst" | "emStrongRDelimUnd" | "punctuation" | "reflinkSearch", RegExp>;
|
560 | pedantic: Record<"link" | "code" | "url" | "br" | "del" | "text" | "escape" | "tag" | "reflink" | "autolink" | "nolink" | "_backpedal" | "anyPunctuation" | "blockSkip" | "emStrongLDelim" | "emStrongRDelimAst" | "emStrongRDelimUnd" | "punctuation" | "reflinkSearch", RegExp>;
|
561 | };
|
562 | };
|
563 | /**
|
564 | * Static Lex Method
|
565 | */
|
566 | static lex(src: string, options?: MarkedOptions): TokensList;
|
567 | /**
|
568 | * Static Lex Inline Method
|
569 | */
|
570 | static lexInline(src: string, options?: MarkedOptions): Token[];
|
571 | /**
|
572 | * Preprocessing
|
573 | */
|
574 | lex(src: string): TokensList;
|
575 | /**
|
576 | * Lexing
|
577 | */
|
578 | blockTokens(src: string, tokens?: Token[], lastParagraphClipped?: boolean): Token[];
|
579 | blockTokens(src: string, tokens?: TokensList, lastParagraphClipped?: boolean): TokensList;
|
580 | inline(src: string, tokens?: Token[]): Token[];
|
581 | /**
|
582 | * Lexing/Compiling
|
583 | */
|
584 | inlineTokens(src: string, tokens?: Token[]): Token[];
|
585 | }
|
586 | /**
|
587 | * Gets the original marked default options.
|
588 | */
|
589 | declare function _getDefaults(): MarkedOptions;
|
590 | declare let _defaults: MarkedOptions;
|
591 | export type MaybePromise = void | Promise<void>;
|
592 | export declare class Marked {
|
593 | #private;
|
594 | defaults: MarkedOptions;
|
595 | options: (opt: MarkedOptions) => this;
|
596 | parse: (src: string, options?: MarkedOptions | undefined | null) => string | Promise<string>;
|
597 | parseInline: (src: string, options?: MarkedOptions | undefined | null) => string | Promise<string>;
|
598 | Parser: typeof _Parser;
|
599 | Renderer: typeof _Renderer;
|
600 | TextRenderer: typeof _TextRenderer;
|
601 | Lexer: typeof _Lexer;
|
602 | Tokenizer: typeof _Tokenizer;
|
603 | Hooks: typeof _Hooks;
|
604 | constructor(...args: MarkedExtension[]);
|
605 | /**
|
606 | * Run callback for every token
|
607 | */
|
608 | walkTokens(tokens: Token[] | TokensList, callback: (token: Token) => MaybePromise | MaybePromise[]): MaybePromise[];
|
609 | use(...args: MarkedExtension[]): this;
|
610 | setOptions(opt: MarkedOptions): this;
|
611 | lexer(src: string, options?: MarkedOptions): TokensList;
|
612 | parser(tokens: Token[], options?: MarkedOptions): string;
|
613 | }
|
614 | /**
|
615 | * Compiles markdown to HTML asynchronously.
|
616 | *
|
617 | * @param src String of markdown source to be compiled
|
618 | * @param options Hash of options, having async: true
|
619 | * @return Promise of string of compiled HTML
|
620 | */
|
621 | export declare function marked(src: string, options: MarkedOptions & {
|
622 | async: true;
|
623 | }): Promise<string>;
|
624 | /**
|
625 | * Compiles markdown to HTML.
|
626 | *
|
627 | * @param src String of markdown source to be compiled
|
628 | * @param options Optional hash of options
|
629 | * @return String of compiled HTML. Will be a Promise of string if async is set to true by any extensions.
|
630 | */
|
631 | export declare function marked(src: string, options?: MarkedOptions): string | Promise<string>;
|
632 | export declare namespace marked {
|
633 | var options: (options: MarkedOptions) => typeof marked;
|
634 | var setOptions: (options: MarkedOptions) => typeof marked;
|
635 | var getDefaults: typeof _getDefaults;
|
636 | var defaults: MarkedOptions;
|
637 | var use: (...args: MarkedExtension[]) => typeof marked;
|
638 | var walkTokens: (tokens: Token[] | TokensList, callback: (token: Token) => MaybePromise | MaybePromise[]) => MaybePromise[];
|
639 | var parseInline: (src: string, options?: MarkedOptions | undefined | null) => string | Promise<string>;
|
640 | var Parser: typeof _Parser;
|
641 | var parser: typeof _Parser.parse;
|
642 | var Renderer: typeof _Renderer;
|
643 | var TextRenderer: typeof _TextRenderer;
|
644 | var Lexer: typeof _Lexer;
|
645 | var lexer: typeof _Lexer.lex;
|
646 | var Tokenizer: typeof _Tokenizer;
|
647 | var Hooks: typeof _Hooks;
|
648 | var parse: typeof marked;
|
649 | }
|
650 | export declare const options: (options: MarkedOptions) => typeof marked;
|
651 | export declare const setOptions: (options: MarkedOptions) => typeof marked;
|
652 | export declare const use: (...args: MarkedExtension[]) => typeof marked;
|
653 | export declare const walkTokens: (tokens: Token[] | TokensList, callback: (token: Token) => MaybePromise | MaybePromise[]) => MaybePromise[];
|
654 | export declare const parseInline: (src: string, options?: MarkedOptions | undefined | null) => string | Promise<string>;
|
655 | export declare const parse: typeof marked;
|
656 | export declare const parser: typeof _Parser.parse;
|
657 | export declare const lexer: typeof _Lexer.lex;
|
658 |
|
659 | export {
|
660 | _Hooks as Hooks,
|
661 | _Lexer as Lexer,
|
662 | _Parser as Parser,
|
663 | _Renderer as Renderer,
|
664 | _TextRenderer as TextRenderer,
|
665 | _Tokenizer as Tokenizer,
|
666 | _defaults as defaults,
|
667 | _getDefaults as getDefaults,
|
668 | };
|
669 |
|
670 | export {};
|