[scripts] handle non-existing languages in markdown2htmldoc

This commit is contained in:
Dmytro Meleshko 2019-12-11 23:03:10 +02:00
parent 97764cfaa7
commit d4e04125a6

View file

@ -28,8 +28,9 @@ let md = markdownIt({
highlight: (str, lang) => {
if (lang.length > 0) {
loadPrismLanguages([lang]);
let h = Prism.highlight(str, Prism.languages[lang], lang);
return h;
if (Object.prototype.hasOwnProperty.call(Prism.languages, lang)) {
return Prism.highlight(str, Prism.languages[lang], lang);
}
}
return str;
},