mirror of
https://github.com/showdownjs/showdown.git
synced 2024-03-22 13:30:55 +08:00
very basic cli tool
This commit is contained in:
parent
09026001ba
commit
b433d7cd50
16
src/nodedown.js
Normal file
16
src/nodedown.js
Normal file
|
@ -0,0 +1,16 @@
|
||||||
|
var Showdown = require('./showdown');
|
||||||
|
var fs = require('fs');
|
||||||
|
|
||||||
|
var converter = new Showdown.converter();
|
||||||
|
|
||||||
|
if(process.argv.length > 2) {
|
||||||
|
fs.readFile(process.argv[2], function(err, data) {
|
||||||
|
if(err) {
|
||||||
|
console.log("Error: Invalid file");
|
||||||
|
} else {
|
||||||
|
console.log(converter.makeHtml(data.toString()));
|
||||||
|
}
|
||||||
|
})
|
||||||
|
} else {
|
||||||
|
console.log("Error: No file given");
|
||||||
|
}
|
Loading…
Reference in New Issue
Block a user