node package manager
It’s your turn. Help us improve JavaScript. Take the 2017 JavaScript Ecosystem Survey »



Generate file viewer markup for highlighted strings from highlight.js

hifile output

Live demo of example output available on


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/css/hifile.css
  • assets/js/hifile.js with
  • assets/css/hljs-theme-*.css for highlight theming

When served to the browser with the markup, line numbers and line highlighting will be available.