diff --git a/README.md b/README.md index d0497292..d35b375a 100644 --- a/README.md +++ b/README.md @@ -96,7 +96,7 @@ The `start` method start (and restarts) mathjax-node. This allows reconfiguratio **Note.** This is done automatically when `typeset` is first called (see below). -### `typset(options, callback)` +### `typeset(options, callback)` The `typeset` method is the main method of mathjax-node. It expects a configuration object `input` and a `callback`. @@ -140,6 +140,7 @@ The `result` object will contain (at most) the following structure: ```javascript { + errors: // an array of MathJax error messages if any errors occurred mml: // a string of MathML markup if requested mmlNode: // a jsdom node of MathML markup if requested html: // a string of HTML markup if requested @@ -148,6 +149,8 @@ The `result` object will contain (at most) the following structure: svg: // a string of SVG markup if requested svgNode: // a jsdom node of SVG markup if requested style: // a string of CSS inline style if SVG requested + height: // a string containing the height of the SVG output if SVG was requested + width: // a string containing the width of the SVG output if SVG was requested speakText: // a string of speech text if requested state: { // the state object (if useGlobalCache or equationNumbers is set) diff --git a/lib/main.js b/lib/main.js index b8a35326..c54b4856 100644 --- a/lib/main.js +++ b/lib/main.js @@ -422,7 +422,7 @@ function ConfigureMathJax() { // // Reset the color extension after `autoload-all` // - if (MathJax.AuthorConfig.extensions.indexOf("TeX/color.js") == -1) { + if (MathJax.AuthorConfig.extensions.indexOf("TeX/color.js") == -1 && MathJax.AuthorConfig.extensions.indexOf("TeX/autoload-all.js") == -1) { MathJax.Hub.Register.StartupHook("TeX autoload-all Ready",function () { var macros = MathJax.InputJax.TeX.Definitions.macros; macros.color = "Color"; diff --git a/package.json b/package.json index 1a5339ad..57bc53de 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "mathjax-node", - "version": "1.0.0", + "version": "1.0.1", "description": "API's for calling MathJax from node.js", "keywords": [ "MathJax", diff --git a/test/userconfig-autoload.js b/test/userconfig-autoload.js new file mode 100644 index 00000000..21ce5eb1 --- /dev/null +++ b/test/userconfig-autoload.js @@ -0,0 +1,20 @@ +var tape = require('tape'); +var mjAPI = require("../lib/main.js"); + +tape('User config: autoload-all should enable color extension', function(t) { + t.plan(1); + + var tex = '\\definecolor{myorange}{RGB}{255,165,100}\\color{myorange}e^{i \\pi}\\color{Black} = -1'; + mjAPI.config( { + extensions: 'TeX/autoload-all', // a convenience option to add MathJax extensions + }); + mjAPI.start(); + + mjAPI.typeset({ + math: tex, + format: "inline-TeX", + mml: true + }, function(data) { + t.ok(!data.errors, 'definecolor should be a known function'); + }); +});