@jupyterlab/rendermime

  • Version 4.5.0
  • Published
  • 339 kB
  • 12 dependencies
  • BSD-3-Clause license

Install

npm i @jupyterlab/rendermime
yarn add @jupyterlab/rendermime
pnpm add @jupyterlab/rendermime

Overview

rendermime

Index

Variables

Functions

Classes

Interfaces

Namespaces

Variables

variable errorRendererFactory

const errorRendererFactory: IRenderMime.IRendererFactory;
  • A mime renderer factory for rendering stderr outputs

variable htmlRendererFactory

const htmlRendererFactory: IRenderMime.IRendererFactory;
  • A mime renderer factory for raw html.

variable ILatexTypesetter

const ILatexTypesetter: Token<IRenderMime.ILatexTypesetter>;
  • The latex typesetter token.

variable imageRendererFactory

const imageRendererFactory: IRenderMime.IRendererFactory;
  • A mime renderer factory for images.

variable IMarkdownParser

const IMarkdownParser: Token<IRenderMime.IMarkdownParser>;
  • The markdown parser token.

variable IRenderMimeRegistry

const IRenderMimeRegistry: Token<IRenderMimeRegistry>;
  • The rendermime token.

variable IUrlResolverFactory

const IUrlResolverFactory: Token<RenderMimeRegistry.IUrlResolverFactory>;
  • The URL resolver factory.

variable javaScriptRendererFactory

const javaScriptRendererFactory: IRenderMime.IRendererFactory;
  • A placeholder factory for rendered JavaScript.

variable latexRendererFactory

const latexRendererFactory: IRenderMime.IRendererFactory;
  • A mime renderer factory for LaTeX.

variable markdownRendererFactory

const markdownRendererFactory: IRenderMime.IRendererFactory;
  • A mime renderer factory for Markdown.

variable standardRendererFactories

const standardRendererFactories: readonly IRenderMime.IRendererFactory[];
  • The standard factories provided by the rendermime package.

variable svgRendererFactory

const svgRendererFactory: IRenderMime.IRendererFactory;
  • A mime renderer factory for svg.

variable textRendererFactory

const textRendererFactory: IRenderMime.IRendererFactory;
  • A mime renderer factory for plain and jupyter console text data.

Functions

hardenAnchorLinks: (
node: HTMLElement,
resolver?: IRenderMime.IResolver | null
) => void;
  • Harden anchor links.

function removeMath

removeMath: (text: string) => { text: string; math: string[] };
  • Break up the text into its component parts and search through them for math delimiters, braces, linebreaks, etc. Math delimiters must match and braces must balance. Don't allow math to pass through a double linebreak (which will be a paragraph).

function renderError

renderError: (options: renderError.IRenderOptions) => Promise<void>;
  • Render error into a host node.

    Parameter options

    The options for rendering.

    Returns

    A promise which resolves when rendering is complete.

function renderHTML

renderHTML: (options: renderHTML.IOptions) => Promise<void>;
  • Render HTML into a host node.

    Parameter options

    The options for rendering.

    Returns

    A promise which resolves when rendering is complete.

function renderImage

renderImage: (options: renderImage.IRenderOptions) => Promise<void>;
  • Render an image into a host node.

    Parameter options

    The options for rendering.

    Returns

    A promise which resolves when rendering is complete.

function renderLatex

renderLatex: (options: renderLatex.IRenderOptions) => Promise<void>;
  • Render LaTeX into a host node.

    Parameter options

    The options for rendering.

    Returns

    A promise which resolves when rendering is complete.

function renderMarkdown

renderMarkdown: typeof renderMarkdown;
  • Render Markdown into a host node.

    Parameter options

    The options for rendering.

    Returns

    A promise which resolves when rendering is complete.

function renderSVG

renderSVG: (options: renderSVG.IRenderOptions) => Promise<void>;
  • Render SVG into a host node.

    Parameter options

    The options for rendering.

    Returns

    A promise which resolves when rendering is complete.

function renderText

renderText: (options: renderText.IRenderOptions) => Promise<void>;
  • Render text into a host node.

    Parameter options

    The options for rendering.

    Returns

    A promise which resolves when rendering is complete.

function replaceMath

replaceMath: (text: string, math: string[]) => string;
  • Put back the math strings that were saved, and clear the math array (no need to keep it around).

Classes

class AttachmentModel

class AttachmentModel implements IAttachmentModel {}
  • The default implementation of a notebook attachment model.

constructor

constructor(options: IAttachmentModel.IOptions);
  • Construct a new attachment model.

property changed

readonly changed: ISignal<this, void>;
  • A signal emitted when the attachment model changes.

property data

readonly data: ReadonlyPartialJSONObject;
  • The data associated with the model.

property metadata

readonly metadata: ReadonlyPartialJSONObject;
  • The metadata associated with the model.

property trusted

readonly trusted: boolean;

    method dispose

    dispose: () => void;
    • Dispose of the resources used by the attachment model.

    method setData

    setData: (options: IRenderMime.IMimeModel.ISetDataOptions) => void;
    • Set the data associated with the model.

      #### Notes Depending on the implementation of the mime model, this call may or may not have deferred effects,

    method toJSON

    toJSON: () => nbformat.IMimeBundle;
    • Serialize the model to JSON.

    class MimeModel

    class MimeModel implements IRenderMime.IMimeModel {}
    • The default mime model implementation.

    constructor

    constructor(options?: MimeModel.IOptions);
    • Construct a new mime model.

    property data

    readonly data: ReadonlyPartialJSONObject;
    • The data associated with the model.

    property metadata

    readonly metadata: ReadonlyPartialJSONObject;
    • The metadata associated with the model.

    property trusted

    readonly trusted: boolean;
    • Whether the model is trusted.

    method setData

    setData: (options: IRenderMime.IMimeModel.ISetDataOptions) => void;
    • Set the data associated with the model.

      #### Notes Depending on the implementation of the mime model, this call may or may not have deferred effects,

    class OutputModel

    class OutputModel implements IOutputModel {}
    • The default implementation of a notebook output model.

    constructor

    constructor(options: IOutputModel.IOptions);
    • Construct a new output model.

    property changed

    readonly changed: ISignal<this, void>;
    • A signal emitted when the output model changes.

    property data

    readonly data: ReadonlyPartialJSONObject;
    • The data associated with the model.

    property executionCount

    readonly executionCount: nbformat.ExecutionCount;
    • The execution count.

    property metadata

    readonly metadata: ReadonlyPartialJSONObject;
    • The metadata associated with the model.

    property streamText

    readonly streamText: any;

      property trusted

      readonly trusted: boolean;
      • Whether the model is trusted.

      property type

      readonly type: string;
      • The output type.

      method dispose

      dispose: () => void;
      • Dispose of the resources used by the output model.

      method setData

      setData: (options: IRenderMime.IMimeModel.ISetDataOptions) => void;
      • Set the data associated with the model.

        #### Notes Depending on the implementation of the mime model, this call may or may not have deferred effects,

      method toJSON

      toJSON: () => nbformat.IOutput;
      • Serialize the model to JSON.

      class RenderedCommon

      abstract class RenderedCommon extends Widget implements IRenderMime.IRenderer {}
      • A common base class for mime renderers.

      constructor

      constructor(options: IRenderMime.IRendererOptions);
      • Construct a new rendered common widget.

        Parameter options

        The options for initializing the widget.

      property latexTypesetter

      readonly latexTypesetter: any;
      • The latexTypesetter.

      property linkHandler

      readonly linkHandler: any;
      • The link handler.

      property markdownParser

      readonly markdownParser: any;
      • The markdownParser.

      property mimeType

      readonly mimeType: string;
      • The mimetype being rendered.

      property resolver

      readonly resolver: any;
      • The resolver object.

      property sanitizer

      readonly sanitizer: IRenderMime.ISanitizer;
      • The sanitizer used to sanitize untrusted html inputs.

      property translator

      readonly translator: ITranslator;
      • The translator.

      method render

      abstract render: (model: IRenderMime.IMimeModel) => Promise<void>;
      • Render the mime model.

        Parameter model

        The mime model to render.

        Returns

        A promise which resolves when rendering is complete.

      method renderModel

      renderModel: (
      model: IRenderMime.IMimeModel,
      keepExisting?: boolean
      ) => Promise<void>;
      • Render a mime model.

        Parameter model

        The mime model to render.

        Parameter keepExisting

        Whether to keep the existing rendering.

        Returns

        A promise which resolves when rendering is complete.

        #### Notes By default, if the DOM node for this widget already has content, it is emptied before rendering. Subclasses that do not want this behavior (if, for instance, they are using DOM diffing), should override this method or call super.renderModel(model, true).

      method setFragment

      protected setFragment: (fragment: string) => void;
      • Set the URI fragment identifier.

        Parameter fragment

        The URI fragment identifier.

      class RenderedError

      class RenderedError extends RenderedCommon {}

        constructor

        constructor(options: IRenderMime.IRendererOptions);

          method render

          render: (model: IRenderMime.IMimeModel) => Promise<void>;

            class RenderedHTML

            class RenderedHTML extends RenderedHTMLCommon {}
            • A mime renderer for displaying HTML and math.

            constructor

            constructor(options: IRenderMime.IRendererOptions);
            • Construct a new rendered HTML widget.

              Parameter options

              The options for initializing the widget.

            method onAfterAttach

            onAfterAttach: (msg: Message) => void;
            • A message handler invoked on an 'after-attach' message.

            method render

            render: (model: IRenderMime.IMimeModel) => Promise<void>;
            • Render a mime model.

              Parameter model

              The mime model to render.

              Returns

              A promise which resolves when rendering is complete.

            class RenderedHTMLCommon

            abstract class RenderedHTMLCommon extends RenderedCommon {}
            • A common base class for HTML mime renderers.

            constructor

            constructor(options: IRenderMime.IRendererOptions);
            • Construct a new rendered HTML common widget.

              Parameter options

              The options for initializing the widget.

            method setFragment

            setFragment: (fragment: string) => void;

              class RenderedImage

              class RenderedImage extends RenderedCommon {}
              • A mime renderer for displaying images.

              constructor

              constructor(options: IRenderMime.IRendererOptions);
              • Construct a new rendered image widget.

                Parameter options

                The options for initializing the widget.

              method render

              render: (model: IRenderMime.IMimeModel) => Promise<void>;
              • Render a mime model.

                Parameter model

                The mime model to render.

                Returns

                A promise which resolves when rendering is complete.

              class RenderedJavaScript

              class RenderedJavaScript extends RenderedCommon {}
              • A widget for displaying JavaScript output.

              constructor

              constructor(options: IRenderMime.IRendererOptions);
              • Construct a new rendered text widget.

                Parameter options

                The options for initializing the widget.

              method render

              render: (model: IRenderMime.IMimeModel) => Promise<void>;
              • Render a mime model.

                Parameter model

                The mime model to render.

                Returns

                A promise which resolves when rendering is complete.

              class RenderedLatex

              class RenderedLatex extends RenderedCommon {}
              • A mime renderer for displaying LaTeX output.

              constructor

              constructor(options: IRenderMime.IRendererOptions);
              • Construct a new rendered LaTeX widget.

                Parameter options

                The options for initializing the widget.

              method onAfterAttach

              onAfterAttach: (msg: Message) => void;
              • A message handler invoked on an 'after-attach' message.

              method render

              render: (model: IRenderMime.IMimeModel) => Promise<void>;
              • Render a mime model.

                Parameter model

                The mime model to render.

                Returns

                A promise which resolves when rendering is complete.

              class RenderedMarkdown

              class RenderedMarkdown extends RenderedHTMLCommon {}
              • A mime renderer for displaying Markdown with embedded latex.

              constructor

              constructor(options: IRenderMime.IRendererOptions);
              • Construct a new rendered markdown widget.

                Parameter options

                The options for initializing the widget.

              method onAfterAttach

              onAfterAttach: (msg: Message) => void;
              • A message handler invoked on an 'after-attach' message.

              method render

              render: (model: IRenderMime.IMimeModel) => Promise<void>;
              • Render a mime model.

                Parameter model

                The mime model to render.

                Returns

                A promise which resolves when rendering is complete.

              method renderModel

              renderModel: (model: IRenderMime.IMimeModel) => Promise<void>;
              • Render a mime model.

                Parameter model

                The mime model to render.

                Returns

                A promise which resolves when rendering is complete.

              class RenderedSVG

              class RenderedSVG extends RenderedCommon {}
              • A widget for displaying SVG content.

              constructor

              constructor(options: IRenderMime.IRendererOptions);
              • Construct a new rendered SVG widget.

                Parameter options

                The options for initializing the widget.

              method onAfterAttach

              onAfterAttach: (msg: Message) => void;
              • A message handler invoked on an 'after-attach' message.

              method render

              render: (model: IRenderMime.IMimeModel) => Promise<void>;
              • Render a mime model.

                Parameter model

                The mime model to render.

                Returns

                A promise which resolves when rendering is complete.

              class RenderedText

              class RenderedText extends RenderedCommon {}
              • A widget for displaying plain text and console text.

              constructor

              constructor(options: IRenderMime.IRendererOptions);
              • Construct a new rendered text widget.

                Parameter options

                The options for initializing the widget.

              method render

              render: (model: IRenderMime.IMimeModel) => Promise<void>;
              • Render a mime model.

                Parameter model

                The mime model to render.

                Returns

                A promise which resolves when rendering is complete.

              class RenderMimeRegistry

              class RenderMimeRegistry implements IRenderMimeRegistry {}
              • An object which manages mime renderer factories.

                This object is used to render mime models using registered mime renderers, selecting the preferred mime renderer to render the model into a widget.

                #### Notes This class is not intended to be subclassed.

              constructor

              constructor(options?: RenderMimeRegistry.IOptions);
              • Construct a new rendermime.

                Parameter options

                The options for initializing the instance.

              property latexTypesetter

              readonly latexTypesetter: any;
              • The LaTeX typesetter for the rendermime.

              property linkHandler

              readonly linkHandler: any;
              • The object used to handle path opening links.

              property markdownParser

              readonly markdownParser: any;
              • The Markdown parser for the rendermime.

              property mimeTypes

              readonly mimeTypes: readonly string[];
              • The ordered list of mimeTypes.

              property resolver

              readonly resolver: any;
              • The object used to resolve relative urls for the rendermime instance.

              property sanitizer

              readonly sanitizer: IRenderMime.ISanitizer;
              • The sanitizer used by the rendermime instance.

              property translator

              readonly translator: ITranslator;
              • The application language translator.

              method addFactory

              addFactory: (factory: IRenderMime.IRendererFactory, rank?: number) => void;
              • Add a renderer factory to the rendermime.

                Parameter factory

                The renderer factory of interest.

                Parameter rank

                The rank of the renderer. A lower rank indicates a higher priority for rendering. If not given, the rank will defer to the defaultRank of the factory. If no defaultRank is given, it will default to 100.

                #### Notes The renderer will replace an existing renderer for the given mimeType.

              method clone

              clone: (options?: IRenderMimeRegistry.ICloneOptions) => RenderMimeRegistry;
              • Create a clone of this rendermime instance.

                Parameter options

                The options for configuring the clone.

                Returns

                A new independent clone of the rendermime.

              method createModel

              createModel: (options?: MimeModel.IOptions) => MimeModel;
              • Create a new mime model. This is a convenience method.

                - The options used to create the model.

                Returns

                A new mime model.

              method createRenderer

              createRenderer: (mimeType: string) => IRenderMime.IRenderer;
              • Create a renderer for a mime type.

                Parameter mimeType

                The mime type of interest.

                Returns

                A new renderer for the given mime type.

                Throws

                An error if no factory exists for the mime type.

              method getFactory

              getFactory: (mimeType: string) => IRenderMime.IRendererFactory | undefined;
              • Get the renderer factory registered for a mime type.

                Parameter mimeType

                The mime type of interest.

                Returns

                The factory for the mime type, or undefined.

              method getRank

              getRank: (mimeType: string) => number | undefined;
              • Get the rank for a given mime type.

                Parameter mimeType

                The mime type of interest.

                Returns

                The rank of the mime type or undefined.

              method preferredMimeType

              preferredMimeType: (
              bundle: ReadonlyPartialJSONObject,
              safe?: 'ensure' | 'prefer' | 'any'
              ) => string | undefined;
              • Find the preferred mime type for a mime bundle.

                Parameter bundle

                The bundle of mime data.

                Parameter safe

                How to consider safe/unsafe factories. If 'ensure', it will only consider safe factories. If 'any', any factory will be considered. If 'prefer', unsafe factories will be considered, but only after the safe options have been exhausted.

                Returns

                The preferred mime type from the available factories, or undefined if the mime type cannot be rendered.

              method removeMimeType

              removeMimeType: (mimeType: string) => void;
              • Remove a mime type.

                Parameter mimeType

                The mime type of interest.

              method setRank

              setRank: (mimeType: string, rank: number) => void;
              • Set the rank of a given mime type.

                Parameter mimeType

                The mime type of interest.

                Parameter rank

                The new rank to assign.

                #### Notes This is a no-op if the mime type is not registered.

              Interfaces

              interface IAttachmentModel

              interface IAttachmentModel extends IRenderMime.IMimeModel {}
              • The interface for an attachment model.

              property changed

              readonly changed: ISignal<this, void>;
              • A signal emitted when the attachment model changes.

              method dispose

              dispose: () => void;
              • Dispose of the resources used by the attachment model.

              method toJSON

              toJSON: () => nbformat.IMimeBundle;
              • Serialize the model to JSON.

              interface ILatexTypesetter

              interface ILatexTypesetter extends IRenderMime.ILatexTypesetter {}

                interface IMarkdownParser

                interface IMarkdownParser extends IRenderMime.IMarkdownParser {}

                  interface IOutputModel

                  interface IOutputModel extends IRenderMime.IMimeModel {}
                  • The interface for an output model.

                  property changed

                  readonly changed: ISignal<this, void>;
                  • A signal emitted when the output model changes.

                  property executionCount

                  readonly executionCount: nbformat.ExecutionCount;
                  • The execution count of the model.

                  property streamText

                  readonly streamText?: IObservableString;
                  • The observable text, present when the output type is set to "stream".

                  property trusted

                  trusted: boolean;
                  • Whether the output is trusted.

                  property type

                  readonly type: string;
                  • The output type.

                  method dispose

                  dispose: () => void;
                  • Dispose of the resources used by the output model.

                  method toJSON

                  toJSON: () => nbformat.IOutput;
                  • Serialize the model to JSON.

                  interface IRenderMimeRegistry

                  interface IRenderMimeRegistry {}

                    property latexTypesetter

                    readonly latexTypesetter: IRenderMime.ILatexTypesetter | null;
                    • The LaTeX typesetter for the rendermime.

                    property linkHandler

                    readonly linkHandler: IRenderMime.ILinkHandler | null;
                    • The object used to handle path opening links.

                    property markdownParser

                    readonly markdownParser: IRenderMime.IMarkdownParser | null;
                    • The Markdown parser for the rendermime.

                    property mimeTypes

                    readonly mimeTypes: ReadonlyArray<string>;
                    • The ordered list of mimeTypes.

                    property resolver

                    readonly resolver: IRenderMime.IResolver | null;
                    • The object used to resolve relative urls for the rendermime instance.

                    property sanitizer

                    readonly sanitizer: IRenderMime.ISanitizer;
                    • The sanitizer used by the rendermime instance.

                    method addFactory

                    addFactory: (factory: IRenderMime.IRendererFactory, rank?: number) => void;
                    • Add a renderer factory to the rendermime.

                      Parameter factory

                      The renderer factory of interest.

                      Parameter rank

                      The rank of the renderer. A lower rank indicates a higher priority for rendering. If not given, the rank will defer to the defaultRank of the factory. If no defaultRank is given, it will default to 100.

                      #### Notes The renderer will replace an existing renderer for the given mimeType.

                    method clone

                    clone: (options?: IRenderMimeRegistry.ICloneOptions) => IRenderMimeRegistry;
                    • Create a clone of this rendermime instance.

                      Parameter options

                      The options for configuring the clone.

                      Returns

                      A new independent clone of the rendermime.

                    method createModel

                    createModel: (options?: MimeModel.IOptions) => MimeModel;
                    • Create a new mime model. This is a convenience method.

                      - The options used to create the model.

                      Returns

                      A new mime model.

                    method createRenderer

                    createRenderer: (mimeType: string) => IRenderMime.IRenderer;
                    • Create a renderer for a mime type.

                      Parameter mimeType

                      The mime type of interest.

                      Returns

                      A new renderer for the given mime type.

                      Throws

                      An error if no factory exists for the mime type.

                    method getFactory

                    getFactory: (mimeType: string) => IRenderMime.IRendererFactory | undefined;
                    • Get the renderer factory registered for a mime type.

                      Parameter mimeType

                      The mime type of interest.

                      Returns

                      The factory for the mime type, or undefined.

                    method getRank

                    getRank: (mimeType: string) => number | undefined;
                    • Get the rank for a given mime type.

                      Parameter mimeType

                      The mime type of interest.

                      Returns

                      The rank of the mime type or undefined.

                    method preferredMimeType

                    preferredMimeType: (
                    bundle: ReadonlyPartialJSONObject,
                    safe?: 'ensure' | 'prefer' | 'any'
                    ) => string | undefined;
                    • Find the preferred mime type for a mime bundle.

                      Parameter bundle

                      The bundle of mime data.

                      Parameter safe

                      How to consider safe/unsafe factories. If 'ensure', it will only consider safe factories. If 'any', any factory will be considered. If 'prefer', unsafe factories will be considered, but only after the safe options have been exhausted.

                      Returns

                      The preferred mime type from the available factories, or undefined if the mime type cannot be rendered.

                    method removeMimeType

                    removeMimeType: (mimeType: string) => void;
                    • Remove a mime type.

                      Parameter mimeType

                      The mime type of interest.

                    method setRank

                    setRank: (mimeType: string, rank: number) => void;
                    • Set the rank of a given mime type.

                      Parameter mimeType

                      The mime type of interest.

                      Parameter rank

                      The new rank to assign.

                      #### Notes This is a no-op if the mime type is not registered.

                    interface IUrlResolverFactory

                    interface IUrlResolverFactory extends RenderMimeRegistry.IUrlResolverFactory {}

                      Namespaces

                      namespace AttachmentModel

                      namespace AttachmentModel {}
                      • The namespace for AttachmentModel statics.

                      function getData

                      getData: (bundle: nbformat.IMimeBundle) => PartialJSONObject;
                      • Get the data for an attachment.

                        Parameter bundle

                        A kernel attachment MIME bundle.

                        Returns

                        - The data for the payload.

                      namespace IAttachmentModel

                      namespace IAttachmentModel {}
                      • The namespace for IAttachmentModel sub-interfaces.

                      interface IOptions

                      interface IOptions {}
                      • The options used to create a notebook attachment model.

                      property value

                      value: nbformat.IMimeBundle;
                      • The raw attachment value.

                      namespace IOutputModel

                      namespace IOutputModel {}
                      • The namespace for IOutputModel sub-interfaces.

                      interface IOptions

                      interface IOptions {}
                      • The options used to create a notebook output model.

                      property trusted

                      trusted?: boolean;
                      • Whether the output is trusted. The default is false.

                      property value

                      value: nbformat.IOutput;
                      • The raw output value.

                      namespace IRenderMimeRegistry

                      namespace IRenderMimeRegistry {}

                        interface ICloneOptions

                        interface ICloneOptions {}
                        • The options used to clone a rendermime instance.

                        property latexTypesetter

                        latexTypesetter?: IRenderMime.ILatexTypesetter;
                        • The new LaTeX typesetter.

                        property linkHandler

                        linkHandler?: IRenderMime.ILinkHandler;
                        • The new path handler.

                        property markdownParser

                        markdownParser?: IRenderMime.IMarkdownParser;
                        • The new Markdown parser.

                        property resolver

                        resolver?: IRenderMime.IResolver;
                        • The new resolver object.

                        property sanitizer

                        sanitizer?: IRenderMime.ISanitizer;
                        • The new sanitizer used to sanitize untrusted html inputs.

                        property translator

                        translator?: ITranslator;
                        • The application language translator.

                        namespace MimeModel

                        namespace MimeModel {}
                        • The namespace for MimeModel class statics.

                        interface IOptions

                        interface IOptions {}
                        • The options used to create a mime model.

                        property callback

                        callback?: (options: IRenderMime.IMimeModel.ISetDataOptions) => void;
                        • A callback function for when the data changes.

                        property data

                        data?: ReadonlyPartialJSONObject;
                        • The initial mime data.

                        property metadata

                        metadata?: ReadonlyPartialJSONObject;
                        • The initial mime metadata.

                        property trusted

                        trusted?: boolean;
                        • Whether the model is trusted. Defaults to false.

                        namespace OutputModel

                        namespace OutputModel {}
                        • The namespace for OutputModel statics.

                        function getData

                        getData: (output: nbformat.IOutput) => PartialJSONObject;
                        • Get the data for an output.

                          Parameter output

                          A kernel output message payload.

                          Returns

                          - The data for the payload.

                        function getMetadata

                        getMetadata: (output: nbformat.IOutput) => PartialJSONObject;
                        • Get the metadata from an output message.

                          Parameter output

                          A kernel output message payload.

                          Returns

                          - The metadata for the payload.

                        namespace renderError

                        namespace renderError {}
                        • The namespace for the renderError function statics.

                        interface IRenderOptions

                        interface IRenderOptions {}
                        • The options for the renderError function.

                        property host

                        host: HTMLElement;
                        • The host node for the error content.

                        property linkHandler

                        linkHandler: IRenderMime.ILinkHandler | null;
                        • An optional link handler.

                        property resolver

                        resolver: IRenderMime.IResolver | null;
                        • An optional url resolver.

                        property sanitizer

                        sanitizer: IRenderMime.ISanitizer;
                        • The html sanitizer for untrusted source.

                        property source

                        source: string;
                        • The source error to render.

                        property translator

                        translator?: ITranslator;
                        • The application language translator.

                        namespace renderHTML

                        namespace renderHTML {}
                        • The namespace for the renderHTML function statics.

                        interface IOptions

                        interface IOptions {}
                        • The options for the renderHTML function.

                        property host

                        host: HTMLElement;
                        • The host node for the rendered HTML.

                        property latexTypesetter

                        latexTypesetter: IRenderMime.ILatexTypesetter | null;
                        • The LaTeX typesetter for the application.

                        property linkHandler

                        linkHandler: IRenderMime.ILinkHandler | null;
                        • An optional link handler.

                        property resolver

                        resolver: IRenderMime.IResolver | null;
                        • An optional url resolver.

                        property sanitizer

                        sanitizer: IRenderMime.ISanitizer;
                        • The html sanitizer for untrusted source.

                        property shouldTypeset

                        shouldTypeset: boolean;
                        • Whether the node should be typeset.

                        property source

                        source: string;
                        • The HTML source to render.

                        property translator

                        translator?: ITranslator;
                        • The application language translator.

                        property trusted

                        trusted: boolean;
                        • Whether the source is trusted.

                        namespace renderImage

                        namespace renderImage {}
                        • The namespace for the renderImage function statics.

                        interface IRenderOptions

                        interface IRenderOptions {}
                        • The options for the renderImage function.

                        property height

                        height?: number;
                        • The optional height for the image.

                        property host

                        host: HTMLElement;
                        • The image node to update with the content.

                        property mimeType

                        mimeType: string;
                        • The mime type for the image.

                        property needsBackground

                        needsBackground?: string;
                        • Whether an image requires a background for legibility.

                        property source

                        source: string;
                        • The base64 encoded source for the image.

                        property unconfined

                        unconfined?: boolean;
                        • Whether the image should be unconfined.

                        property width

                        width?: number;
                        • The optional width for the image.

                        namespace renderLatex

                        namespace renderLatex {}
                        • The namespace for the renderLatex function statics.

                        interface IRenderOptions

                        interface IRenderOptions {}
                        • The options for the renderLatex function.

                        property host

                        host: HTMLElement;
                        • The host node for the rendered LaTeX.

                        property latexTypesetter

                        latexTypesetter: IRenderMime.ILatexTypesetter | null;
                        • The LaTeX typesetter for the application.

                        property resolver

                        resolver?: IRenderMime.IResolver | null;
                        • An optional url resolver.

                        property shouldTypeset

                        shouldTypeset: boolean;
                        • Whether the node should be typeset.

                        property source

                        source: string;
                        • The LaTeX source to render.

                        namespace renderMarkdown

                        namespace renderMarkdown {}
                        • The namespace for the renderMarkdown function statics.

                        function createHeaderId

                        createHeaderId: (header: Element) => string;
                        • Create a normalized id for a header element.

                          Parameter header

                          Header element

                          Returns

                          Normalized id

                        interface IRenderOptions

                        interface IRenderOptions {}
                        • The options for the renderMarkdown function.

                        property host

                        host: HTMLElement;
                        • The host node for the rendered Markdown.

                        property latexTypesetter

                        latexTypesetter: IRenderMime.ILatexTypesetter | null;
                        • The LaTeX typesetter for the application.

                        property linkHandler

                        linkHandler: IRenderMime.ILinkHandler | null;
                        • An optional link handler.

                        property markdownParser

                        markdownParser: IRenderMime.IMarkdownParser | null;
                        • The Markdown parser.

                        property resolver

                        resolver: IRenderMime.IResolver | null;
                        • An optional url resolver.

                        property sanitizer

                        sanitizer: IRenderMime.ISanitizer;
                        • The html sanitizer for untrusted source.

                        property shouldTypeset

                        shouldTypeset: boolean;
                        • Whether the node should be typeset.

                        property source

                        source: string;
                        • The Markdown source to render.

                        property translator

                        translator?: ITranslator;
                        • The application language translator.

                        property trusted

                        trusted: boolean;
                        • Whether the source is trusted.

                        namespace RenderMimeRegistry

                        namespace RenderMimeRegistry {}
                        • The namespace for RenderMimeRegistry class statics.

                        class UrlResolver

                        class UrlResolver implements IUrlResolver {}
                        • A default resolver that uses a given reference path and a contents manager.

                        constructor

                        constructor(options: IUrlResolverOptions);
                        • Create a new url resolver.

                        property path

                        path: string;
                        • The path of the object, from which local urls can be derived.

                        method getDownloadUrl

                        getDownloadUrl: (urlPath: string) => Promise<string>;
                        • Get the download url of a given absolute url path.

                          #### Notes The returned URL may include a query parameter.

                        method isLocal

                        isLocal: (url: string, allowRoot?: boolean) => boolean;
                        • Whether the URL should be handled by the resolver or not.

                          Parameter allowRoot

                          Whether the paths starting at Unix-style filesystem root (/) are permitted.

                          #### Notes This is similar to the isLocal check in URLExt, but it also checks whether the path points to any of the IDrives that may be registered with the contents manager.

                        method isMalformed

                        isMalformed: (url: string) => boolean;
                        • Whether the URL can be decoded using decodeURI.

                        method resolvePath

                        resolvePath: (path: string) => Promise<IRenderMime.IResolvedLocation | null>;
                        • Resolve a path from Jupyter kernel to a path: - relative to root_dir (preferably) this is in jupyter-server scope, - path understood and known by kernel (if such a path exists). Returns null if there is no file matching provided path in neither kernel nor jupyter-server contents manager.

                        method resolveUrl

                        resolveUrl: (url: string) => Promise<string>;
                        • Resolve a relative url to an absolute url path.

                        interface IOptions

                        interface IOptions {}
                        • The options used to initialize a rendermime instance.

                        property initialFactories

                        initialFactories?: ReadonlyArray<IRenderMime.IRendererFactory>;
                        • Initial factories to add to the rendermime instance.

                        property latexTypesetter

                        latexTypesetter?: IRenderMime.ILatexTypesetter;
                        • An optional LaTeX typesetter.

                        property linkHandler

                        linkHandler?: IRenderMime.ILinkHandler;
                        • An optional path handler.

                        property markdownParser

                        markdownParser?: IRenderMime.IMarkdownParser;
                        • An optional Markdown parser.

                        property resolver

                        resolver?: IRenderMime.IResolver;
                        • The initial resolver object.

                          The default is null.

                        property sanitizer

                        sanitizer?: IRenderMime.ISanitizer;
                        • The sanitizer used to sanitize untrusted html inputs.

                          If not given, a default sanitizer will be used.

                        property translator

                        translator?: ITranslator;
                        • The application language translator.

                        interface IUrlResolver

                        interface IUrlResolver extends IRenderMime.IResolver {}

                          property path

                          path: string;
                          • The path of the object, from which local urls can be derived.

                          interface IUrlResolverFactory

                          interface IUrlResolverFactory {}
                          • The factory of resolvers.

                          method createResolver

                          createResolver: (
                          options: RenderMimeRegistry.IUrlResolverOptions
                          ) => IUrlResolver;
                          • Create an URL resolver.

                          interface IUrlResolverOptions

                          interface IUrlResolverOptions {}
                          • The options used to create a UrlResolver.

                          property contents

                          contents: Contents.IManager;
                          • The contents manager used by the resolver.

                          property path

                          path: string;
                          • The path providing context for local urls.

                            #### Notes Either session or path must be given, and path takes precedence.

                          namespace renderSVG

                          namespace renderSVG {}
                          • The namespace for the renderSVG function statics.

                          interface IRenderOptions

                          interface IRenderOptions {}
                          • The options for the renderSVG function.

                          property host

                          host: HTMLElement;
                          • The host node for the rendered SVG.

                          property source

                          source: string;
                          • The SVG source.

                          property translator

                          translator: ITranslator;
                          • The application language translator.

                          property trusted

                          trusted: boolean;
                          • Whether the source is trusted.

                          property unconfined

                          unconfined?: boolean;
                          • Whether the svg should be unconfined.

                          namespace renderText

                          namespace renderText {}
                          • The namespace for the renderText function statics.

                          interface IRenderOptions

                          interface IRenderOptions {}
                          • The options for the renderText function.

                          property host

                          host: HTMLElement;
                          • The host node for the text content.

                          property sanitizer

                          sanitizer: IRenderMime.ISanitizer;
                          • The html sanitizer for untrusted source.

                          property source

                          source: string;
                          • The source text to render.

                          property translator

                          translator?: ITranslator;
                          • The application language translator.

                          Package Files (10)

                          Dependencies (12)

                          Dev Dependencies (7)

                          Peer Dependencies (0)

                          No peer dependencies.

                          Badge

                          To add a badge like this onejsDocs.io badgeto your package's README, use the codes available below.

                          You may also use Shields.io to create a custom badge linking to https://www.jsdocs.io/package/@jupyterlab/rendermime.

                          • Markdown
                            [![jsDocs.io](https://img.shields.io/badge/jsDocs.io-reference-blue)](https://www.jsdocs.io/package/@jupyterlab/rendermime)
                          • HTML
                            <a href="https://www.jsdocs.io/package/@jupyterlab/rendermime"><img src="https://img.shields.io/badge/jsDocs.io-reference-blue" alt="jsDocs.io"></a>