Created
August 13, 2014 17:09
-
-
Save jfall76/0d85c94c90170264caa3 to your computer and use it in GitHub Desktop.
code that takes either a file or string formatted in markdown
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var parser = require('node-markdown'); | |
var fs = require('fs'); | |
var argv = require('optimist').argv; | |
var file = argv._[0]; | |
var markdown = fs.readFileSync(file, 'UTF-8'); | |
//markdown passed in as a file | |
markdown = parser.Markdown(markdown); | |
//markdown passed in as a string | |
var string = parser.Markdown("**bold** *italic* [link](http://www.neti.ee) `code block`"); | |
console.log("Output from our markdown file:"); | |
console.log(markdown); | |
console.log("Output from our string:"); | |
console.log(string); | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment