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