Files: 706e99a769b070931c21d59e78030c60a37afc48 / modules_basic / post.js
870 bytesRaw
1 | var markdown = require('ssb-markdown') |
2 | var h = require('hyperscript') |
3 | var u = require('../util') |
4 | var 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 | |
13 | exports.needs = { message_link: 'first', markdown: 'first' } |
14 | |
15 | exports.gives = { |
16 | message_content: true, |
17 | message_title: true |
18 | } |
19 | |
20 | exports.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