summaryrefslogblamecommitdiffstats
path: root/lib/highlight.js
blob: ae9a33178bd79dcf9bf48abc41cc8cc7e8b532fb (plain) (tree)





















































                                                                                
// load syntax highlighter
var hljs = require(__dirname + "/../deps/highlight.js/highlight.js").hljs;

// load langs
require(__dirname + "/../deps/highlight.js/languages/cs.js").lang(hljs);
require(__dirname + "/../deps/highlight.js/languages/python.js").lang(hljs);
require(__dirname + "/../deps/highlight.js/languages/mel.js").lang(hljs);
require(__dirname + "/../deps/highlight.js/languages/perl.js").lang(hljs);
require(__dirname + "/../deps/highlight.js/languages/axapta.js").lang(hljs);
require(__dirname + "/../deps/highlight.js/languages/cpp.js").lang(hljs);
require(__dirname + "/../deps/highlight.js/languages/sql.js").lang(hljs);
require(__dirname + "/../deps/highlight.js/languages/smalltalk.js").lang(hljs);
require(__dirname + "/../deps/highlight.js/languages/profile.js").lang(hljs);
require(__dirname + "/../deps/highlight.js/languages/bash.js").lang(hljs);
require(__dirname + "/../deps/highlight.js/languages/lua.js").lang(hljs);
require(__dirname + "/../deps/highlight.js/languages/html-xml.js").lang(hljs);
require(__dirname + "/../deps/highlight.js/languages/renderman.js").lang(hljs);
require(__dirname + "/../deps/highlight.js/languages/1c.js").lang(hljs);
require(__dirname + "/../deps/highlight.js/languages/delphi.js").lang(hljs);
require(__dirname + "/../deps/highlight.js/languages/dos.js").lang(hljs);
require(__dirname + "/../deps/highlight.js/languages/django.js").lang(hljs);
require(__dirname + "/../deps/highlight.js/languages/vbscript.js").lang(hljs);
require(__dirname + "/../deps/highlight.js/languages/ini.js").lang(hljs);
require(__dirname + "/../deps/highlight.js/languages/apache.js").lang(hljs);
require(__dirname + "/../deps/highlight.js/languages/nginx.js").lang(hljs);
require(__dirname + "/../deps/highlight.js/languages/ruby.js").lang(hljs);
require(__dirname + "/../deps/highlight.js/languages/css.js").lang(hljs);
require(__dirname + "/../deps/highlight.js/languages/lisp.js").lang(hljs);
require(__dirname + "/../deps/highlight.js/languages/java.js").lang(hljs);
require(__dirname + "/../deps/highlight.js/languages/javascript.js").lang(hljs);
require(__dirname + "/../deps/highlight.js/languages/php.js").lang(hljs);
require(__dirname + "/../deps/highlight.js/languages/diff.js").lang(hljs);
require(__dirname + "/../deps/highlight.js/languages/avrasm.js").lang(hljs);
require(__dirname + "/../deps/highlight.js/languages/parser3.js").lang(hljs);
require(__dirname + "/../deps/highlight.js/languages/scala.js").lang(hljs);
require(__dirname + "/../deps/highlight.js/languages/tex.js").lang(hljs);

hljs.initialize();

var highlight = function(code, language) {
    if (language == 'plain') {
        return code;
    }

    if (language && hljs.LANGUAGES[language]) {
        return hljs.highlight(language, code).value;
    }

    return hljs.highlightText(code);
}

module.exports = {
    highlight: highlight
};