aboutsummaryrefslogtreecommitdiff
path: root/lib/render.js
diff options
context:
space:
mode:
Diffstat (limited to 'lib/render.js')
-rw-r--r--lib/render.js7
1 files changed, 5 insertions, 2 deletions
diff --git a/lib/render.js b/lib/render.js
index e6da13c..32085e4 100644
--- a/lib/render.js
+++ b/lib/render.js
@@ -192,10 +192,13 @@ Render.prototype.formatSize = function (size) {
return size.toFixed(2) + ' MB'
}
-Render.prototype.linkify = function (text) {
+Render.prototype.linkify = function (text, opts) {
+ var ellipsis = opts && opts.ellipsis
var arr = text.split(u.ssbRefEncRegex)
for (var i = 1; i < arr.length; i += 2) {
- arr[i] = h('a', {href: this.toUrlEnc(arr[i])}, arr[i])
+ var id = arr[i]
+ var text = ellipsis && id.length > 8 ? id.substr(0, 8) + '…' : id
+ arr[i] = h('a', {href: this.toUrlEnc(id)}, text)
}
return arr
}