diff options
author | cel <cel@f/6sQ6d2CMxRUhLpspgGIulDxDCwYD7DzFzPNr7u5AU=.ed25519> | 2017-05-16 08:11:28 -1000 |
---|---|---|
committer | cel <cel@f/6sQ6d2CMxRUhLpspgGIulDxDCwYD7DzFzPNr7u5AU=.ed25519> | 2017-05-16 08:11:41 -1000 |
commit | 36dd4c128fa2b5b789542cb0a3f2b16231980fb4 (patch) | |
tree | 9c0d98a55a28e3a813ecfcb700ed64b54bfbccc7 /lib | |
parent | f8b516671c8a45fb1453fd20d42d692f8040d7a5 (diff) | |
download | patchfoo-36dd4c128fa2b5b789542cb0a3f2b16231980fb4.tar.gz patchfoo-36dd4c128fa2b5b789542cb0a3f2b16231980fb4.zip |
Use hyperscript to generate markdown link html
Diffstat (limited to 'lib')
-rw-r--r-- | lib/render.js | 13 |
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 }; |