mirror of
https://codeberg.org/keyoxide/keyoxide-web.git
synced 2024-12-22 23:09:29 -07:00
Add custom MD renderer for FAQ
This commit is contained in:
parent
daa9200903
commit
1efd509779
1 changed files with 5 additions and 1 deletions
|
@ -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 });
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue