chenjiahan 6a054ca0e3 Revert "chore: remove @vant/markdown-loader package"
This reverts commit 6eec7f3c2f9207227c178baedf767f3031e040f8.
2021-09-30 10:32:29 +08:00

11 lines
292 B
JavaScript

const hljs = require('highlight.js');
module.exports = function highlight(str, lang) {
if (lang && hljs.getLanguage(lang)) {
// https://github.com/highlightjs/highlight.js/issues/2277
return hljs.highlight(str, { language: lang, ignoreIllegals: true }).value;
}
return '';
};