forked from jupyterlab/jupyterlab
-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.ts
40 lines (31 loc) · 1.14 KB
/
index.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
/*-----------------------------------------------------------------------------
| Copyright (c) Jupyter Development Team.
| Distributed under the terms of the Modified BSD License.
|----------------------------------------------------------------------------*/
import { JupyterFrontEndPlugin } from '@jupyterlab/application';
import { PageConfig } from '@jupyterlab/coreutils';
import { ILatexTypesetter } from '@jupyterlab/rendermime';
import { MathJaxTypesetter } from '@jupyterlab/mathjax2';
/**
* The MathJax latexTypesetter plugin.
*/
const plugin: JupyterFrontEndPlugin<ILatexTypesetter> = {
id: '@jupyterlab/mathjax2-extension:plugin',
autoStart: true,
provides: ILatexTypesetter,
activate: () => {
const url = PageConfig.getOption('mathjaxUrl');
const config = PageConfig.getOption('mathjaxConfig');
if (!url) {
const message =
`${plugin.id} uses 'mathJaxUrl' and 'mathjaxConfig' in PageConfig ` +
`to operate but 'mathJaxUrl' was not found.`;
throw new Error(message);
}
return new MathJaxTypesetter({ url, config });
}
};
/**
* Export the plugin as default.
*/
export default plugin;