diff options
Diffstat (limited to 'lib/render.js')
-rw-r--r-- | lib/render.js | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/lib/render.js b/lib/render.js index 8f2e56c..b4ca804 100644 --- a/lib/render.js +++ b/lib/render.js @@ -4,6 +4,7 @@ var pull = require('pull-stream') var cat = require('pull-cat') var paramap = require('pull-paramap') var h = require('hyperscript') +var ph = require('pull-hyperscript') var marked = require('ssb-marked') var emojis = require('emoji-named-characters') var qs = require('querystring') @@ -350,6 +351,20 @@ Render.prototype.msgLink = function (msg, cb) { return a } +Render.prototype.phMsgLink = function (msg) { + var self = this + return u.readNext(function (cb) { + self.app.unboxMsg(msg, function (err, msg) { + if (err) return cb(err) + var renderMsg = new RenderMsg(self, self.app, msg, {wrap: false}) + renderMsg.title(function (err, title) { + if (err) return cb(err) + cb(null, ph('a', {href: self.toUrl(msg.key)}, u.escapeHTML(title))) + }) + }) + }) +} + Render.prototype.renderMsg = function (msg, opts, cb) { var self = this self.app.filterMsg(msg, opts, function (err, show) { |