aboutsummaryrefslogtreecommitdiff
path: root/lib/render.js
diff options
context:
space:
mode:
authorcel <cel@f/6sQ6d2CMxRUhLpspgGIulDxDCwYD7DzFzPNr7u5AU=.ed25519>2018-06-28 23:27:37 -1000
committercel <cel@f/6sQ6d2CMxRUhLpspgGIulDxDCwYD7DzFzPNr7u5AU=.ed25519>2018-06-29 11:00:43 -1000
commite16b4a1f99ec9235ed54179a5b29569deac7a298 (patch)
tree51d150ce14a51797225d31c82d2a776578d7f52b /lib/render.js
parentd23f29afb789f399f74d9d33987e8e3e1f235afd (diff)
downloadpatchfoo-e16b4a1f99ec9235ed54179a5b29569deac7a298.tar.gz
patchfoo-e16b4a1f99ec9235ed54179a5b29569deac7a298.zip
Handle audio/video blobs
Diffstat (limited to 'lib/render.js')
-rw-r--r--lib/render.js20
1 files changed, 15 insertions, 5 deletions
diff --git a/lib/render.js b/lib/render.js
index 0d83f75..e9fae80 100644
--- a/lib/render.js
+++ b/lib/render.js
@@ -25,12 +25,22 @@ MdRenderer.prototype.urltransform = function (href) {
}
MdRenderer.prototype.image = function (ref, title, text) {
- var href = this.render.imageUrl(ref)
- return h('img', {
- src: href,
- alt: this.render.getImageAlt(ref, text),
+ var alt = this.render.getImageAlt(ref, text)
+ return (/^video:/.test(text) ? h('video', {
+ controls: 'controls',
+ src: this.render.toUrl(ref),
+ alt: alt,
title: title || undefined
- }).outerHTML
+ }) : /^audio:/.test(text) ? h('audio', {
+ controls: 'controls',
+ src: this.render.toUrl(ref),
+ alt: alt,
+ title: title || undefined
+ }) : h('img', {
+ src: this.render.imageUrl(ref),
+ alt: alt,
+ title: title || undefined
+ })).outerHTML
}
MdRenderer.prototype.link = function (ref, title, text) {