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 | escaped?: boolean;
|
91 | }
|
92 | interface Def {
|
93 | type: "def";
|
94 | raw: string;
|
95 | tag: string;
|
96 | href: string;
|
97 | title: string;
|
98 | }
|
99 | interface Escape {
|
100 | type: "escape";
|
101 | raw: string;
|
102 | text: string;
|
103 | }
|
104 | interface Tag {
|
105 | type: "html";
|
106 | raw: string;
|
107 | inLink: boolean;
|
108 | inRawBlock: boolean;
|
109 | text: string;
|
110 | block: boolean;
|
111 | }
|
112 | interface Link {
|
113 | type: "link";
|
114 | raw: string;
|
115 | href: string;
|
116 | title?: string | null;
|
117 | text: string;
|
118 | tokens: Token[];
|
119 | }
|
120 | interface Image {
|
121 | type: "image";
|
122 | raw: string;
|
123 | href: string;
|
124 | title: string | null;
|
125 | text: string;
|
126 | }
|
127 | interface Strong {
|
128 | type: "strong";
|
129 | raw: string;
|
130 | text: string;
|
131 | tokens: Token[];
|
132 | }
|
133 | interface Em {
|
134 | type: "em";
|
135 | raw: string;
|
136 | text: string;
|
137 | tokens: Token[];
|
138 | }
|
139 | interface Codespan {
|
140 | type: "codespan";
|
141 | raw: string;
|
142 | text: string;
|
143 | }
|
144 | interface Br {
|
145 | type: "br";
|
146 | raw: string;
|
147 | }
|
148 | interface Del {
|
149 | type: "del";
|
150 | raw: string;
|
151 | text: string;
|
152 | tokens: Token[];
|
153 | }
|
154 | interface Generic {
|
155 | [index: string]: any;
|
156 | type: string;
|
157 | raw: string;
|
158 | tokens?: Token[] | undefined;
|
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 | undefined;
|
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 | undefined;
|
406 | tokenizer: TokenizerExtensionFunction;
|
407 | childTokens?: string[] | undefined;
|
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 | undefined;
|
439 | |
440 |
|
441 |
|
442 | extensions?: TokenizerAndRendererExtension[] | undefined | null;
|
443 | |
444 |
|
445 |
|
446 | gfm?: boolean | undefined;
|
447 | |
448 |
|
449 |
|
450 |
|
451 |
|
452 |
|
453 |
|
454 |
|
455 | hooks?: HooksObject | undefined | null;
|
456 | |
457 |
|
458 |
|
459 | pedantic?: boolean | undefined;
|
460 | |
461 |
|
462 |
|
463 |
|
464 |
|
465 | renderer?: RendererObject | undefined | null;
|
466 | |
467 |
|
468 |
|
469 | silent?: boolean | undefined;
|
470 | |
471 |
|
472 |
|
473 | tokenizer?: TokenizerObject | undefined | null;
|
474 | |
475 |
|
476 |
|
477 |
|
478 |
|
479 |
|
480 | walkTokens?: ((token: Token) => void | Promise<void>) | undefined | 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 | undefined | null;
|
487 | /**
|
488 | * Type: object Default: new Renderer()
|
489 | *
|
490 | * An object containing functions to render tokens to HTML.
|
491 | */
|
492 | renderer?: _Renderer | undefined | null;
|
493 | /**
|
494 | * The tokenizer defines how to turn markdown text into tokens.
|
495 | */
|
496 | tokenizer?: _Tokenizer | undefined | 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" | "heading" | "list" | "paragraph" | "def" | "fences" | "lheading" | "newline", RegExp>;
|
552 | pedantic: Record<"code" | "blockquote" | "hr" | "html" | "table" | "text" | "heading" | "list" | "paragraph" | "def" | "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 | undefined | 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 | undefined | 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 | undefined | 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 | undefined | 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 | undefined | 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 {};
|