diff options
Diffstat (limited to 'lib/render.js')
-rw-r--r-- | lib/render.js | 11 |
1 files changed, 9 insertions, 2 deletions
diff --git a/lib/render.js b/lib/render.js index dd6d55e..3b4a142 100644 --- a/lib/render.js +++ b/lib/render.js @@ -129,6 +129,7 @@ Render.prototype.markdown = function (text, mentions) { Render.prototype.imageUrl = function (ref) { var m = /^blobstore:(.*)/.exec(ref) if (m) ref = m[1] + ref = ref.replace(/#/, '%23') return this.opts.img_base + ref } @@ -161,8 +162,14 @@ Render.prototype.toUrl = function (href) { if (!u.isRef(href)) return false return this.opts.base + href case '&': - if (!u.isRef(href)) return false - return this.opts.blob_base + href + var parts = href.split('#') + var hash = parts.shift() + var key = parts.shift() + var fragment = parts.join('#') + if (!u.isRef(hash)) return false + return this.opts.blob_base + hash + + (key ? encodeURIComponent('#' + key) : '') + + (fragment ? '#' + fragment : '') case '#': return this.opts.base + 'channel/' + encodeURIComponent(href.substr(1)) case '/': return this.opts.base + href.substr(1) |