-
Notifications
You must be signed in to change notification settings - Fork 235
Expand file tree
/
Copy pathcore.js
More file actions
28 lines (26 loc) · 970 Bytes
/
core.js
File metadata and controls
28 lines (26 loc) · 970 Bytes
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
import './locale.js';
import './lib/core.js';
import {HTMLHandler} from '#js/handlers/html/HTMLHandler.js';
import {browserAdaptor} from '#js/adaptors/browserAdaptor.js';
import {Package} from '#js/components/package.js';
if (MathJax.startup) {
MathJax.startup.registerConstructor('HTMLHandler', HTMLHandler);
MathJax.startup.registerConstructor('browserAdaptor', browserAdaptor);
MathJax.startup.useHandler('HTMLHandler');
MathJax.startup.useAdaptor('browserAdaptor');
}
if (MathJax.loader) {
const config = MathJax.config.loader;
const {mathjax} = MathJax._.mathjax;
mathjax.asyncLoad = (name => {
if (name.match(/\.json$/)) {
if (name.charAt(0) === '[') {
name = Package.resolvePath(name);
}
return (config.json || mathjax.json)(name).then((data) => data.default ?? data);
}
return name.substring(0, 5) === 'node:'
? config.require(name)
: MathJax.loader.load(name).then(result => result[0]);
});
}