serve-marked

version repo

Serve marked rendered README.md file with elegant style.

Usage

npm i serve-marked

const fs = require('fs')
const http = require('http')
const serveMarked = require('serve-marked').default

const markdown = fs.readFileSync('./README.md', 'utf8')
const serveReadme = serveMarked(markdown)

http.createServer(serveReadme).listen(3000)

or you can use it with options:

const serveReadme = serveMarked('# Markdown Content', {
  title: 'Awesome Project',
  preset: 'merri',  // Available presets: 'github', 'merri'
  contentClassName: 'main-body', // Default: 'markdown-body'
  inlineCSS: `
    @import url('https://rsms.me/inter/inter-ui.css');
    body { color: #333 }
  `,
  beforeHeadEnd: '<meta name="description" content="...">',
  beforeBodyEnd: '<script>/*...*/</script>',
})

Example

License

ISC