Merge pull request #71 from jmendeth/simple-cli

Simple CLI
This commit is contained in:
Emily Eisenberg
2014-09-19 11:51:06 -07:00
3 changed files with 18 additions and 0 deletions

1
.gitignore vendored
View File

@@ -1,4 +1,5 @@
build build
node_modules node_modules
npm-debug.log
last.png last.png
diff.png diff.png

15
cli.js Executable file
View File

@@ -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);
});

View File

@@ -9,6 +9,7 @@
}, },
"files": [ "files": [
"katex.js", "katex.js",
"cli.js",
"src/" "src/"
], ],
"license": "MIT", "license": "MIT",
@@ -21,6 +22,7 @@
"huxley": "~0.7.4", "huxley": "~0.7.4",
"jasmine-node": "git://github.com/mhevery/jasmine-node.git#Jasmine2.0" "jasmine-node": "git://github.com/mhevery/jasmine-node.git#Jasmine2.0"
}, },
"bin": "cli.js",
"scripts": { "scripts": {
"test": "make test" "test": "make test"
} }