Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to print out a markdown file on the console using node.js?

I have a README.md (markdown syntax) that I want to print out to the console using node.js.

Is this possible?

like image 869
ajsie Avatar asked May 24 '11 13:05

ajsie


1 Answers

First install markdown-js (https://github.com/evilstreak/markdown-js)

$ npm install markdown-js

Then make a javascript:

var markdown = require("markdown-js");
var fs = require("fs");

var str = fs.readFileSync("filename.md", "utf8");

var result = markdown.makeHtml(str);

console.log(result);
like image 131
Sveisvei Avatar answered Nov 08 '22 04:11

Sveisvei