How to use the @jupyterlab/rendermime.markdownRendererFactory.mimeTypes 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 jupyter / nbdime / packages / webapp / src / app / rendermime.ts View on Github external
// Check if it is an image, if so, replace it with our own placeholder
      if (path.match(/.*\.(png|apng|svg|jpeg|jpg|bmp|ico|gif|xbm)$/i)) {
        return Promise.resolve(UNCHANGED_IMAGE);
      }
    }
    if (!this.innerResolver) {
      return Promise.resolve(path);
    }
    return this.innerResolver.getDownloadUrl(path);
  }
}


class NbdimeMarkdownFactory implements IRenderMime.IRendererFactory {
  readonly safe = markdownRendererFactory.safe;
  readonly mimeTypes = markdownRendererFactory.mimeTypes;

  createRenderer(options: IRenderMime.IRendererOptions): IRenderMime.IRenderer {
    options.resolver = new MarkdownImageResolver(options.resolver);
    return markdownRendererFactory.createRenderer(options);
  }
}


let factories: IRenderMime.IRendererFactory[] = [];
for (let f of standardRendererFactories) {
  if (f === markdownRendererFactory) {
    factories.push(new NbdimeMarkdownFactory());
  } else {
    factories.push(f);
  }
}
github jupyterlab / jupyterlab / tests / test-rendermime / src / factories.spec.ts View on Github external
it('should have the text/markdown mimeType', function() {
        expect(markdownRendererFactory.mimeTypes).to.deep.equal([
          'text/markdown'
        ]);
      });
    });
github jupyterlab / jupyterlab-data-explorer / tests / test-rendermime / src / factories.spec.ts View on Github external
it('should have the text/markdown mimeType', function() {
        expect(markdownRendererFactory.mimeTypes).to.deep.equal([
          'text/markdown'
        ]);
      });
    });