(input)
| 86 | } |
| 87 | |
| 88 | function writeOutput(input) { |
| 89 | // --format specifies the KaTeX output |
| 90 | const outputFile = options.output; |
| 91 | options.output = options.format; |
| 92 | |
| 93 | const output = katex.renderToString(input, options) + "\n"; |
| 94 | |
| 95 | if (outputFile) { |
| 96 | fs.writeFile(outputFile, output, function(err) { |
| 97 | if (err) { |
| 98 | return console.log(err); |
| 99 | } |
| 100 | }); |
| 101 | } else { |
| 102 | console.log(output); |
| 103 | } |
| 104 | } |
| 105 | |
| 106 | if (require.main !== module) { |
| 107 | module.exports = program; |