Files: 7d510f40ceb47f6b4863bc121426ce7492a1bbbc / modules_basic / post.js
872 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 = { |
14 | message_link: 'first', |
15 | markdown: 'first' |
16 | } |
17 | |
18 | exports.gives = { |
19 | message_content: true, |
20 | message_title: true |
21 | } |
22 | |
23 | exports.create = function (api) { |
24 | return { |
25 | message_content, |
26 | message_title |
27 | } |
28 | |
29 | function message_content (data) { |
30 | if(!data.value.content || !data.value.content.text) return |
31 | |
32 | return h('div', |
33 | api.markdown(data.value.content) |
34 | ) |
35 | } |
36 | |
37 | function message_title (data) { |
38 | var root = data.value.content && data.value.content.root |
39 | return !root ? null : h('span', 're: ', api.message_link(root)) |
40 | } |
41 | } |
42 | |
43 | |
44 | |
45 | |
46 | |
47 | |
48 | |
49 | |
50 | |
51 | |
52 | |
53 | |
54 | |
55 |
Built with git-ssb-web