Add simple CLI
This commit is contained in:
parent
b7e55607cc
commit
f6dd9e93fb
15
cli.js
Executable file
15
cli.js
Executable 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);
|
||||||
|
});
|
|
@ -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"
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue
Block a user