Add custom MD renderer for FAQ

This commit is contained in:
Yarmo Mackenbach 2020-08-30 11:45:48 +02:00
parent daa9200903
commit 1efd509779

View file

@ -56,11 +56,15 @@ router.get('/getting-started', (req, res) => {
}); });
router.get('/faq', (req, res) => { router.get('/faq', (req, res) => {
const mdFAQ = require('markdown-it')({typographer: true});
mdFAQ.use(require("markdown-it-anchor"), { "level": 2, "permalink": true, "permalinkClass": 'header-anchor', "permalinkSymbol": '¶', "permalinkBefore": false });
mdFAQ.use(require("markdown-it-table-of-contents"), { "includeLevel": [2], "listType": "ul" });
const env = {}; const env = {};
let data = fs.readFileSync(`./content/faq.md`, "utf8"); let data = fs.readFileSync(`./content/faq.md`, "utf8");
data = data.replace('${domain}', req.app.get('domain')); data = data.replace('${domain}', req.app.get('domain'));
let content = md.render(data, env); let content = mdFAQ.render(data, env);
res.render(`basic`, { title: `Frequently Asked Questions - Keyoxide`, content: content }); res.render(`basic`, { title: `Frequently Asked Questions - Keyoxide`, content: content });
}); });