How to use the @jupyterlab/rendermime.RenderMime function in @jupyterlab/rendermime

To help you get started, we’ve selected a few @jupyterlab/rendermime 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 / examples / notebook / src / index.ts View on Github external
function createApp(manager: ServiceManager.IManager): void {
  // Initialize the command registry with the bindings.
  let commands = new CommandRegistry();
  let useCapture = true;

  // Setup the keydown listener for the document.
  document.addEventListener('keydown', event => {
    commands.processKeydownEvent(event);
  }, useCapture);

  let rendermime = new RenderMime({
    initialFactories: defaultRendererFactories
  });

  let opener = {
    open: (widget: Widget) => {
      // Do nothing for sibling widgets for now.
    }
  };

  let docRegistry = new DocumentRegistry();
  let docManager = new DocumentManager({
    registry: docRegistry,
    manager,
    opener
  });
  let mFactory = new NotebookModelFactory({});
github yuvipanda / simplest-notebook / examples / console / src / index.ts View on Github external
function startApp(path: string, manager: ServiceManager.IManager) {

  // Initialize the command registry with the key bindings.
  let commands = new CommandRegistry();

  // Setup the keydown listener for the document.
  document.addEventListener('keydown', event => {
    commands.processKeydownEvent(event);
  });

  let rendermime = new RenderMime({
    initialFactories: defaultRendererFactories
  });

  let editorFactory = editorServices.factoryService.newInlineEditor.bind(
    editorServices.factoryService);
  let contentFactory = new ConsolePanel.ContentFactory({ editorFactory });
  let consolePanel = new ConsolePanel({
    rendermime,
    manager,
    path,
    contentFactory,
    mimeTypeService: editorServices.mimeTypeService
  });
  consolePanel.title.label = TITLE;

  let palette = new CommandPalette({ commands });
github pbugnion / ipywidgets_server / js / renderMime.js View on Github external
import { RenderMime, defaultRendererFactories } from '@jupyterlab/rendermime';

export const renderMime = new RenderMime({
    initialFactories: defaultRendererFactories
});
github yuvipanda / simplest-notebook / packages / application / src / index.ts View on Github external
settingsDir: options.settingsDir || '',
      assetsDir: options.assetsDir || ''
    };
    if (options.devMode) {
      this.shell.addClass('jp-mod-devMode');
    }
    let linker = new CommandLinker({ commands: this.commands });
    this.commandLinker = linker;

    let linkHandler = {
      handleLink: (node: HTMLElement, path: string) => {
        linker.connectNode(node, 'docmanager:open', { path });
      }
    };
    let initialFactories = defaultRendererFactories;
    this.rendermime = new RenderMime({ initialFactories, linkHandler });

    let registry = this.docRegistry = new DocumentRegistry();
    registry.addModelFactory(new TextModelFactory());
    registry.addModelFactory(new Base64ModelFactory());
    registry.addFileType({
      name: 'Text',
      extension: '.txt',
      contentType: 'file',
      fileFormat: 'text'
    });
    registry.addCreator({ name: 'Text File', fileType: 'Text', });

    if (options.mimeExtensions) {
      let plugins = createRendermimePlugins(options.mimeExtensions);
      plugins.forEach(plugin => { this.registerPlugin(plugin); });
    }
github jupyterlab / jupyterlab / packages / rendermime-extension / src / index.ts View on Github external
function activate(app: JupyterLab, linker: ICommandLinker): IRenderMime {
  let linkHandler = {
    handleLink: (node: HTMLElement, path: string) => {
      linker.connectNode(node, 'file-operations:open', { path });
    }
  };
  let items = RenderMime.getDefaultItems();
  return new RenderMime({ items, linkHandler });
};