@@ -51,7 +51,7 @@ If you are loading MathJax from a CDN into a web page, there is no
5151need to install anything. Simply use a ` script ` tag that loads
5252MathJax from the CDN. E.g.,
5353
54- ``` html
54+ ``` html
5555<script id =" MathJax-script" async src =" https://cdn.jsdelivr.net/npm/mathjax@3/es5/tex-mml-chtml.js" ></script >
5656```
5757
@@ -62,44 +62,48 @@ and the [MathJax Component
6262Repository] ( https://github.com/mathjax/MathJax-demos-web ) for more information.
6363
6464
65-
66-
6765### Using MathJax Components in node applications
6866
6967To use MathJax components in a node application, install the ` mathjax ` package:
7068
71- npm install mathjax@3
69+ ``` bash
70+ npm install mathjax@3
71+ ```
7272
73- (we are still making updates to version 2, so you should include ` @3 ` since the latest chronological version may not be version 3).
73+ (we are still making updates to version 2, so you should include ` @3 `
74+ since the latest chronological version may not be version 3).
7475
7576Then require ` mathjax ` within your application:
7677
77- ``` js
78+ ``` javascript
7879require (' mathjax' ).init ({ ... }).then ((MathJax ) => { ... });
7980```
8081
8182where the first ` { ... } ` is a MathJax configuration, and the second
8283` { ... } ` is the code to run after MathJax has been loaded. E.g.
8384
84- ``` js
85+ ``` javascript
8586require (' mathjax' ).init ({
86- loader: {
87- require: require,
88- paths: {mathjax: ' mathjax/es5' },
89- load: [' input/tex' , ' output/svg' ]
90- }
87+ loader: {load: [' input/tex' , ' output/svg' ]}
9188}).then ((MathJax ) => {
9289 const svg = MathJax .tex2svg (' \\ frac{1}{x^2-1}' , {display: true });
9390 console .log (MathJax .startup .adaptor .outerHTML (svg));
9491}).catch ((err ) => console .log (err .message ));
9592```
9693
94+ ** Note:** this technique is for node-based application only, not for
95+ browser applications. This method sets up an alternative DOM
96+ implementation, which you don't need in the browser, and tells MathJax
97+ to use node's ` require() ` command to load external modules. This
98+ setup will not work properly in the browser, even if you webpack it or
99+ bundle it in other ways.
97100
98101See the
99102[ documentation] ( https//docs.mathjax.org/en/latest/index.html#server-nodejs )
100103and the [ MathJax Node
101104Repository] ( https://github.com/mathjax/MathJax-demos-node ) for more details.
102105
106+
103107### Using MathJax modules directly in node applications
104108
105109You can use the MathJax JavaScript files (as opposed to MathJax
@@ -124,7 +128,7 @@ demos](https://github.com/mathjax/MathJax-demos-node) for examples).
124128
125129If you want to work from the GitHub repository directly, then do the following:
126130
127- ``` bash
131+ ``` bash
128132git clone https://github.com/mathjax/MathJax-src.git mathjax-src
129133cd mathjax-src
130134npm run --silent compile
0 commit comments