generate markup for highlight.js file viewer

npm install hifile
4 downloads in the last week
17 downloads in the last month


Generate file viewer markup for highlighted strings from highlight.js


var hifile = require('hifile');

var str = fs.readFileSync(path.join(__dirname, 'example.js'), 'utf8'),
var markup = hifile(str, 'js');

Presentation and behaviour are provided via assets/hifile.css and assets/hifile.js; when served to the browser with the markup, line numbers and line highlighting will be available. The end result should look something like:


For an example generation and use, see example.js.

npm loves you