Commit b8c0ac9c32b89a9bd44ff026a5f5c5cd4368ffbe
use markdown plug
Dominic Tarr committed on 7/21/2016, 4:54:52 AMParent: 1102f8d1089ec8200edbda914e81221149bb8bfb
Files changed
modules/post.js | changed |
modules/post.js | ||
---|---|---|
@@ -6,31 +6,21 @@ | ||
6 | 6 | //render a message |
7 | 7 | |
8 | 8 | var plugs = require('../plugs') |
9 | 9 | var message_link = plugs.first(exports.message_link = []) |
10 | +var markdown = plugs.first(exports.markdown = []) | |
10 | 11 | |
11 | -exports.message_content = function (data, sbot) { | |
12 | +exports.message_content = function (data) { | |
12 | 13 | if(!data.value.content || !data.value.content.text) return |
13 | 14 | |
14 | 15 | var root = data.value.content.root |
15 | 16 | var re = !root ? null : h('span', 're: ', message_link(root)) |
16 | 17 | |
17 | - var content = h('div') | |
18 | - var d = h('div', re, content) | |
18 | + return h('div', | |
19 | + re, | |
20 | + markdown(data.value.content) | |
21 | + ) | |
19 | 22 | |
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 | |
33 | 23 | } |
34 | 24 | |
35 | 25 | |
36 | 26 | |
@@ -40,4 +30,8 @@ | ||
40 | 30 | |
41 | 31 | |
42 | 32 | |
43 | 33 | |
34 | + | |
35 | + | |
36 | + | |
37 | + |
Built with git-ssb-web