summaryrefslogtreecommitdiffstats
path: root/lib/utils/code.js
diff options
context:
space:
mode:
Diffstat (limited to 'lib/utils/code.js')
-rw-r--r--lib/utils/code.js36
1 files changed, 0 insertions, 36 deletions
diff --git a/lib/utils/code.js b/lib/utils/code.js
deleted file mode 100644
index 0d98869..0000000
--- a/lib/utils/code.js
+++ /dev/null
@@ -1,36 +0,0 @@
-var hljs = require('highlight.js');
-
-var MAP = {
- 'py': 'python',
- 'js': 'javascript',
- 'json': 'javascript',
- 'rb': 'ruby',
- 'csharp': 'cs',
-};
-
-function normalize(lang) {
- if(!lang) { return null; }
-
- var lower = lang.toLowerCase();
- return MAP[lower] || lower;
-}
-
-function highlight(lang, code) {
- if(!lang) return code;
-
- // Normalize lang
- lang = normalize(lang);
-
- try {
- return hljs.highlight(lang, code).value;
- } catch(e) { }
-
- return code;
-}
-
-// Exports
-module.exports = {
- highlight: highlight,
- normalize: normalize,
- MAP: MAP
-};