How to use the @jupyterlab/docregistry.MimeRendererFactory function in @jupyterlab/docregistry

To help you get started, we’ve selected a few @jupyterlab/docregistry examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github jupyterlab / jupyterlab / packages / markdownviewer-extension / src / index.ts View on Github external
function activate(app: JupyterLab, restorer: ILayoutRestorer) {
    const factory = new MimeRendererFactory({
      name: FACTORY,
      fileExtensions: ['.md'],
      mimeType: 'text/markdown',
      rendermime: app.rendermime

    const { commands } = app;
    const namespace = 'rendered-markdown';
    const tracker = new InstanceTracker({ namespace });

    // Handle state restoration.
    restorer.restore(tracker, {
      command: 'docmanager:open',
      args: widget => ({ path: widget.context.path, factory: FACTORY }),
      name: widget => widget.context.path