How to use the @jupyterlab/rendermime.standardRendererFactories.filter 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 minrk / thebelab / src / thebelab.js View on Github external
function getRenderers(options) {
  if (!_renderers) {
    _renderers = standardRendererFactories.filter(f => {
      // filter out latex renderer if mathjax is unavailable
      if (f.mimeTypes.indexOf("text/latex") >= 0) {
        if (options.mathjaxUrl) {
          return true;
        } else {
          console.log("MathJax unavailable");
          return false;
        }
      } else {
        return true;
      }
    });
  }
  return _renderers;
}
// rendering cells
github ines / juniper / src / index.js View on Github external
getRenderers() {
        if(!this._renderers) {
            this._renderers = standardRendererFactories.filter(factory =>
                factory.mimeTypes.includes('text/latex') ?
                    (typeof window !== 'undefined' && window.MathJax) : true);
        }
        return this._renderers;
    }
github ines / spacy-course / src / components / juniper.js View on Github external
componentDidMount() {
        this.setState({ content: this.props.children })
        const renderers = standardRendererFactories.filter(factory =>
            factory.mimeTypes.includes('text/latex') ? window.MathJax : true
        )

        const outputArea = new OutputArea({
            model: new OutputAreaModel({ trusted: true }),
            rendermime: new RenderMimeRegistry({ initialFactories: renderers }),
        })

        const cm = new CodeMirror(this.inputRef, {
            value: this.props.children.trim(),
            mode: this.props.lang,
            theme: this.props.theme,
        })
        this.setState({ cm })

        const runCode = wrapper => {
github explosion / spaCy / website / src / components / juniper.js View on Github external
componentDidMount() {
        const renderers = standardRendererFactories.filter(factory =>
            factory.mimeTypes.includes('text/latex') ? window.MathJax : true
        )

        const outputArea = new OutputArea({
            model: new OutputAreaModel({ trusted: true }),
            rendermime: new RenderMimeRegistry({ initialFactories: renderers }),
        })

        const cm = new CodeMirror(this.inputRef, {
            value: this.props.children.trim(),
            mode: this.props.lang,
            theme: this.props.theme,
        })

        const runCode = () => this.execute(outputArea, cm.getValue())
        cm.setOption('extraKeys', { 'Shift-Enter': runCode })