/koa-markdown

Auto convert markdown to html for koa. Inspired by connect-markdown

Primary LanguageJavaScriptMIT LicenseMIT

koa-markdown

Build Status

Auto convert markdown to html for koa. Inspired by connect-markdown. Powered by remarkable.

NPM

Usage

var koa = require('koa');
var markdown = require('koa-markdown');

var app = koa();
app.use(markdown({
  root: __dirname + '/docs',
  baseUrl: '/docs'
}));

app.listen(7001);

Or you can checkout the example.

Options

  • root: the markdown file root directory (required)
  • baseUrl: base url of koa-markdown (required)
  • layout: layout html file, default is root/layout.html
  • titleHolder: title place holder in layout.html, default is {TITLE}
  • bodyHolder: body place holder in layout.html, default is {BODY}
  • indexName: request base url will get indexName.md, default is 'index'
  • cache: cache the html page, default is false
  • render: custom render function, default is markdown-it.render
  • mdOptions: markdown-it options, by defualt, koa-markdown is using markdown-it as it's render.

Licences

MIT