Skip to content
This repository has been archived by the owner on Sep 7, 2020. It is now read-only.

Commit

Permalink
[package.json] bump version
Browse files Browse the repository at this point in the history
fixes merge conflicts.
  • Loading branch information
pkra committed Oct 29, 2017
2 parents 2772e59 + 2a596f0 commit 886dec0
Show file tree
Hide file tree
Showing 4 changed files with 31 additions and 2 deletions.
3 changes: 2 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ The defaults for `pageConfig` are
```javascript
{
format: ["MathML", "TeX", "AsciiMath"], // determines type of pre-processors to run
output: '', // global override for output option; 'svg', 'html' or 'mml'
tex: {}, // configuration options for tex pre-processor, cf. lib/tex.js
ascii: {}, // configuration options for ascii pre-processor, cf. lib/ascii.js
singleDollars: false, // allow single-dollar delimiter for inline TeX
Expand Down Expand Up @@ -59,7 +60,7 @@ and where `mjnodeConfig` represents mathjax-node configuration options, the defa
mml: false, // generate mml output?
svg: false, // generate svg output?
speakText: true, // add spoken annotations to output?
timeout: 10 * 1000, // 10 second timeout before restarting MathJax
timeout: 10 * 1000, // 10 second timeout before restarting MathJax
}
```

Expand Down
9 changes: 9 additions & 0 deletions lib/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ exports.mjpage = function(htmlstring, configOptions, typesetOptions, callback) {
const config = {
// mathjax-node-page specific
format: ["MathML", "TeX", "AsciiMath"], // determines type of pre-processors to run
output: '', // global override for output option; 'svg', 'html' or 'mml'
tex: {}, // configuration options for tex pre-processor
ascii: {}, // configuration options for ascii pre-processor
singleDollars: false, // allow single-dollar delimiter for inline TeX
Expand Down Expand Up @@ -70,6 +71,14 @@ exports.mjpage = function(htmlstring, configOptions, typesetOptions, callback) {
mergeConfig(configOptions, config);
mergeConfig(typesetOptions, typesetConfig);

// override output options with global option
const outputJax = ['svg', 'html', 'mml'];
if (outputJax.indexOf(config.output) > -1){
for (let jax of outputJax){
typesetConfig[jax] = (jax === config.output);
}
}

// Create jsdom options (cf. defaults for config.jsdom)
const jsdomConfig = {
features: {
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "mathjax-node-page",
"version": "1.3.2",
"version": "1.4.1",
"description": "Converter for HTML fragments with mathematics using mathjax-node",
"main": "./lib/main.js",
"scripts": {
Expand Down
19 changes: 19 additions & 0 deletions test/config-global-output.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
const tape = require('tape');
const mjpage = require('../lib/main.js').mjpage;

tape('Configuration option (global) for output', function(t) {
t.plan(1);
const input = '$$x$$';
mjpage(input,
{
format: ["TeX"],
output: "svg"
},
{
svg: false,
html: true
},
function(output) {
t.ok(output.includes('id="MathJax-SVG-1-Title"'), 'global config overrides')
});
});

0 comments on commit 886dec0

Please sign in to comment.