aboutsummaryrefslogtreecommitdiff
path: root/lib/render.js
diff options
context:
space:
mode:
authorcel <cel@f/6sQ6d2CMxRUhLpspgGIulDxDCwYD7DzFzPNr7u5AU=.ed25519>2019-05-01 16:51:09 -1000
committercel <cel@f/6sQ6d2CMxRUhLpspgGIulDxDCwYD7DzFzPNr7u5AU=.ed25519>2019-05-01 16:51:09 -1000
commita73918fe22e481b5f44479740dd3d5910970bf6f (patch)
tree692933b5f1f5a6167f8cc45b03e06b9abea62a21 /lib/render.js
parent7750ee481b305ff8789ca9813da2c62182b25b06 (diff)
downloadpatchfoo-a73918fe22e481b5f44479740dd3d5910970bf6f.tar.gz
patchfoo-a73918fe22e481b5f44479740dd3d5910970bf6f.zip
Handle boxed markdown blobs
Diffstat (limited to 'lib/render.js')
-rw-r--r--lib/render.js9
1 files changed, 6 insertions, 3 deletions
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