aboutsummaryrefslogtreecommitdiff
path: root/utils/markedOptions.js
blob: ebc7a6f1c3eb48b7849b505793796627a1f711bc (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
};