Skip to content

Commit 8efd937

Browse files
authored
v1.0.1 release (#315)
* [main] user configuration with autoload-all should enable color extension; fixes #307 * [readme] add documentation for result.width, result.height, result.erros; fixes #310
1 parent f96453e commit 8efd937

File tree

3 files changed

+25
-2
lines changed

3 files changed

+25
-2
lines changed

README.md

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -96,7 +96,7 @@ The `start` method start (and restarts) mathjax-node. This allows reconfiguratio
9696

9797
**Note.** This is done automatically when `typeset` is first called (see below).
9898

99-
### `typset(options, callback)`
99+
### `typeset(options, callback)`
100100

101101
The `typeset` method is the main method of mathjax-node. It expects a configuration object `input` and a `callback`.
102102

@@ -140,6 +140,7 @@ The `result` object will contain (at most) the following structure:
140140

141141
```javascript
142142
{
143+
errors: // an array of MathJax error messages if any errors occurred
143144
mml: // a string of MathML markup if requested
144145
mmlNode: // a jsdom node of MathML markup if requested
145146
html: // a string of HTML markup if requested
@@ -148,6 +149,8 @@ The `result` object will contain (at most) the following structure:
148149
svg: // a string of SVG markup if requested
149150
svgNode: // a jsdom node of SVG markup if requested
150151
style: // a string of CSS inline style if SVG requested
152+
height: // a string containing the height of the SVG output if SVG was requested
153+
width: // a string containing the width of the SVG output if SVG was requested
151154
speakText: // a string of speech text if requested
152155

153156
state: { // the state object (if useGlobalCache or equationNumbers is set)

lib/main.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -422,7 +422,7 @@ function ConfigureMathJax() {
422422
//
423423
// Reset the color extension after `autoload-all`
424424
//
425-
if (MathJax.AuthorConfig.extensions.indexOf("TeX/color.js") == -1) {
425+
if (MathJax.AuthorConfig.extensions.indexOf("TeX/color.js") == -1 && MathJax.AuthorConfig.extensions.indexOf("TeX/autoload-all.js") == -1) {
426426
MathJax.Hub.Register.StartupHook("TeX autoload-all Ready",function () {
427427
var macros = MathJax.InputJax.TeX.Definitions.macros;
428428
macros.color = "Color";

test/userconfig-autoload.js

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
var tape = require('tape');
2+
var mjAPI = require("../lib/main.js");
3+
4+
tape('User config: autoload-all should enable color extension', function(t) {
5+
t.plan(1);
6+
7+
var tex = '\\definecolor{myorange}{RGB}{255,165,100}\\color{myorange}e^{i \\pi}\\color{Black} = -1';
8+
mjAPI.config( {
9+
extensions: 'TeX/autoload-all', // a convenience option to add MathJax extensions
10+
});
11+
mjAPI.start();
12+
13+
mjAPI.typeset({
14+
math: tex,
15+
format: "inline-TeX",
16+
mml: true
17+
}, function(data) {
18+
t.ok(!data.errors, 'definecolor should be a known function');
19+
});
20+
});

0 commit comments

Comments
 (0)