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