Skip to content

Commit dcfa995

Browse files
committed
Update usage of node-main
1 parent 8d5c3c5 commit dcfa995

File tree

2 files changed

+9
-10
lines changed

2 files changed

+9
-10
lines changed

server/main.rst

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -29,8 +29,8 @@ Create a file named :file:`test-mathjax.mjs` containing the following:
2929

3030
.. code-block:: javascript
3131
32-
import {init} from "@mathjax/src";
33-
await init({loader: {load: ['input/tex']}});
32+
import MathJax from "@mathjax/src";
33+
await MathJax.init({loader: {load: ['input/tex']}});
3434
const mml = (await MathJax.tex2mmlPromise('x+y'));
3535
console.log(mml);
3636
@@ -59,7 +59,8 @@ This is you first MathJax node program!
5959

6060
.. code-block:: javascript
6161
62-
require("@mathjax/src").init({
62+
const MathJax = require("@mathjax/src");
63+
MathJax.init({
6364
loader: {load: ['input/tex']}
6465
}).then(() => MathJax.tex2mmlPromise('x+y'))
6566
.then((mml) => console.log(mml));
@@ -112,15 +113,13 @@ To do so, use either
112113

113114
.. code-block:: javascript
114115
115-
import {init} from '@mathjax/src/source';
116+
import MathJax from '@mathjax/src/source';
116117
117118
or
118119

119120
.. code-block:: javascript
120121
121-
require('@mathjax/src/source').init({...}).then((MathJax) => {
122-
... // code that uses MathJax here
123-
});
122+
const MathJax = require('@mathjax/src/source');
124123
125124
when loading MathJax.
126125

upgrading/whats-new-4.0/es6-modules.rst

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -165,15 +165,15 @@ In order to get the source versions in ``@mathjax/src``, use
165165

166166
.. code-block:: js
167167
168-
require('@mathjax/src/source').init(...)
168+
const MathJax = require('@mathjax/src/source');
169169
170170
or
171171

172172
.. code-block:: js
173173
174-
import {init} from '@mathjax/src/source'
174+
import MathJax from '@mathjax/src/source';
175175
176-
and then call ``init(...)``. These load
176+
and then call ``MathJax.init(...)``. These load
177177
``components/mjs/node-main/node-main.mjs`` or
178178
``components/cjs/node-main/node-main.cjs``, respectively.
179179

0 commit comments

Comments
 (0)