aboutsummaryrefslogtreecommitdiff
path: root/utility/katex/wrapper
diff options
context:
space:
mode:
Diffstat (limited to 'utility/katex/wrapper')
-rwxr-xr-xutility/katex/wrapper16
1 files changed, 16 insertions, 0 deletions
diff --git a/utility/katex/wrapper b/utility/katex/wrapper
new file mode 100755
index 0000000..24a91d1
--- /dev/null
+++ b/utility/katex/wrapper
@@ -0,0 +1,16 @@
+#!/usr/bin/env node
+
+var katex = require("./katex.min.js");
+var input = "";
+
+var args = process.argv.slice(2);
+
+process.stdin.on("data", function(chunk) {
+ input += chunk.toString();
+});
+
+process.stdin.on("end", function() {
+ var options = { displayMode: args.indexOf("--display-mode") !== -1 };
+ var output = katex.renderToString(input, options);
+ console.log(output);
+});