@jupyterlab/rendermime-interfaces

  • Version 3.9.6
  • Published
  • 41.2 kB
  • 2 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 label

readonly label?: string;
  • The label of the widget to display in dialogs. If not given, name is used instead.

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?: Widget) => IToolbarItem[];
  • A function returning a list of toolbar items to add to the toolbar.

property translator

readonly translator?: ITranslator;
  • The application language translator.

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 description

readonly description?: string;
  • Extension description.

    #### Notes This can be used to provide user documentation on the feature brought by the extension.

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 | null;
  • 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.

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.

method handlePath

handlePath: (
node: HTMLElement,
path: string,
scope: 'kernel' | 'server',
id?: string
) => void;
  • Add the path 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 scope

    : the scope to which the path is bound.

    Parameter id

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

interface IMarkdownParser

interface IMarkdownParser {}
  • The interface for a Markdown parser.

method render

render: (source: string) => Promise<string>;
  • Render a markdown source into unsanitized HTML.

    Parameter source

    The string to render.

    Returns

    - A promise of the string containing HTML which may require sanitization.

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.

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 markdownParser

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

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 IResolvedLocation

interface IResolvedLocation {}

    property path

    path: string;
    • Resolved path.

    property scope

    scope: 'kernel' | 'server';
    • Location scope.

    interface IResolver

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

    property 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 can also perform additional checks on whether the resolver should handle a given URL.

    property resolvePath

    resolvePath?: (path: string) => Promise<IResolvedLocation | null>;
    • Resolve a path from Jupyter kernel to a path: - relative to root_dir (preferrably) 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 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.

    getAutolink: () => boolean;
    • Returns

      Whether to replace URLs by HTML anchors.

    method sanitize

    sanitize: (dirty: string, options?: ISanitizerOptions) => string;
    • Sanitize an HTML string.

      Parameter dirty

      The dirty text.

      Parameter options

      The optional sanitization options.

      Returns

      The sanitized string.

    interface ISanitizerOptions

    interface ISanitizerOptions {}
    • The options used to sanitize.

    property allowedAttributes

    allowedAttributes?: {
    [key: string]: string[];
    };
    • The allowed attributes for a given tag.

    property allowedStyles

    allowedStyles?: {
    [key: string]: {
    [key: string]: RegExp[];
    };
    };
    • The allowed style values for a given tag.

    property allowedTags

    allowedTags?: string[];
    • The allowed tags.

    interface IToolbarItem

    interface IToolbarItem {}
    • A toolbar item.

    property name

    name: string;
    • Unique item name

    property widget

    widget: Widget;
    • Toolbar widget

    interface ITranslator

    interface ITranslator {}
    • Translation provider interface

    property languageCode

    readonly languageCode: string;
    • The code of the language in use.

    method load

    load: (domain: string) => TranslationBundle;
    • Load translation bundles for a given domain.

      Parameter domain

      The translation domain to use for translations.

      Returns

      The translation bundle if found, or the English bundle.

    type TranslationBundle

    type TranslationBundle = {
    /**
    * Alias for `gettext` (translate strings without number inflection)
    * @param msgid message (text to translate)
    * @param args
    *
    * @returns A translated string if found, or the original string.
    */
    __(msgid: string, ...args: any[]): string;
    /**
    * Alias for `ngettext` (translate accounting for plural forms)
    * @param msgid message for singular
    * @param msgid_plural message for plural
    * @param n determines which plural form to use
    * @param args
    *
    * @returns A translated string if found, or the original string.
    */
    _n(msgid: string, msgid_plural: string, n: number, ...args: any[]): string;
    /**
    * Alias for `pgettext` (translate in given context)
    * @param msgctxt context
    * @param msgid message (text to translate)
    * @param args
    *
    * @returns A translated string if found, or the original string.
    */
    _p(msgctxt: string, msgid: string, ...args: any[]): string;
    /**
    * Alias for `npgettext` (translate accounting for plural forms in given context)
    * @param msgctxt context
    * @param msgid message for singular
    * @param msgid_plural message for plural
    * @param n number used to determine which plural form to use
    * @param args
    *
    * @returns A translated string if found, or the original string.
    */
    _np(
    msgctxt: string,
    msgid: string,
    msgid_plural: string,
    n: number,
    ...args: any[]
    ): string;
    /**
    * Look up the message id in the catalog and return the corresponding message string.
    * Otherwise, the message id is returned.
    *
    * @param msgid message (text to translate)
    * @param args
    *
    * @returns A translated string if found, or the original string.
    */
    gettext(msgid: string, ...args: any[]): string;
    /**
    * Do a plural-forms lookup of a message id. msgid is used as the message id for
    * purposes of lookup in the catalog, while n is used to determine which plural form
    * to use. Otherwise, when n is 1 msgid is returned, and msgid_plural is returned in
    * all other cases.
    *
    * @param msgid message for singular
    * @param msgid_plural message for plural
    * @param n determines which plural form to use
    * @param args
    *
    * @returns A translated string if found, or the original string.
    */
    ngettext(msgid: string, msgid_plural: string, n: number, ...args: any[]): string;
    /**
    * Look up the context and message id in the catalog and return the corresponding
    * message string. Otherwise, the message id is returned.
    *
    * @param msgctxt context
    * @param msgid message (text to translate)
    * @param args
    *
    * @returns A translated string if found, or the original string.
    */
    pgettext(msgctxt: string, msgid: string, ...args: any[]): string;
    /**
    * Do a plural-forms lookup of a message id. msgid is used as the message id for
    * purposes of lookup in the catalog, while n is used to determine which plural
    * form to use. Otherwise, when n is 1 msgid is returned, and msgid_plural is
    * returned in all other cases.
    *
    * @param msgctxt context
    * @param msgid message for singular
    * @param msgid_plural message for plural
    * @param n number used to determine which plural form to use
    * @param args
    *
    * @returns A translated string if found, or the original string.
    */
    npgettext(
    msgctxt: string,
    msgid: string,
    msgid_plural: string,
    n: number,
    ...args: any[]
    ): string;
    /**
    * Do a plural-forms lookup of a message id. msgid is used as the message id for
    * purposes of lookup in the catalog, while n is used to determine which plural
    * form to use. Otherwise, when n is 1 msgid is returned, and msgid_plural is
    * returned in all other cases.
    *
    * @param domain - The translations domain.
    * @param msgctxt - The message context.
    * @param msgid - The singular string to translate.
    * @param msgid_plural - The plural string to translate.
    * @param n - The number for pluralization.
    * @param args - Any additional values to use with interpolation
    *
    * @returns A translated string if found, or the original string.
    */
    dcnpgettext(
    domain: string,
    msgctxt: string,
    msgid: string,
    msgid_plural: string,
    n: number,
    ...args: any[]
    ): string;
    };
    • Bundle of gettext-based translation functions for a specific domain.

    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, options?: any) => void;

          type IResolvable

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

          Package Files (1)

          Dependencies (2)

          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>