Set title of a doc

This commit is contained in:
syuilo 2018-07-15 21:48:57 +09:00
parent dfca7f1340
commit 468eb02ff3

View File

@ -225,7 +225,8 @@ router.get('/*/*', async ctx => {
const md = fs.readFileSync(`${__dirname}/../../../src/docs/${doc}.${lang}.md`, 'utf8'); const md = fs.readFileSync(`${__dirname}/../../../src/docs/${doc}.${lang}.md`, 'utf8');
await ctx.render('../../../../src/docs/article', Object.assign({ await ctx.render('../../../../src/docs/article', Object.assign({
html: conv.makeHtml(md) html: conv.makeHtml(md),
title: md.match(/^# (.+?)\r?\n/)[1]
}, await genVars(lang))); }, await genVars(lang)));
}); });