aboutsummaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorcel <cel@f/6sQ6d2CMxRUhLpspgGIulDxDCwYD7DzFzPNr7u5AU=.ed25519>2017-03-09 22:18:19 -0500
committercel <cel@f/6sQ6d2CMxRUhLpspgGIulDxDCwYD7DzFzPNr7u5AU=.ed25519>2017-03-09 22:22:52 -0500
commit94cfd590fe8310ea40707a5e2527503940e80686 (patch)
treecf2ac772ab0b38746de23ebed7f63602e4d5cc91 /lib
parent99a90e6ae99bee6d2444a36c8a4b555d54e8b62e (diff)
downloadpatchfoo-94cfd590fe8310ea40707a5e2527503940e80686.tar.gz
patchfoo-94cfd590fe8310ea40707a5e2527503940e80686.zip
More robust text handling
Diffstat (limited to 'lib')
-rw-r--r--lib/render.js3
1 files changed, 2 insertions, 1 deletions
diff --git a/lib/render.js b/lib/render.js
index cde359d..ed8cb1a 100644
--- a/lib/render.js
+++ b/lib/render.js
@@ -81,6 +81,7 @@ Render.prototype.emoji = function (emoji) {
}
Render.prototype.markdown = function (text, mentions) {
+ if (!text) return ''
var mentionsObj = this._mentions = {}
if (Array.isArray(mentions)) mentions.forEach(function (link) {
if (!link) return
@@ -89,7 +90,7 @@ Render.prototype.markdown = function (text, mentions) {
else if (link.host === 'http://localhost:7777')
mentionsObj[link.href] = link.link
})
- var out = marked((text || '').toString(), this.markedOpts)
+ var out = marked(String(text), this.markedOpts)
delete this._mentions
return out
}