Skip to content

Commit

Permalink
Protect against missing languages in code blocks - Fixes #142
Browse files Browse the repository at this point in the history
  • Loading branch information
jdan committed Dec 24, 2015
1 parent e515d4f commit cf79c02
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion lib/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,11 @@ function Cleaver(document, options, includePath) {
marked.setOptions({
gfm: true,
highlight: function (code, lang) {
return (lang) ? hljs.highlight(lang, code).value : code;
try {
return hljs.highlight(lang, code).value;
} catch (e) {
return code;
}
}
});
}
Expand Down

0 comments on commit cf79c02

Please sign in to comment.