UNPKG

6.85 kBTypeScriptView Raw
1import { ISanitizer } from '@jupyterlab/apputils';
2import { IRenderMime } from '@jupyterlab/rendermime-interfaces';
3import { ITranslator } from '@jupyterlab/translation';
4/**
5 * Render HTML into a host node.
6 *
7 * @params options - The options for rendering.
8 *
9 * @returns A promise which resolves when rendering is complete.
10 */
11export declare function renderHTML(options: renderHTML.IOptions): Promise<void>;
12/**
13 * The namespace for the `renderHTML` function statics.
14 */
15export declare namespace renderHTML {
16 /**
17 * The options for the `renderHTML` function.
18 */
19 interface IOptions {
20 /**
21 * The host node for the rendered HTML.
22 */
23 host: HTMLElement;
24 /**
25 * The HTML source to render.
26 */
27 source: string;
28 /**
29 * Whether the source is trusted.
30 */
31 trusted: boolean;
32 /**
33 * The html sanitizer for untrusted source.
34 */
35 sanitizer: ISanitizer;
36 /**
37 * An optional url resolver.
38 */
39 resolver: IRenderMime.IResolver | null;
40 /**
41 * An optional link handler.
42 */
43 linkHandler: IRenderMime.ILinkHandler | null;
44 /**
45 * Whether the node should be typeset.
46 */
47 shouldTypeset: boolean;
48 /**
49 * The LaTeX typesetter for the application.
50 */
51 latexTypesetter: IRenderMime.ILatexTypesetter | null;
52 /**
53 * The application language translator.
54 */
55 translator?: ITranslator;
56 }
57}
58/**
59 * Render an image into a host node.
60 *
61 * @params options - The options for rendering.
62 *
63 * @returns A promise which resolves when rendering is complete.
64 */
65export declare function renderImage(options: renderImage.IRenderOptions): Promise<void>;
66/**
67 * The namespace for the `renderImage` function statics.
68 */
69export declare namespace renderImage {
70 /**
71 * The options for the `renderImage` function.
72 */
73 interface IRenderOptions {
74 /**
75 * The image node to update with the content.
76 */
77 host: HTMLElement;
78 /**
79 * The mime type for the image.
80 */
81 mimeType: string;
82 /**
83 * The base64 encoded source for the image.
84 */
85 source: string;
86 /**
87 * The optional width for the image.
88 */
89 width?: number;
90 /**
91 * The optional height for the image.
92 */
93 height?: number;
94 /**
95 * Whether an image requires a background for legibility.
96 */
97 needsBackground?: string;
98 /**
99 * Whether the image should be unconfined.
100 */
101 unconfined?: boolean;
102 }
103}
104/**
105 * Render LaTeX into a host node.
106 *
107 * @params options - The options for rendering.
108 *
109 * @returns A promise which resolves when rendering is complete.
110 */
111export declare function renderLatex(options: renderLatex.IRenderOptions): Promise<void>;
112/**
113 * The namespace for the `renderLatex` function statics.
114 */
115export declare namespace renderLatex {
116 /**
117 * The options for the `renderLatex` function.
118 */
119 interface IRenderOptions {
120 /**
121 * The host node for the rendered LaTeX.
122 */
123 host: HTMLElement;
124 /**
125 * The LaTeX source to render.
126 */
127 source: string;
128 /**
129 * Whether the node should be typeset.
130 */
131 shouldTypeset: boolean;
132 /**
133 * The LaTeX typesetter for the application.
134 */
135 latexTypesetter: IRenderMime.ILatexTypesetter | null;
136 }
137}
138/**
139 * Render Markdown into a host node.
140 *
141 * @params options - The options for rendering.
142 *
143 * @returns A promise which resolves when rendering is complete.
144 */
145export declare function renderMarkdown(options: renderMarkdown.IRenderOptions): Promise<void>;
146/**
147 * The namespace for the `renderMarkdown` function statics.
148 */
149export declare namespace renderMarkdown {
150 /**
151 * The options for the `renderMarkdown` function.
152 */
153 interface IRenderOptions {
154 /**
155 * The host node for the rendered Markdown.
156 */
157 host: HTMLElement;
158 /**
159 * The Markdown source to render.
160 */
161 source: string;
162 /**
163 * Whether the source is trusted.
164 */
165 trusted: boolean;
166 /**
167 * The html sanitizer for untrusted source.
168 */
169 sanitizer: ISanitizer;
170 /**
171 * An optional url resolver.
172 */
173 resolver: IRenderMime.IResolver | null;
174 /**
175 * An optional link handler.
176 */
177 linkHandler: IRenderMime.ILinkHandler | null;
178 /**
179 * Whether the node should be typeset.
180 */
181 shouldTypeset: boolean;
182 /**
183 * The LaTeX typesetter for the application.
184 */
185 latexTypesetter: IRenderMime.ILatexTypesetter | null;
186 /**
187 * The application language translator.
188 */
189 translator?: ITranslator;
190 }
191}
192/**
193 * Render SVG into a host node.
194 *
195 * @params options - The options for rendering.
196 *
197 * @returns A promise which resolves when rendering is complete.
198 */
199export declare function renderSVG(options: renderSVG.IRenderOptions): Promise<void>;
200/**
201 * The namespace for the `renderSVG` function statics.
202 */
203export declare namespace renderSVG {
204 /**
205 * The options for the `renderSVG` function.
206 */
207 interface IRenderOptions {
208 /**
209 * The host node for the rendered SVG.
210 */
211 host: HTMLElement;
212 /**
213 * The SVG source.
214 */
215 source: string;
216 /**
217 * Whether the source is trusted.
218 */
219 trusted: boolean;
220 /**
221 * Whether the svg should be unconfined.
222 */
223 unconfined?: boolean;
224 /**
225 * The application language translator.
226 */
227 translator: ITranslator;
228 }
229}
230/**
231 * Render text into a host node.
232 *
233 * @params options - The options for rendering.
234 *
235 * @returns A promise which resolves when rendering is complete.
236 */
237export declare function renderText(options: renderText.IRenderOptions): Promise<void>;
238/**
239 * The namespace for the `renderText` function statics.
240 */
241export declare namespace renderText {
242 /**
243 * The options for the `renderText` function.
244 */
245 interface IRenderOptions {
246 /**
247 * The host node for the text content.
248 */
249 host: HTMLElement;
250 /**
251 * The html sanitizer for untrusted source.
252 */
253 sanitizer: ISanitizer;
254 /**
255 * The source text to render.
256 */
257 source: string;
258 /**
259 * The application language translator.
260 */
261 translator?: ITranslator;
262 }
263}