Don't render Markdown if input or sanitized input is empty

上级 c0a70034
......@@ -11,6 +11,12 @@ const sanitizeOptions = {
function Markdown({ source }) {
const sanitized = sanitize(source, sanitizeOptions)
// sometimes the sanitizer returns "undefined" as a string
if(!source || !sanitized || sanitized === "undefined") {
return null
}
return <Remarkable
options={{html: true, typographer: true, linkify: true, linkTarget: "_blank"}}
source={sanitized}
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册