From 27f1966a6512bd07a9fe91717a46d1a95281da32 Mon Sep 17 00:00:00 2001 From: cel Date: Mon, 8 Jan 2018 16:10:21 -1000 Subject: Render markdown files in git repos --- lib/serve.js | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/lib/serve.js b/lib/serve.js index eb8610c..f146c49 100644 --- a/lib/serve.js +++ b/lib/serve.js @@ -2332,6 +2332,16 @@ Serve.prototype.wrapBinary = function (opts) { src: opts.rawUrl }) } + if (type === 'text/markdown') { + // TODO: rewrite links to files/images to be correct + return ph('blockquote', u.readNext(function (cb) { + pull.collect(function (err, bufs) { + if (err) return cb(pull.error(err)) + var text = Buffer.concat(bufs).toString('utf8') + return cb(null, pull.once(self.app.render.markdown(text))) + })(read) + })) + } return ph('pre', pull.map(function (buf) { return self.app.render.highlight(buf.toString('utf8'), ext) })(read)) -- cgit v1.2.3