blob: ae9a33178bd79dcf9bf48abc41cc8cc7e8b532fb (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
|
// 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
};
|