Skip to content

Commit

Permalink
Iterate
Browse files Browse the repository at this point in the history
  • Loading branch information
martinRenou committed Oct 1, 2024
1 parent de32205 commit 68384fc
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 17 deletions.
2 changes: 2 additions & 0 deletions packages/voila/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,8 @@ export {
EditorLanguageRegistry
} from '@jupyterlab/codemirror';

export { PageConfig } from '@jupyterlab/coreutils';

export { MathJaxTypesetter } from '@jupyterlab/mathjax2-extension';

export { createMarkdownParser } from '@jupyterlab/markedparser-extension';
Expand Down
16 changes: 0 additions & 16 deletions packages/voila/src/manager.ts
Original file line number Diff line number Diff line change
Expand Up @@ -71,22 +71,6 @@ if (typeof window !== 'undefined' && typeof window.define !== 'undefined') {
window.define('@lumino/domutils', LuminoDomutils);
}

const [urlParam, configParam] = ['fullMathjaxUrl', 'mathjaxConfig'];
const url = CoreUtils.PageConfig.getOption(urlParam);
const config = CoreUtils.PageConfig.getOption(configParam);
if (url !== 'null' || config !== 'null') {
CoreUtils.PageConfig.setOption(
urlParam,
url === 'null'
? 'https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.7/MathJax.js'
: url
);
CoreUtils.PageConfig.setOption(
configParam,
config === 'null' ? 'TeX-AMS_CHTML-full,Safe' : config
);
}

const WIDGET_MIMETYPE = 'application/vnd.jupyter.widget-view+json';

/**
Expand Down
18 changes: 17 additions & 1 deletion share/jupyter/voila/templates/base/static/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -44,9 +44,25 @@ require([window.voila_js_url || 'static/voila'], function(voila) {

const languages = new voila.EditorLanguageRegistry();

const [urlParam, configParam] = ['fullMathjaxUrl', 'mathjaxConfig'];
const url = voila.PageConfig.getOption(urlParam);
const config = voila.PageConfig.getOption(configParam);
if (url !== 'null' || config !== 'null') {
voila.PageConfig.setOption(
urlParam,
url === 'null'
? 'https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.7/MathJax.js'
: url
);
voila.PageConfig.setOption(
configParam,
config === 'null' ? 'TeX-AMS_CHTML-full,Safe' : config
);
}

const rendermime = new voila.RenderMimeRegistry({
initialFactories: voila.extendedRendererFactories,
latexTypesetter: new voila.MathJaxTypesetter(),
latexTypesetter: new voila.MathJaxTypesetter({ url: voila.PageConfig.getOption(urlParam), config: voila.PageConfig.getOption(configParam) }),
markdownParser: voila.createMarkdownParser(languages)
});

Expand Down

0 comments on commit 68384fc

Please sign in to comment.