From a73918fe22e481b5f44479740dd3d5910970bf6f Mon Sep 17 00:00:00 2001 From: cel Date: Wed, 1 May 2019 16:51:09 -1000 Subject: Handle boxed markdown blobs --- lib/render.js | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) (limited to 'lib/render.js') diff --git a/lib/render.js b/lib/render.js index 055d3d2..ec62b31 100644 --- a/lib/render.js +++ b/lib/render.js @@ -66,7 +66,7 @@ MdRenderer.prototype.link = function (ref, title, text) { 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)), + href: this.render.toUrl('/markdown/' + ref), title: 'view rendered markdown' }, 'md'), ']').outerHTML } @@ -86,7 +86,7 @@ MdRenderer.prototype.mention = function (preceding, id) { 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)), + href: this.render.toUrl('/markdown/' + id), title: 'view rendered markdown' }, 'md'), ']').outerHTML } @@ -179,7 +179,10 @@ Render.prototype.markdown = function (text, mentions) { else if (link.host === 'http://localhost:7777') mentionsObj[link.href] = link.link if (link.link) - mentionsByLink[link.link + (link.key ? '#' + link.key : '')] = link + mentionsByLink[link.link + + (link.query && typeof link.query.unbox === 'string' ? + '?unbox=' + link.query.unbox.replace(/\s/g, '+') : '') + + (link.key ? '#' + link.key : '')] = link }) var out = marked(String(text), this.markedOpts) delete this._mentions -- cgit v1.2.3