joyent-portal/ui/docs/webpack/embed-markdown-loader/src/highlight.js
Sérgio Ramos 557cd5a291 wip rm css
2016-12-12 10:28:47 +00:00

16 lines
281 B
JavaScript

const hljs = require('highlight.js');
module.exports = (str, lang) => {
if (lang && hljs.getLanguage(lang)) {
try {
return hljs.highlight(lang, str).value;
} catch (err) {}
}
try {
return hljs.highlightAuto(str).value;
} catch (err) {}
return '';
};