diff options
Diffstat (limited to 'lib')
-rw-r--r-- | lib/render.js | 15 |
1 files changed, 12 insertions, 3 deletions
diff --git a/lib/render.js b/lib/render.js index 69666a5..055d3d2 100644 --- a/lib/render.js +++ b/lib/render.js @@ -77,12 +77,21 @@ MdRenderer.prototype.link = function (ref, title, text) { MdRenderer.prototype.mention = function (preceding, id) { var href = this.urltransform(id) var myName = this.render.app.getNameSync(id) - if (id.length > 50) id = id.slice(0, 8) + '…' - return (preceding||'') + h('a', { + var html = (preceding||'') + h('a', { class: href === false ? 'bad' : undefined, href: href !== false ? href : undefined, title: myName || undefined, - }, id).outerHTML + }, id.length > 50 ? id.slice(0, 8) + '…' : id).outerHTML + + var link = this.render._mentionsByLink[id] + if (link && link.type === 'text/x-markdown') { + html += h('sup', ' [', h('a', { + href: this.render.toUrl('/markdown/' + encodeURIComponent(id)), + title: 'view rendered markdown' + }, 'md'), ']').outerHTML + } + + return html } MdRenderer.prototype.code = function (code, lang, escaped) { |