diff options
author | Samy Pesse <samypesse@gmail.com> | 2015-09-12 19:23:07 +0200 |
---|---|---|
committer | Samy Pesse <samypesse@gmail.com> | 2015-09-12 19:23:07 +0200 |
commit | 08ff39fd0b95eed935241da96dcd43ef660f8860 (patch) | |
tree | 812001333acb90c75fc5ba7adc94a4736050fe8a /lib/utils/code.js | |
parent | 82a6ee3875bca2b068d76ccc894c4313d1006b77 (diff) | |
download | gitbook-08ff39fd0b95eed935241da96dcd43ef660f8860.zip gitbook-08ff39fd0b95eed935241da96dcd43ef660f8860.tar.gz gitbook-08ff39fd0b95eed935241da96dcd43ef660f8860.tar.bz2 |
Remove highlight.js dependency
Diffstat (limited to 'lib/utils/code.js')
-rw-r--r-- | lib/utils/code.js | 36 |
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 -}; |