aboutsummaryrefslogtreecommitdiff
path: root/lib/render.js
diff options
context:
space:
mode:
Diffstat (limited to 'lib/render.js')
-rw-r--r--lib/render.js9
1 files changed, 4 insertions, 5 deletions
diff --git a/lib/render.js b/lib/render.js
index c0f3890..32be2ff 100644
--- a/lib/render.js
+++ b/lib/render.js
@@ -31,14 +31,12 @@ MdRenderer.prototype.image = function (ref, title, text) {
return (/^video:/.test(text) ? h('video', {
controls: 'controls',
src: this.render.toUrl(ref),
- alt: alt,
title: u.unescapeHTML(title) || undefined
- }) : /^audio:/.test(text) ? h('audio', {
+ }, '\n' + alt) : /^audio:/.test(text) ? h('audio', {
controls: 'controls',
src: this.render.toUrl(ref),
- alt: alt,
title: u.unescapeHTML(title) || undefined
- }) : h('img', {
+ }, '\n' + alt) : h('img', {
src: this.render.imageUrl(ref),
alt: alt,
title: u.unescapeHTML(title) || undefined
@@ -190,7 +188,8 @@ Render.prototype.imageUrl = function (ref) {
Render.prototype.getImageAlt = function (id, fallback) {
var link = this._mentionsByLink[id]
if (!link) return fallback
- var name = u.unescapeHTML(link.name || fallback)
+ var name = String(u.unescapeHTML(link.name || fallback))
+ .replace(/^(video|audio):/, '')
return name
+ (link.type && !/\.\S+$/.test(name) ? ' [' + link.type + ']' : '')
+ (link.size != null ? ' (' + this.formatSize(link.size) + ')' : '')