var msum = require('markdown-summary') module.exports = function (sbot) { return function (data, apply) { function link (data) { return ['a', {href: apply.toUrl('message', {id: data.key})}, data.value.content.text ? msum.title(data.value.content.text) : data.key ] } if(data.key && data.value && data.value.content && data.value.content.type) return link(data) else if(data.id) return function (cb) { sbot.get(data, function (err, msg) { var _data = {key: data.id, value: msg} cb(null, link(data)) }) } } }