1
0
mirror of https://github.com/yldio/copilot.git synced 2024-12-04 09:00:05 +02:00
copilot/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 '';
};