markedify
v0.0.2
Published
Browserify markdown transform.
Downloads
22
Maintainers
Readme
markedify
Browserify transform for markdown, uses marked as parser and highlight.js for code highlighting.
var mdContent = require('path/to/filename.md');
// mdContent is parsed to HTML and stringify, you can use it in your js now.
Installation
npm install --save-dev markedfiy
Usage
CLI
browserify main.js -t markedify --outfile bundle.js
Node
var browserify = require('browserify');
var markedify = require('markedify');
var fs = require('fs');
browserify('./main.js', {debug: true})
.transform(markedify)
.bundle()
.on('error', function (err) {console.log('Error: ' + err.message); })
.pipe(fs.createWriteStream('bundle.js'));
Custom Markdown Renderer
Read marked docs for more details.
var browserify = require('browserify');
var markedify = require('markedify');
var fs = require('fs');
var marked = require('marked');
var renderer = new marked.Renderer();
renderer.code = function(code, lang) {
// highlighting code
return code;
}
var markedOptions = {
renderer: renderer,
gfm: false
};
browserify('./main.js', {debug: true})
.transform(markedify, {marked: markedOptions})
.bundle()
.on('error', function (err) {console.log('Error: ' + err.message); })
.pipe(fs.createWriteStream('bundle.js'));