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.

Implements

Constructors

Properties

_factories: FactoryMap = {}
_id: number = 0
_ranks: RankMap = {}
_types: null | string[] = null
latexTypesetter: null | IRenderMime.ILatexTypesetter

The LaTeX typesetter for the rendermime.

linkHandler: null | IRenderMime.ILinkHandler

The object used to handle path opening links.

markdownParser: null | IRenderMime.IMarkdownParser

The Markdown parser for the rendermime.

resolver: null | IRenderMime.IResolver

The object used to resolve relative urls for the rendermime instance.

The sanitizer used by the rendermime instance.

translator: ITranslator

The application language translator.

Accessors

Methods

  • Add a renderer factory to the rendermime.

    Parameters

    • factory: IRenderMime.IRendererFactory

      The renderer factory of interest.

    • Optional rank: number

      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.

    Returns void

  • Find the preferred mime type for a mime bundle.

    Parameters

    • bundle: ReadonlyPartialJSONObject

      The bundle of mime data.

    • safe: "any" | "ensure" | "prefer" = 'ensure'

      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 undefined | string

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