diff options
-rw-r--r-- | lib/render.js | 11 |
1 files changed, 10 insertions, 1 deletions
diff --git a/lib/render.js b/lib/render.js index 0e2f95f..c0f3890 100644 --- a/lib/render.js +++ b/lib/render.js @@ -64,6 +64,15 @@ MdRenderer.prototype.link = function (ref, title, text) { var html = a.outerHTML // href is already html-escaped if (hrefToken) html = html.replace(hrefToken, href) + + var link = this.render._mentionsByLink[ref] + if (link && link.type === 'text/x-markdown') { + html += h('sup', ' [', h('a', { + href: this.render.toUrl('/markdown/' + encodeURIComponent(ref)), + title: 'view rendered markdown' + }, 'md'), ']').outerHTML + } + return html } @@ -158,7 +167,7 @@ Render.prototype.markdown = function (text, mentions) { if (!link) return else if (link.emoji) mentionsObj[':' + link.name + ':'] = link - else if (link.name) + else if (link.name && link.link && link.link[0] === '@') mentionsObj['@' + link.name] = link.link else if (link.host === 'http://localhost:7777') mentionsObj[link.href] = link.link |