git ssb

16+

Dominic / patchbay



Tree: 41ed6a5aa572f6de601bab35fc108a955657c074

Files: 41ed6a5aa572f6de601bab35fc108a955657c074 / modules_basic / post.js

870 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
8//var plugs = require('../plugs')
9//var message_link = plugs.first(exports.message_link = [])
10//var markdown = plugs.first(exports.markdown = [])
11//
12
13exports.needs = { message_link: 'first', markdown: 'first' }
14
15exports.gives = {
16 message_content: true,
17 message_title: true
18}
19
20exports.create = function (api) {
21 return {
22 message_content,
23 message_title
24 }
25
26 function message_content (data) {
27 if(!data.value.content || !data.value.content.text) return
28
29 return h('div',
30 api.markdown(data.value.content)
31 )
32 }
33
34 function message_title (data) {
35 var root = data.value.content && data.value.content.root
36 return !root ? null : h('span', 're: ', api.message_link(root))
37 }
38}
39
40
41
42
43
44
45
46
47
48
49
50
51
52

Built with git-ssb-web