Translate old codecogs LaTeX to MathJax.
[lw2-viewer.git] / js-foreign-lib / mathjax.js
blob790c3c19b3c790d32dbc9f04a4f36c05ff3fc84a
1 var mathjax = require('mathjax-node'),
2     input = '';
4 mathjax.config({ MathJax: { loader: {load: ['ui/safe']} } });
6 process.stdin.on('data', (chunk) => { input += chunk });
8 process.stdin.on('end', () =>
9         mathjax.typeset( { math: input,
10                            format: "inline-TeX",
11                            html: true,
12                            css: true
13                          },
14                          (data) => {
15                                  if(data.errors) {
16                                          process.exitCode = 1;
17                                  }
18                                  process.stdout.write("<style>"+data.css+"</style>");
19                                  process.stdout.write(data.html);
20                          } )