diff --git a/helpers/code.js b/helpers/code.js index d7d5d89..0ebded0 100644 --- a/helpers/code.js +++ b/helpers/code.js @@ -11,6 +11,7 @@ var hljs = require('highlight.js'); */ module.exports = function(language, options) { if (typeof language === 'undefined') language = 'html'; + language = hljs.getLanguage(language) ? language : 'html'; var code = hljs.highlight(language, options.fn(this)).value; diff --git a/helpers/markdown.js b/helpers/markdown.js index f01b4a0..e6ec5f9 100644 --- a/helpers/markdown.js +++ b/helpers/markdown.js @@ -15,6 +15,8 @@ var marked = require('marked'); renderer.code = function(code, language) { if (typeof language === 'undefined') language = 'html'; + language = hljs.getLanguage(language) ? language : 'html'; + var renderedCode = hljs.highlight(language, code).value; var output = `
${renderedCode}
Paragraph
- +my code block should default to html
.class{color:red}