diff --git a/src/core/highlighter.js b/src/core/highlighter.js index 70f8cac15..2a39a4a39 100644 --- a/src/core/highlighter.js +++ b/src/core/highlighter.js @@ -3,14 +3,8 @@ const HighlightJs = require('highlight.js'); const _ = require('lodash'); -const langMap = new Map([ - ['nunjucks', 'django'], - ['nunj', 'django'], -]); - module.exports = function highlighter(content, lang) { content = _.toString(content || ''); - lang = langMap.get(lang) || lang; lang = lang ? lang.toLowerCase() : lang; try { return lang ? HighlightJs.highlight(lang, content).value : HighlightJs.highlightAuto(content).value; diff --git a/src/core/utils.js b/src/core/utils.js index 02666c17c..22d389a01 100644 --- a/src/core/utils.js +++ b/src/core/utils.js @@ -12,12 +12,28 @@ const Stream = require('stream'); module.exports = { lang(filePath) { - return fang(filePath) || { - name: Path.parse(filePath).ext.replace('.', '').toUpperCase(), - mode: 'text', - scope: null, - color: null, - }; + const name = Path.parse(filePath).ext.replace('.', '').toUpperCase(); + switch (name) { + case 'NUNJUCKS': + case 'NUNJS': + case 'NUNJ': + case 'NJ': + case 'JINJA2': + case 'J2': + return { + name: 'HTML+Django', + mode: 'django', + scope: 'text.html.django', + color: null, + }; + default: + return fang(filePath) || { + name: name, + mode: 'text', + scope: null, + color: null, + }; + } }, titlize(str) {