blob: 6a0ec9da99ce5abf1db3632906ba003380e59e38 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
|
"use strict";
const highlight = require("highlight.js");
const Markdown = require("markdown-it");
const markdownOptions = {
html: true,
typographer: true,
highlight: function(str, lang) {
if (lang && highlight.getLanguage(lang)) {
try {
return `
${highlight.highlight(lang, str).value}`;
} catch (error) {
console.error("highlighting failed", error);
}
}
return "";
}
};
const markdown = new Markdown(markdownOptions);
module.exports = markdown.render.bind(markdown);
|