1 | import { MarkdownPageEvent, MarkdownRendererEvent } from '../events/index.js';
|
2 | import { MarkdownTheme } from '../theme/index.js';
|
3 | import { EventHooks, Options, Renderer } from 'typedoc';
|
4 | import { MarkdownRendererHooks } from './markdown-renderer-hooks.js';
|
5 | /**
|
6 | * The MarkdownRenderer extends TypeDoc's {@link typedoc!Renderer Renderer} instance with custom hooks and async jobs.
|
7 | */
|
8 | export interface MarkdownRenderer extends Renderer {
|
9 | /**
|
10 | * @param event - Triggered before or after a document will be rendered.
|
11 | * @param callback - Receives the {@link MarkdownPageEvent} object as an argument.
|
12 | *
|
13 | * @example
|
14 | *
|
15 | * ```ts
|
16 | * app.renderer.on(MarkdownPageEvent.BEGIN, (renderer) => {});
|
17 | * ```
|
18 | */
|
19 | on(event: typeof MarkdownPageEvent.BEGIN | typeof MarkdownPageEvent.END, callback: (page: MarkdownPageEvent) => void): void;
|
20 | /**
|
21 | * @param event - Triggered before or after rendering the project.
|
22 | * @param callback - Receives the {@link MarkdownRendererEvent} object as an argument.
|
23 | *
|
24 | * @example
|
25 | *
|
26 | * ```ts
|
27 | * app.renderer.on(MarkdownRendererEvent.BEGIN, (renderer) => {});
|
28 | * ```
|
29 | */
|
30 | on(event: typeof MarkdownRendererEvent.BEGIN | typeof MarkdownRendererEvent.END, callback: (page: MarkdownRendererEvent) => void): void;
|
31 | /**
|
32 | * Define a new theme that can be used to render output.
|
33 | *
|
34 | * @param name - The name of the theme.
|
35 | * @param theme - The theme class to use.
|
36 | */
|
37 | defineTheme: (name: string, theme: new (renderer: Renderer) => MarkdownTheme) => void;
|
38 | markdownHooks: EventHooks<MarkdownRendererHooks, string>;
|
39 | /**
|
40 | * A list of async jobs which must be completed before rendering output.
|
41 | *
|
42 | * Note: This array is cleared after calling the contained functions on each call.
|
43 | */
|
44 | preRenderAsyncJobs: Array<(output: MarkdownRendererEvent) => Promise<void>>;
|
45 | /**
|
46 | * A list of async jobs which must be completed after rendering output files but before generation is considered successful.
|
47 | * These functions will be called after all documents have been written to the filesystem.
|
48 | *
|
49 | * Note: This array is cleared after calling the contained functions on each call.
|
50 | */
|
51 | postRenderAsyncJobs: Array<(output: MarkdownRendererEvent) => Promise<void>>;
|
52 | /** @internal */
|
53 | packagesMeta: Record<string, {
|
54 | description: string;
|
55 | options: Options;
|
56 | }>;
|
57 | }
|