Commit ccc712bad78a439c6287c829554052b9cd943a4b
render svg
Anders Rune Jensen committed on 7/7/2017, 8:27:14 PMParent: d6e3e6a468d96496d2bc2c9f4e092864723d88d2
Files changed
render.js | changed |
render.js | ||
---|---|---|
@@ -40,13 +40,19 @@ | ||
40 | 40 | return href; |
41 | 41 | }; |
42 | 42 | |
43 | 43 | MdRenderer.prototype.image = function(href, title, text) { |
44 | - return h('img', | |
45 | - { src: this.opts.img_base + href, | |
46 | - alt: text, | |
47 | - title: title | |
48 | - }).outerHTML; | |
44 | + if (text.endsWith(".svg")) | |
45 | + return h('object', | |
46 | + { type: 'image/svg+xml', | |
47 | + data: href, | |
48 | + alt: text }).outerHTML; | |
49 | + else | |
50 | + return h('img', | |
51 | + { src: this.opts.img_base + href, | |
52 | + alt: text, | |
53 | + title: title | |
54 | + }).outerHTML; | |
49 | 55 | }; |
50 | 56 | |
51 | 57 | function renderEmoji(emoji) { |
52 | 58 | var opts = this.renderer.opts; |
Built with git-ssb-web