git ssb

16+

Dominic / patchbay



Tree: 010c28ba45ecc8a029b813a3cd9e7edc8e098059

Files: 010c28ba45ecc8a029b813a3cd9e7edc8e098059 / modules_basic / post.js

722 bytesRaw
1var markdown = require('ssb-markdown')
2var h = require('hyperscript')
3var u = require('../util')
4var ref = require('ssb-ref')
5
6//render a message
7
8exports.needs = {
9 message_link: 'first',
10 markdown: 'first'
11}
12
13exports.gives = {
14 message_content: true,
15 message_title: true
16}
17
18exports.create = function (api) {
19 return {
20 message_content,
21 message_title
22 }
23
24 function message_content (data) {
25 if(!data.value.content || !data.value.content.text) return
26
27 return h('div',
28 api.markdown(data.value.content)
29 )
30 }
31
32 function message_title (data) {
33 var root = data.value.content && data.value.content.root
34 return !root ? null : h('span', 're: ', api.message_link(root))
35 }
36}
37
38
39
40
41
42
43
44
45
46
47
48
49
50

Built with git-ssb-web