diff --git a/cli.js b/cli.js new file mode 100755 index 0000000..7265d14 --- /dev/null +++ b/cli.js @@ -0,0 +1,15 @@ +#!/usr/bin/env node +// Simple CLI for KaTeX. +// Reads TeX from stdin, outputs HTML to stdout. + +var katex = require("./"); +var input = ""; + +process.stdin.on("data", function(chunk) { + input += chunk.toString(); +}); + +process.stdin.on("end", function() { + var output = katex.renderToString(input); + console.log(output); +}); diff --git a/package.json b/package.json index 88d2604..1494426 100644 --- a/package.json +++ b/package.json @@ -9,6 +9,7 @@ }, "files": [ "katex.js", + "cli.js", "src/" ], "license": "MIT", @@ -21,6 +22,7 @@ "huxley": "~0.7.4", "jasmine-node": "git://github.com/mhevery/jasmine-node.git#Jasmine2.0" }, + "bin": "cli.js", "scripts": { "test": "make test" }