www

Unnamed repository; edit this file 'description' to name the repository.
Log | Files | Refs | README

commit 5cf5617c0948db18716ed963cc8112aeb0cc8266
parent 0a0a3430b5e6a172afca5459c22f8df808aadaaa
Author: Emily Eisenberg <xymostech@gmail.com>
Date:   Wed, 10 Jun 2015 14:47:11 -0700

Merge pull request #245 from mjbshaw/display-mode-cli

Add display mode to the CLI
Diffstat:
Mcli.js | 22+++++++++++++++++++---
1 file changed, 19 insertions(+), 3 deletions(-)

diff --git a/cli.js b/cli.js @@ -5,11 +5,27 @@ var katex = require("./"); var input = ""; +// Skip the first two args, which are just "node" and "cli.js" +var args = process.argv.slice(2); + +if (args.indexOf("--help") != -1) { + console.log(process.argv[0] + " " + process.argv[1] + + " [ --help ]" + + " [ --display-mode ]"); + + console.log("\n" + + "Options:"); + console.log(" --help Display this help message"); + console.log(" --display-mode Render in display mode (not inline mode)"); + process.exit(); +} + process.stdin.on("data", function(chunk) { - input += chunk.toString(); + input += chunk.toString(); }); process.stdin.on("end", function() { - var output = katex.renderToString(input); - console.log(output); + var options = { displayMode: args.indexOf("--display-mode") != -1 }; + var output = katex.renderToString(input, options); + console.log(output); });