mirror of
https://github.com/Smaug123/KaTeX
synced 2025-10-05 19:28:39 +00:00
Add simple CLI
This commit is contained in:
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"
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user