blob: 26c208cba78ab53b2ffa012855667a78de12f386 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
|
const hljs = require('highlight.js');
function highlight(code, lang) {
const language = hljs.getLanguage(lang) ? lang : 'plaintext';
const highlighted = hljs.highlight(code, { language }).value;
return highlighted;
}
module.exports = {
highlight
};
|