@jupyterlab/rendermime
Version:
JupyterLab - RenderMime
316 lines (315 loc) • 8.23 kB
TypeScript
import { IRenderMime } from '@jupyterlab/rendermime-interfaces';
import { ITranslator } from '@jupyterlab/translation';
/**
* Render HTML into a host node.
*
* @param options - The options for rendering.
*
* @returns A promise which resolves when rendering is complete.
*/
export declare function renderHTML(options: renderHTML.IOptions): Promise<void>;
/**
* The namespace for the `renderHTML` function statics.
*/
export declare namespace renderHTML {
/**
* The options for the `renderHTML` function.
*/
interface IOptions {
/**
* The host node for the rendered HTML.
*/
host: HTMLElement;
/**
* The HTML source to render.
*/
source: string;
/**
* Whether the source is trusted.
*/
trusted: boolean;
/**
* The html sanitizer for untrusted source.
*/
sanitizer: IRenderMime.ISanitizer;
/**
* An optional url resolver.
*/
resolver: IRenderMime.IResolver | null;
/**
* An optional link handler.
*/
linkHandler: IRenderMime.ILinkHandler | null;
/**
* Whether the node should be typeset.
*/
shouldTypeset: boolean;
/**
* The LaTeX typesetter for the application.
*/
latexTypesetter: IRenderMime.ILatexTypesetter | null;
/**
* The application language translator.
*/
translator?: ITranslator;
}
}
/**
* Render an image into a host node.
*
* @param options - The options for rendering.
*
* @returns A promise which resolves when rendering is complete.
*/
export declare function renderImage(options: renderImage.IRenderOptions): Promise<void>;
/**
* The namespace for the `renderImage` function statics.
*/
export declare namespace renderImage {
/**
* The options for the `renderImage` function.
*/
interface IRenderOptions {
/**
* The image node to update with the content.
*/
host: HTMLElement;
/**
* The mime type for the image.
*/
mimeType: string;
/**
* The base64 encoded source for the image.
*/
source: string;
/**
* The optional width for the image.
*/
width?: number;
/**
* The optional height for the image.
*/
height?: number;
/**
* Whether an image requires a background for legibility.
*/
needsBackground?: string;
/**
* Whether the image should be unconfined.
*/
unconfined?: boolean;
}
}
/**
* Render LaTeX into a host node.
*
* @param options - The options for rendering.
*
* @returns A promise which resolves when rendering is complete.
*/
export declare function renderLatex(options: renderLatex.IRenderOptions): Promise<void>;
/**
* The namespace for the `renderLatex` function statics.
*/
export declare namespace renderLatex {
/**
* The options for the `renderLatex` function.
*/
interface IRenderOptions {
/**
* The host node for the rendered LaTeX.
*/
host: HTMLElement;
/**
* The LaTeX source to render.
*/
source: string;
/**
* Whether the node should be typeset.
*/
shouldTypeset: boolean;
/**
* The LaTeX typesetter for the application.
*/
latexTypesetter: IRenderMime.ILatexTypesetter | null;
}
}
/**
* Render Markdown into a host node.
*
* @param options - The options for rendering.
*
* @returns A promise which resolves when rendering is complete.
*/
export declare function renderMarkdown(options: renderMarkdown.IRenderOptions): Promise<void>;
/**
* The namespace for the `renderMarkdown` function statics.
*/
export declare namespace renderMarkdown {
/**
* The options for the `renderMarkdown` function.
*/
interface IRenderOptions {
/**
* The host node for the rendered Markdown.
*/
host: HTMLElement;
/**
* The Markdown source to render.
*/
source: string;
/**
* Whether the source is trusted.
*/
trusted: boolean;
/**
* The html sanitizer for untrusted source.
*/
sanitizer: IRenderMime.ISanitizer;
/**
* An optional url resolver.
*/
resolver: IRenderMime.IResolver | null;
/**
* An optional link handler.
*/
linkHandler: IRenderMime.ILinkHandler | null;
/**
* Whether the node should be typeset.
*/
shouldTypeset: boolean;
/**
* The LaTeX typesetter for the application.
*/
latexTypesetter: IRenderMime.ILatexTypesetter | null;
/**
* The Markdown parser.
*/
markdownParser: IRenderMime.IMarkdownParser | null;
/**
* The application language translator.
*/
translator?: ITranslator;
}
/**
* Create a normalized id for a header element.
*
* @param header Header element
* @returns Normalized id
*/
function createHeaderId(header: Element): string;
}
/**
* Render SVG into a host node.
*
* @param options - The options for rendering.
*
* @returns A promise which resolves when rendering is complete.
*/
export declare function renderSVG(options: renderSVG.IRenderOptions): Promise<void>;
/**
* The namespace for the `renderSVG` function statics.
*/
export declare namespace renderSVG {
/**
* The options for the `renderSVG` function.
*/
interface IRenderOptions {
/**
* The host node for the rendered SVG.
*/
host: HTMLElement;
/**
* The SVG source.
*/
source: string;
/**
* Whether the source is trusted.
*/
trusted: boolean;
/**
* Whether the svg should be unconfined.
*/
unconfined?: boolean;
/**
* The application language translator.
*/
translator: ITranslator;
}
}
/**
* Render text into a host node.
*
* @param options - The options for rendering.
*
* @returns A promise which resolves when rendering is complete.
*/
export declare function renderText(options: renderText.IRenderOptions): Promise<void>;
/**
* The namespace for the `renderText` function statics.
*/
export declare namespace renderText {
/**
* The options for the `renderText` function.
*/
interface IRenderOptions {
/**
* The host node for the text content.
*/
host: HTMLElement;
/**
* The html sanitizer for untrusted source.
*/
sanitizer: IRenderMime.ISanitizer;
/**
* The source text to render.
*/
source: string;
/**
* The application language translator.
*/
translator?: ITranslator;
}
}
/**
* Render error into a host node.
*
* @param options - The options for rendering.
*
* @returns A promise which resolves when rendering is complete.
*/
export declare function renderError(options: renderError.IRenderOptions): Promise<void>;
/**
* The namespace for the `renderError` function statics.
*/
export declare namespace renderError {
/**
* The options for the `renderError` function.
*/
interface IRenderOptions {
/**
* The host node for the error content.
*/
host: HTMLElement;
/**
* The html sanitizer for untrusted source.
*/
sanitizer: IRenderMime.ISanitizer;
/**
* The source error to render.
*/
source: string;
/**
* An optional url resolver.
*/
resolver: IRenderMime.IResolver | null;
/**
* An optional link handler.
*/
linkHandler: IRenderMime.ILinkHandler | null;
/**
* The application language translator.
*/
translator?: ITranslator;
}
}