aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--lib/render.js13
1 files changed, 6 insertions, 7 deletions
diff --git a/lib/render.js b/lib/render.js
index 1cd92e6..74b4f4f 100644
--- a/lib/render.js
+++ b/lib/render.js
@@ -37,13 +37,12 @@ MdRenderer.prototype.image = function (ref, title, text) {
MdRenderer.prototype.link = function(href, title, text) {
href = this.urltransform(href)
var name = href && /^\/(&|%26)/.test(href) && (title || text)
- return '<a'
- + (href !== false
- ? ' href="' + href + '"'
- : ' class="bad"')
- + (title ? ' title="' + title + '"' : '')
- + (name ? ' download="' + encodeURIComponent(name) + '"' : '')
- + '>' + text + '</a>'
+ return h('a', {
+ class: href === false ? 'bad' : undefined,
+ href: href !== false ? href : undefined,
+ title: title || undefined,
+ download: name ? encodeURIComponent(name) : undefined
+ }, text).outerHTML
};