Skip to content

Commit b526361

Browse files
committed
Merge branch 'fix-docs'
2 parents 6086219 + 981a4f7 commit b526361

File tree

2 files changed

+20
-14
lines changed

2 files changed

+20
-14
lines changed

README.md

+17-13
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ If you are loading MathJax from a CDN into a web page, there is no
5151
need to install anything. Simply use a `script` tag that loads
5252
MathJax 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
6262
Repository](https://github.com/mathjax/MathJax-demos-web) for more information.
6363

6464

65-
66-
6765
### Using MathJax Components in node applications
6866

6967
To 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

7576
Then require `mathjax` within your application:
7677

77-
```js
78+
``` javascript
7879
require('mathjax').init({ ... }).then((MathJax) => { ... });
7980
```
8081

8182
where 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
8586
require('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

98101
See the
99102
[documentation](https//docs.mathjax.org/en/latest/index.html#server-nodejs)
100103
and the [MathJax Node
101104
Repository](https://github.com/mathjax/MathJax-demos-node) for more details.
102105

106+
103107
### Using MathJax modules directly in node applications
104108

105109
You 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

125129
If you want to work from the GitHub repository directly, then do the following:
126130

127-
```bash
131+
``` bash
128132
git clone https://github.com/mathjax/MathJax-src.git mathjax-src
129133
cd mathjax-src
130134
npm run --silent compile

components/webpack.common.js

+3-1
Original file line numberDiff line numberDiff line change
@@ -140,6 +140,7 @@ const PACKAGE = function (name, mathjax, libs, dir, dist) {
140140
path: distDir,
141141
filename: name + (dist === '.' ? '.min.js' : '.js')
142142
},
143+
devtool: 'sourcemap',
143144
plugins: PLUGINS(mathjax, libs, dir),
144145
module: MODULE(dir),
145146
performance: {
@@ -150,8 +151,9 @@ const PACKAGE = function (name, mathjax, libs, dir, dist) {
150151
uglifyOptions: {
151152
output: {
152153
ascii_only: true
153-
},
154+
}
154155
},
156+
sourceMap: true
155157
})]
156158
},
157159
mode: 'production'

0 commit comments

Comments
 (0)