@jupyterlab/rendermime-interfaces

  • Version 3.3.2
  • Published
  • 14.4 kB
  • 3 dependencies
  • BSD-3-Clause license

Install

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

Overview

rendermime-interfaces

Index

Namespaces

namespace IRenderMime

namespace IRenderMime {}
  • A namespace for rendermime associated interfaces.

interface IDocumentWidgetFactoryOptions

interface IDocumentWidgetFactoryOptions {}
  • The options used to initialize a document widget factory.

    This interface is intended to be used by mime renderer extensions to define a document opener that uses its renderer factory.

property defaultFor

readonly defaultFor?: ReadonlyArray<string>;
  • The file types for which the factory should be the default.

property defaultRendered

readonly defaultRendered?: ReadonlyArray<string>;
  • The file types for which the factory should be the default for rendering, if that is different than the default factory (which may be for editing) If undefined, then it will fall back on the default file type.

property fileTypes

readonly fileTypes: ReadonlyArray<string>;
  • The file types the widget can view.

property modelName

readonly modelName?: string;
  • The name of the document model type.

property name

readonly name: string;
  • The name of the widget to display in dialogs.

property primaryFileType

readonly primaryFileType: string;
  • The primary file type of the widget.

property toolbarFactory

readonly toolbarFactory?: (widget?: IRenderer) => IToolbarItem[];
  • A function returning a list of toolbar items to add to the toolbar.

interface IExtension

interface IExtension {}
  • An interface for using a RenderMime.IRenderer for output and read-only documents.

property dataType

readonly dataType?: 'string' | 'json';
  • Preferred data type from the model. Defaults to string.

property documentWidgetFactoryOptions

readonly documentWidgetFactoryOptions?:
| IDocumentWidgetFactoryOptions
| ReadonlyArray<IDocumentWidgetFactoryOptions>;
  • The options used to open a document with the renderer factory.

property fileTypes

readonly fileTypes?: ReadonlyArray<IFileType>;
  • The optional file type associated with the extension.

property id

readonly id: string;
  • The ID of the extension.

    #### Notes The convention for extension IDs in JupyterLab is the full NPM package name followed by a colon and a unique string token, e.g. '@jupyterlab/apputils-extension:settings' or 'foo-extension:bar'.

property rank

readonly rank?: number;
  • The rank passed to RenderMime.addFactory. If not given, defaults to the defaultRank of the factory.

property rendererFactory

readonly rendererFactory: IRendererFactory;
  • A renderer factory to be registered to render the MIME type.

property renderTimeout

readonly renderTimeout?: number;
  • The timeout after user activity to re-render the data.

interface IExtensionModule

interface IExtensionModule {}
  • The interface for a module that exports an extension or extensions as the default value.

property default

readonly default: IExtension | ReadonlyArray<IExtension>;
  • The default export.

interface IFileType

interface IFileType {}
  • A file type to associate with the renderer.

property displayName

readonly displayName?: string;
  • An optional display name for the file type.

property extensions

readonly extensions: ReadonlyArray<string>;
  • The extensions of the file type (e.g. ".txt"). Can be a compound extension (e.g. ".table.json).

property fileFormat

readonly fileFormat?: string;
  • The file format for the file type ('text', 'base64', or 'json').

property icon

readonly icon?: LabIcon.IResolvable;
  • The icon for the file type. Can either be a string containing the name of an existing icon, or an object with {name, svgstr} fields, where svgstr is a string containing the raw contents of an svg file.

property iconClass

readonly iconClass?: string;
  • The icon class name for the file type.

property iconLabel

readonly iconLabel?: string;
  • The icon label for the file type.

property mimeTypes

readonly mimeTypes: ReadonlyArray<string>;
  • The mime types associated the file type.

property name

readonly name: string;
  • The name of the file type.

property pattern

readonly pattern?: string;
  • An optional pattern for a file name (e.g. ^Dockerfile$).

interface ILatexTypesetter

interface ILatexTypesetter {}
  • The interface for a LaTeX typesetter.

method typeset

typeset: (element: HTMLElement) => void;
  • Typeset a DOM element.

    Parameter element

    the DOM element to typeset. The typesetting may happen synchronously or asynchronously.

    #### Notes The application-wide rendermime object has a settable latexTypesetter property which is used wherever LaTeX typesetting is required. Extensions wishing to provide their own typesetter may replace that on the global lab.rendermime.

interface ILinkHandler

interface ILinkHandler {}
  • An object that handles links on a node.

handleLink: (node: HTMLElement, path: string, id?: string) => void;
  • Add the link handler to the node.

    Parameter node

    : the anchor node for which to handle the link.

    Parameter path

    : the path to open when the link is clicked.

    Parameter id

    : an optional element id to scroll to when the path is opened.

interface IMimeModel

interface IMimeModel {}
  • A model for mime data.

property data

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

property metadata

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

    Among others, it can include an attribute named fragment that stores a URI fragment identifier for the MIME resource.

property trusted

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

method setData

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

    #### Notes Calling this function may trigger an asynchronous operation that could cause the renderer to be rendered with a new model containing the new data.

interface IRenderer

interface IRenderer extends Widget {}
  • A widget which displays the contents of a mime model.

property translator

translator?: ITranslator;
  • The application language translator.

method renderModel

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

    Parameter model

    The mime model to render.

    Returns

    A promise which resolves when rendering is complete.

    #### Notes This method may be called multiple times during the lifetime of the widget to update it if and when new data is available.

interface IRendererFactory

interface IRendererFactory {}
  • The interface for a renderer factory.

property defaultRank

readonly defaultRank?: number;
  • The default rank of the factory. If not given, defaults to 100.

property mimeTypes

readonly mimeTypes: ReadonlyArray<string>;
  • The mime types handled by this factory.

property safe

readonly safe: boolean;
  • Whether the factory is a "safe" factory.

    #### Notes A "safe" factory produces renderer widgets which can render untrusted model data in a usable way. *All* renderers must handle untrusted data safely, but some may simply failover with a "Run cell to view output" message. A "safe" renderer is an indication that its sanitized output will be useful.

method createRenderer

createRenderer: (options: IRendererOptions) => IRenderer;
  • Create a renderer which displays the mime data.

    Parameter options

    The options used to render the data.

interface IRendererOptions

interface IRendererOptions {}
  • The options used to create a renderer.

property latexTypesetter

latexTypesetter: ILatexTypesetter | null;
  • The LaTeX typesetter.

property linkHandler

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

property mimeType

mimeType: string;
  • The preferred mimeType to render.

property resolver

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

property sanitizer

sanitizer: ISanitizer;
  • The html sanitizer.

property translator

translator?: ITranslator;
  • The application language translator.

interface IResolver

interface IResolver {}
  • An object that resolves relative URLs.

property isLocal

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

    #### Notes This is similar to the isLocal check in URLExt, but can also perform additional checks on whether the resolver should handle a given URL.

method getDownloadUrl

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

    #### Notes This URL may include a query parameter.

method resolveUrl

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

interface ISanitizer

interface ISanitizer {}
  • An object that handles html sanitization.

method sanitize

sanitize: (dirty: string) => string;
  • Sanitize an HTML string.

interface IToolbarItem

interface IToolbarItem {}
  • A toolbar item.

property name

name: string;
  • Item name

property widget

widget: Widget;
  • Toolbar widget

namespace IRenderMime.IMimeModel

namespace IRenderMime.IMimeModel {}
  • The namespace for IMimeModel associated interfaces.

interface ISetDataOptions

interface ISetDataOptions {}
  • The options used to update a mime model.

property data

data?: ReadonlyPartialJSONObject;
  • The new data object.

property metadata

metadata?: ReadonlyPartialJSONObject;
  • The new metadata object.

namespace IRenderMime.LabIcon

namespace IRenderMime.LabIcon {}

    interface IIcon

    interface IIcon {}
    • The simplest possible interface for defining a generic icon.

    property name

    readonly name: string;
    • The name of the icon. By convention, the icon name will be namespaced as so:

      "pkg-name:icon-name"

    property svgstr

    svgstr: string;
    • A string containing the raw contents of an svg file.

    interface IRenderer

    interface IRenderer {}
    • Interface for generic renderer.

    property render

    readonly render: (container: HTMLElement, options?: any) => void;

      property unrender

      readonly unrender: (container: HTMLElement) => void;

        type IResolvable

        type IResolvable = string | (IIcon & Partial<IRenderer>);
        • A type that can be resolved to a LabIcon instance.

        Package Files (1)

        Dependencies (3)

        Dev Dependencies (3)

        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-interfaces.

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