You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
23 lines
642 B
JavaScript
23 lines
642 B
JavaScript
const
|
|
hljs = require('highlight.js'),
|
|
MarkdownIt = require('markdown-it'),
|
|
katex = require('markdown-it-katex');
|
|
|
|
class Markdown extends MarkdownIt {
|
|
constructor() {
|
|
super({
|
|
linkify: true,
|
|
highlight: function (str, lang) {
|
|
if (lang && hljs.getLanguage(lang))
|
|
try {
|
|
return hljs.highlight(lang, str).value;
|
|
} catch (__) { } // eslint-disable-line no-empty
|
|
return '';
|
|
}
|
|
});
|
|
this.linkify.tlds('.py', false);
|
|
this.use(katex);
|
|
}
|
|
}
|
|
module.exports = new Markdown();
|