git ssb

0+

ev / microbay



forked from Dominic / patchbay

Commit b8c0ac9c32b89a9bd44ff026a5f5c5cd4368ffbe

use markdown plug

Dominic Tarr committed on 7/21/2016, 4:54:52 AM
Parent: 1102f8d1089ec8200edbda914e81221149bb8bfb

Files changed

modules/post.jschanged
modules/post.jsView
@@ -6,31 +6,21 @@
66 //render a message
77
88 var plugs = require('../plugs')
99 var message_link = plugs.first(exports.message_link = [])
10+var markdown = plugs.first(exports.markdown = [])
1011
11-exports.message_content = function (data, sbot) {
12+exports.message_content = function (data) {
1213 if(!data.value.content || !data.value.content.text) return
1314
1415 var root = data.value.content.root
1516 var re = !root ? null : h('span', 're: ', message_link(root))
1617
17- var content = h('div')
18- var d = h('div', re, content)
18+ return h('div',
19+ re,
20+ markdown(data.value.content)
21+ )
1922
20- var mentions = {}
21- if(Array.isArray(data.value.content.mentions))
22- data.value.content.mentions.forEach(function (link) {
23- if(link.name) mentions["@"+link.name] = link.link
24- })
25-
26- content.innerHTML =
27- markdown.block(data.value.content.text, {toUrl: function (id) {
28- if(ref.isBlob(id))
29- return 'http://localhost:7777/'+encodeURIComponent(id)
30- return '#'+(mentions[id]?mentions[id]:id)
31- }})
32- return d
3323 }
3424
3525
3626
@@ -40,4 +30,8 @@
4030
4131
4232
4333
34+
35+
36+
37+

Built with git-ssb-web