How to use the @jupyterlab/markdownviewer.MarkdownViewerFactory function in @jupyterlab/markdownviewer

To help you get started, we’ve selected a few @jupyterlab/markdownviewer 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-data-explorer / jupyterlab / packages / markdownviewer-extension / src / index.ts View on Github external
// Fetch the initial state of the settings.
  settingRegistry
    .load(plugin.id)
    .then((settings: ISettingRegistry.ISettings) => {
      settings.changed.connect(() => {
        updateSettings(settings);
      });
      updateSettings(settings);
    })
    .catch((reason: Error) => {
      console.error(reason.message);
    });

  // Register the MarkdownViewer factory.
  const factory = new MarkdownViewerFactory({
    rendermime,
    name: FACTORY,
    primaryFileType: docRegistry.getFileType('markdown'),
    fileTypes: ['markdown'],
    defaultRendered: ['markdown']
  });
  factory.widgetCreated.connect((sender, widget) => {
    // Notify the instance tracker if restore data needs to update.
    widget.context.pathChanged.connect(() => {
      void tracker.save(widget);
    });
    // Handle the settings of new widgets.
    updateWidget(widget.content);
    void tracker.add(widget);
  });
  docRegistry.addWidgetFactory(factory);
github jupyterlab / jupyterlab / test / src / markdownviewer / widget.spec.ts View on Github external
it('should require a context parameter', () => {
        let widgetFactory = new MarkdownViewerFactory({
          name: 'markdown',
          fileExtensions: ['.md'],
          rendermime: RENDERMIME
        });
        expect(widgetFactory.createNew(context)).to.be.a(MarkdownViewer);
      });

@jupyterlab/markdownviewer

JupyterLab - Markdown viewer Widget

BSD-3-Clause
Latest version published 19 days ago

Package Health Score

95 / 100
Full package analysis