Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
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
getRenderers() {
if(!this._renderers) {
this._renderers = standardRendererFactories.filter(factory =>
factory.mimeTypes.includes('text/latex') ?
(typeof window !== 'undefined' && window.MathJax) : true);
}
return this._renderers;
}
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 => {
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 })