aboutsummaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorcel <cel@f/6sQ6d2CMxRUhLpspgGIulDxDCwYD7DzFzPNr7u5AU=.ed25519>2018-01-08 16:10:21 -1000
committercel <cel@f/6sQ6d2CMxRUhLpspgGIulDxDCwYD7DzFzPNr7u5AU=.ed25519>2018-01-08 16:10:21 -1000
commit27f1966a6512bd07a9fe91717a46d1a95281da32 (patch)
tree9a9ac2d5f64f37b908cca39495cb674e29bf2c00 /lib
parentbc7454fa1db558e89c8e8069d527c7b74a4ce60a (diff)
downloadpatchfoo-27f1966a6512bd07a9fe91717a46d1a95281da32.tar.gz
patchfoo-27f1966a6512bd07a9fe91717a46d1a95281da32.zip
Render markdown files in git repos
Diffstat (limited to 'lib')
-rw-r--r--lib/serve.js10
1 files changed, 10 insertions, 0 deletions
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))