Skip to content

Commit 0034464

Browse files
committed
Merge branch 'fix-docs' into develop
2 parents 97927a5 + e246f32 commit 0034464

File tree

1 file changed

+56
-24
lines changed

1 file changed

+56
-24
lines changed

README.md

Lines changed: 56 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
# MathJax
22
## Beautiful math in all browsers
33

4-
<img class="shield" alt="GitHub release version" src="https://img.shields.io/github/v/release/mathjax/MathJax-src.svg?sort=semver"> <img class="shield" alt="GitHub release version (branch)" src="https://img.shields.io/github/package-json/v/mathjax/MathJax/legacy-v2?label=release-v2.svg">
4+
<img class="shield" alt="GitHub release version" src="https://img.shields.io/github/v/release/mathjax/MathJax-src.svg?sort=semver"> <img class="shield" alt="GitHub release version (branch)" src="https://img.shields.io/github/package-json/v/mathjax/MathJax/legacy-v2.svg?label=release-v2">
55
<a class="reference external image-reference" href="http://www.numfocus.org"><img alt="powered-by NumFocus" src="https://img.shields.io/badge/powered%20by-NumFOCUS-orange.svg?style=flat&amp;amp;colorA=E1523D&amp;amp;colorB=007D8A"></a>
66

77
MathJax is an open-source JavaScript display engine for LaTeX, MathML,
@@ -75,35 +75,44 @@ If you are loading MathJax from a CDN into a web page, there is no
7575
need to install anything. Simply use a `script` tag that loads
7676
MathJax from the CDN. E.g.,
7777

78-
<script id="MathJax-script" async
79-
src="https://cdn.jsdelivr.net/npm/mathjax@3/es5/tex-mml-chtml.js">
80-
</script>
78+
``` html
79+
<script id="MathJax-script" async src="https://cdn.jsdelivr.net/npm/mathjax@3/es5/tex-mml-chtml.js"></script>
80+
```
8181

82-
See the
83-
[documentation](https://docs.mathjax.org/en/latest/index.html#browser-components)
84-
for more details.
82+
See the [MathJax
83+
documentation](https://docs.mathjax.org/en/latest/index.html#browser-components),
84+
the [MathJax Web Demos](https://github.com/mathjax/MathJax-demos-web),
85+
and the [MathJax Component
86+
Repository](https://github.com/mathjax/MathJax-demos-web) for more information.
8587

8688
### Hosting your own copy of the MathJax Components
8789

8890
If you want to host MathJax from your own server, you can do so by
8991
installing the `mathjax` package using `npm` and moving the `es5`
9092
directory to an appropriate location on your server:
9193

92-
npm install mathjax@3
93-
mv node_modules/mathjax/es5 <path-to-server-location>/mathjax
94+
``` bash
95+
npm install mathjax@3
96+
mv node_modules/mathjax/es5 <path-to-server-location>/mathjax
97+
```
9498

95-
Note that we are still making updates to version 2, so include `@3` when you install, since the latest chronological version may not be version 3.
99+
Note that we are still making updates to version 2, so include `@3`
100+
when you install, since the latest chronological version may not be
101+
version 3.
96102

97103
Alternatively, you can get the files via GitHub:
98104

99-
git clone https://github.com/mathjax/MathJax.git mj-tmp
100-
mv mj-tmp/es5 <path-to-server-location>/mathjax
101-
rm -rf mj-tmp
105+
``` bash
106+
git clone https://github.com/mathjax/MathJax.git mj-tmp
107+
mv mj-tmp/es5 <path-to-server-location>/mathjax
108+
rm -rf mj-tmp
109+
```
102110

103111
Then (in either case) you can use a script tag like the following:
104112

105-
<script id="MathJax-script" async
106-
src="<url-to-your-site>/mathjax/tex-chtml.js"></script>
113+
``` html
114+
<script id="MathJax-script" async src="<url-to-your-site>/mathjax/tex-chtml.js"></script>
115+
```
107116

108117
where `<url-to-your-site>` is replaced by the URL to the location
109118
where you moved the MathJax files above.
@@ -116,9 +125,12 @@ for details.
116125

117126
To use MathJax components in a node application, install the `mathjax` package:
118127

119-
npm install mathjax@3
128+
``` bash
129+
npm install mathjax@3
130+
```
120131

121-
(we are still making updates to version 2, so you should include `@3` since the latest chronological version may not be version 3).
132+
(we are still making updates to version 2, so you should include `@3`
133+
since the latest chronological version may not be version 3).
122134

123135
Then require `mathjax` within your application:
124136

@@ -138,10 +150,17 @@ require('mathjax').init({
138150
}).catch((err) => console.log(err.message));
139151
```
140152

141-
153+
**Note:** this technique is for node-based application only, not for
154+
browser applications. This method sets up an alternative DOM
155+
implementation, which you don't need in the browser, and tells MathJax
156+
to use node's `require()` command to load external modules. This
157+
setup will not work properly in the browser, even if you webpack it or
158+
bundle it in other ways.
159+
142160
See the
143-
[documentation](https//docs.mathjax.org/en/latest/index.html#server-nodejs)
144-
for more details.
161+
[documentation](https://docs.mathjax.org/en/latest/index.html#server-nodejs)
162+
and the [MathJax Node
163+
Repository](https://github.com/mathjax/MathJax-demos-node) for more details.
145164

146165
## Reducing the Size of the Components Directory
147166

@@ -152,11 +171,22 @@ example, if you are using the `tex-chtml.js` component, then you can
152171
remove the `tex-mml-chtml.js`, `tex-svg.js`, `tex-mml-svg.js`,
153172
`tex-chtml-full.js`, and `tex-svg-full.js` configurations, which will
154173
save considerable space. Indeed, you should be able to remove
155-
everything other than `tex-chtml.js`, and the `input/tex/extensions`, `output/chtml/fonts/woff-v2`, `adaptors`, `a11y`, and `sre` directories. If you are using the results only on the web, you can remove `adaptors` as well.
174+
everything other than `tex-chtml.js`, and the `input/tex/extensions`,
175+
`output/chtml/fonts/woff-v2`, `adaptors`, `a11y`, and `sre`
176+
directories. If you are using the results only on the web, you can
177+
remove `adaptors` as well.
156178

157-
If you are not using A11Y support (e.g., speech generation, or semantic enrichment), then you can remove `a11y` and `sre` as well (though in this case you may need to disable the assistive tools in the MathJax contextual menu in order to avoid MathJax trying to load them when they aren't there).
179+
If you are not using A11Y support (e.g., speech generation, or
180+
semantic enrichment), then you can remove `a11y` and `sre` as well
181+
(though in this case you may need to disable the assistive tools in
182+
the MathJax contextual menu in order to avoid MathJax trying to load
183+
them when they aren't there).
158184

159-
If you are using SVG rather than CommonHTML output (e.g., `tex-svg.js` rather than `tex-chtml.js`), you can remove the `output/chtml/fonts/woff-v2` directory. If you are using MathML input rather than TeX (e.g., `mml-chtml.js` rather than `tex-chtml.js`), then you can remove `input/tex/extensions` as well.
185+
If you are using SVG rather than CommonHTML output (e.g., `tex-svg.js`
186+
rather than `tex-chtml.js`), you can remove the
187+
`output/chtml/fonts/woff-v2` directory. If you are using MathML input
188+
rather than TeX (e.g., `mml-chtml.js` rather than `tex-chtml.js`),
189+
then you can remove `input/tex/extensions` as well.
160190

161191

162192
## The Component Files and Pull Requests
@@ -165,7 +195,9 @@ The `es5` directory is generated automatically from the contents of the
165195
MathJax source repository. You can rebuild the components using the
166196
command
167197

168-
npm run make-es5 --silent
198+
``` bash
199+
npm run make-es5 --silent
200+
```
169201

170202
Note that since the contents of this repository are generated
171203
automatically, you should not submit pull requests that modify the

0 commit comments

Comments
 (0)