5.0.0 • Published 1 year ago
serve-marked v5.0.0
serve-marked
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')
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>',
sanitizer: (htmlString) => sanitize(htmlString) // bring your own html sanitizer if needed
})
WARNING: serve-marked does not sanitize the output HTML. Please use a sanitize library, like DOMPurify, sanitize-html or insane on the output HTML!
Example
License
5.0.0
1 year ago
4.0.0
3 years ago
3.1.2
4 years ago
3.1.1
4 years ago
3.1.0
5 years ago
3.0.0
5 years ago
2.0.3
5 years ago
2.0.2
6 years ago
2.0.1
6 years ago
2.0.0
6 years ago
1.1.0
6 years ago
1.0.0
6 years ago
0.5.0
6 years ago
0.4.0
7 years ago
0.3.3
7 years ago
0.3.2
7 years ago
0.3.1
7 years ago
0.3.0
7 years ago
0.2.3
7 years ago
0.2.2
7 years ago
0.2.1
7 years ago
0.2.0
7 years ago
0.1.0
7 years ago
0.0.1
7 years ago
0.0.0
7 years ago